AVI Videos in iTunes

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

nevyn

New member
Joined
Dec 17, 2007
Messages
2
Points
0
I've been looking into using iTunes to manage some avi TV shows as well as music clips found you couldn't import these directly into iTunes. A suggested solution was to use QT-Pro to either re-encode it or make a .mov link, since I think this is a bit of a hack I looked into other ways to get this to work. Since I haven't seen this solution elswhere on the web I though I'd share :)

The reason iTunes does not play avi files can be plainly seen in iTunes.app/Info.plist under "CFBundleDocumentTypes". iTunes can also recognise video files by the optional meta-data associated with the file in place of the extension. As there is no entry for .avi and most .avi files do not have the extra meta-data iTunes does not support them.

There are three ways to get .avi files to load into the iTunes library, these are packaging it in a supported format (QT-Pro workaround), adding extra entries to the CFBundleDocumentTypes (may cause problems when updating iTunes) or adding the movie-type meta-data to the file. Adding the movie-type meta-data to the file is the quickest, easiest and safest of all of these options (IMHO).

The file-type meta-data can be changed by using Terminal or Applescript/Automator by doing either of the following (note that iTunes does not check the creator type):

Terminal (requires Apple Dev Tools)
Code:
$ SetFile -t "MooV" /path/to/movie.avi
Applescript (something like):
Code:
tell application "Finder"
   set file type of file this_file to "MooV"
end tell
That's it. You should now be able to drag and drop the movie into iTunes.

The next step would be to create a Folder Action or a Droplet that adds the movie-type meta and adds the file to iTunes, see below:

Code:
(*add movie to iTunes

The script will add OSList file-type information to a list of files.  This identifies them 
as movie files, the files are then imported into iTunes.

TO DO:
  Verification of file list passed as video files
  Growl integration (if installed)
  Move repeat loop into separate object script to clean-up code.
*)

--Folder Action [Attach to a folder in Finder]
on adding folder items to this_folder after receiving file_list
	repeat with each_file in file_list
		try
			tell application "Finder" to set file type of file each_file to "MooV"
		end try
	end repeat
	tell application "iTunes" to add file_list
end adding folder items to

--Droplet [Compile and drop items onto application]
on open file_list
	repeat with each_file in file_list
		try
			tell application "Finder" to set file type of file each_file to "MooV"
		end try
	end repeat
	tell application "iTunes" to add file_list
end open
This is my first Applescript so please post improvements/expansions :)

Enjoy,
-Nevyn
 
Last edited:

Nentecular

New member
Joined
Aug 17, 2008
Messages
3
Points
0
Having just bought an AppleTV, I'm madly converting a load of videos using VisualHub which I also just bought - If I were to do this instead would the AppleTV play them and save me the time and effort of doing the conversions?
 

nevyn

New member
Joined
Dec 17, 2007
Messages
2
Points
0
Thanks for the feedback casm.


Hey Nentecular,
iTunes and FrontRow both use the QuickTime Player for video content so whatever you want to play must be supported by QuickTime. You can expand the types of videos supported by Quicktime by installing "Perian", a free, open source QuickTime component that adds native support for many popular video formats. There is also Filp4Mac which will adds support for WMV files.

If the video formats you have are supported by a 3rd party QuickTime component like the ones above, then you do not need to convert them, saving you time, effort and the loss of quality.

I had a quick look to see if these work the same on the AppleTV as they do for a regular Apple Desktop and while the concept of adding more QuickTime components works it is a bit more hands on than simply using the installer.

See "awkwardtv", a wiki on AppleTV for:
List_of_file_formats_working_on_Apple_TV
Beginners_Guide2
Install_Perian
(I'd post full links if i could)

Cheers,
-Nevyn
 

paolo.sereni

New member
Joined
Aug 26, 2008
Messages
1
Points
0
nevyn said:
I've been looking into using iTunes to manage some avi TV shows as well as music clips found you couldn't import these directly into iTunes. A suggested solution was to use QT-Pro to either re-encode it or make a .mov link, since I think this is a bit of a hack I looked into other ways to get this to work. Since I haven't seen this solution elswhere on the web I though I'd share :)

The reason iTunes does not play avi files can be plainly seen in iTunes.app/Info.plist under "CFBundleDocumentTypes". iTunes can also recognise video files by the optional meta-data associated with the file in place of the extension. As there is no entry for .avi and most .avi files do not have the extra meta-data iTunes does not support them.

There are three ways to get .avi files to load into the iTunes library, these are packaging it in a supported format (QT-Pro workaround), adding extra entries to the CFBundleDocumentTypes (may cause problems when updating iTunes) or adding the movie-type meta-data to the file. Adding the movie-type meta-data to the file is the quickest, easiest and safest of all of these options (IMHO).

The file-type meta-data can be changed by using Terminal or Applescript/Automator by doing either of the following (note that iTunes does not check the creator type):

Terminal (requires Apple Dev Tools)
Code:
$ SetFile -t "MooV" /path/to/movie.avi
Applescript (something like):
Code:
tell application "Finder"
   set file type of file this_file to "MooV"
end tell
That's it. You should now be able to drag and drop the movie into iTunes.

The next step would be to create a Folder Action or a Droplet that adds the movie-type meta and adds the file to iTunes, see below:

Code:
(*add movie to iTunes

The script will add OSList file-type information to a list of files.  This identifies them 
as movie files, the files are then imported into iTunes.

TO DO:
  Verification of file list passed as video files
  Growl integration (if installed)
  Move repeat loop into separate object script to clean-up code.
*)

--Folder Action [Attach to a folder in Finder]
on adding folder items to this_folder after receiving file_list
	repeat with each_file in file_list
		try
			tell application "Finder" to set file type of file each_file to "MooV"
		end try
	end repeat
	tell application "iTunes" to add file_list
end adding folder items to

--Droplet [Compile and drop items onto application]
on open file_list
	repeat with each_file in file_list
		try
			tell application "Finder" to set file type of file each_file to "MooV"
		end try
	end repeat
	tell application "iTunes" to add file_list
end open
This is my first Applescript so please post improvements/expansions :)

Enjoy,
-Nevyn
Hi nevyn,

I tried to follow your script but I was not able to made it work. I am really a beginner so if you could guide me step by step that would be much appreciated. Here is my problem:

1. I open applescript utility
2. I set up actions (without enabling GUI scripting)
3. I add a folder action from documents and choose add - new item alert.scpt to attach
4. I edit the script and it opens the script editor
5. I delete the current script and I attach your code and it tells me "The variable this_file is not defined."
6. I changed into avi but the problems remain

What should I do?

Thanks in advance for your time and help!!
 

HiTekAlex

New member
Joined
Oct 31, 2003
Messages
4
Points
0
Just wondering.. is there any way to add a command to this script that would auto-tag all Video files as "TV Show", before adding it to iTunes?

Basically, I want to be able to drop AVI TV show to a folder, and have it auto set as MooV file type, tagged as "TV Show" and get added to iTunes library.

Thanks (& sorry for newbie question, but still trying to get my head around AppleScripts)
 

HiTekAlex

New member
Joined
Oct 31, 2003
Messages
4
Points
0
HiTekAlex said:
Just wondering.. is there any way to add a command to this script that would auto-tag all Video files as "TV Show", before adding it to iTunes?

Basically, I want to be able to drop AVI TV show to a folder, and have it auto set as MooV file type, tagged as "TV Show" and get added to iTunes library.

Thanks (& sorry for newbie question, but still trying to get my head around AppleScripts)
No one has any suggestions?
 

S2_Mac

New member
Joined
Oct 24, 2006
Messages
4,876
Points
0
Location
About 3 feet in front of the monitor
Applescript is just a language that lets apps share their apple events; it has just enough smarts (text handling, reading/writing files, math functions, etc.) to facilitate that intracommunication. So no -- Applescript will not be able to tag something before it's added to iTunes. But yes -- Applescript will be able to direct iTunes to tag a track after it gets added to iTunes.

You would need to use the "add" command, specifying a file path of the track to add to iTunes' library. If the track is successfully added, iTunes will return a reference to the new track object, which you can use to change its tags. Looking through a few of Doug's scripts that add tracks will show you the nuts and bolts.
 

gardellen

New member
Joined
Dec 3, 2008
Messages
2
Points
0
I was really happy when I found out it was possible to add avi-files to iTunes _without_ having to put each file in a mov container using "save as" in QT Pro.

How do we go about flv files? I have way to many files; "save as" for each file or batch converting with some app isn't an option. I never re-convert a file unless I have to ie iPod standards and such.

Regards

edit: Nevermind. By looking at "AViTunes" in Automator I just realized that all I needed to do was to change "Filter Finder Items" to look for flv instead of avi 8)

I hope this will help someone! I am so sick of everyone talking about re-converting files, when it's not needed!

Peace
 
Last edited:

pmcd

New member
Joined
Jan 14, 2009
Messages
2
Points
0
Hmm...I must be losing it. To make the Applescript you simply enter

tell application "Finder"
set file type of file this_file to "MooV"
end tell


Then compile and save as a scipt or app? If I do that it tells me the variable this_file is not defined. What am I missing?

Thank's...philip
 

JSPR

New member
Joined
Mar 17, 2009
Messages
4
Points
0
larryo108 said:
Is there a similar way to do this in Windows XP?
Yes and no.

You can import an avi with some QuickTime scripting through COM, but the required playback codecs may not be available for QuickTime for Windows. Almost none are. I know there is a component for 3ivx, but xvid and others are absent.

If you need to try it out, open the file in QT Player, and simply save it. It will be saved as a .mov file, which iTunes will accept.
 

sdeez

New member
Joined
Apr 8, 2009
Messages
1
Points
0
Not if you don't have QT Pro

Yes and no.

You can import an avi with some QuickTime scripting through COM, but the required playback codecs may not be available for QuickTime for Windows. Almost none are. I know there is a component for 3ivx, but xvid and others are absent.

If you need to try it out, open the file in QT Player, and simply save it. It will be saved as a .mov file, which iTunes will accept.
I'm XP, but do not have QT Pro, so I could not save. I have Winamp, but must have deleted the format converter that it used to convert other files.

I added a lot of stills and avi clips when I first synced them from HD to iTunes, but now I can't add stills or clips. I don't want to sync again, b/c I migrated some stuff to back up CDs.

Thanks for any help.
 

cecered

New member
Joined
Jul 6, 2009
Messages
2
Points
0
perfect!

Thank you so much Nevyn, your script is perfect, I've searched for this for so long, and it works. great!
thank you again.

paolo.sereni, you just have to:
- open script editor
- copy paste this:
(*add movie to iTunes

The script will add OSList file-type information to a list of files. This identifies them
as movie files, the files are then imported into iTunes.

TO DO:
Verification of file list passed as video files
Growl integration (if installed)
Move repeat loop into separate object script to clean-up code.
*)

--Folder Action [Attach to a folder in Finder]
on adding folder items to this_folder after receiving file_list
repeat with each_file in file_list
try
tell application "Finder" to set file type of file each_file to "MooV"
end try
end repeat
tell application "iTunes" to add file_list
end adding folder items to

--Droplet [Compile and drop items onto application]
on open file_list
repeat with each_file in file_list
try
tell application "Finder" to set file type of file each_file to "MooV"
end try
end repeat
tell application "iTunes" to add file_list
end open

- choose: file>save as>(document type) application
- select the file/files you want to add to itunes and drag them onto the app you just made.

that's it, check out itunes and your files will be there.

hope this helps.
Cesare
 

luckas

New member
Joined
May 29, 2011
Messages
1
Points
0
Nevyn, is the setfile still working in MAC OS 10.6.6 with itunes 10.1.2?

I ran the setfile from terminal and no error so I tried to add the file or drop it to itunes and nothing happens...

Then I used the apple script and I get the following errors:

----------------------
tell application "Finder"
set file type of file PATH to "MooV"
--> error number -1728 from file PATH
Result:
error "Finder got an error: Can’t set file PATH to \"MooV\"." number -10006 from file PATH to «class MooV»
-----------------------

I would not like to spend 30 bucks in the QT Pro to save the movie as a reference file :(
 

newbeginningboy

New member
Joined
Sep 12, 2012
Messages
4
Points
0
According to Apple official website, iTunes only works with QuickTime and MPEG-4 Movie files that end in ".mov", ".m4v", or ".mp4" and are playable in QuickTime Player. Therefore, if you try to import .avi movie to iTunes for syncing, it will end in fail in importing AVI video to iTunes let alone transfer this AVI file to iPad, iPhone, iPod.

In order to successfully import AVI files to iTunes, we have to convert this AVI video to iTunes compatible video format like MP4.

Just google search Step by Step Guide on How to Import AVI to iTunes to Transfer AVI to iPad/iPad 2/iPad 3

You will find a Easy Solution to Convert and Import AVI to iTunes so as to Transfer AVI Files to iPad/iPhone/iPod successfully
 

newwikstromkare

New member
Joined
May 13, 2013
Messages
1
Points
0
i does what you said, i did find the solution, but all of them are shareware, anyway it helps, thanks for sharing
 

GNTFiber

New member
Joined
May 22, 2015
Messages
1
Points
0
Website
www.gntfiberpelangsing.com
I've been looking into using iTunes to manage some avi TV shows as well as music clips found you couldn't import these directly into iTunes. A suggested solution was to use QT-Pro to either re-encode it or make a .mov link, since I think this is a bit of a hack I looked into other ways to get this to work. Since I haven't seen this solution elswhere on the web I though I'd share :)

The reason iTunes does not play avi files can be plainly seen in iTunes.app/Info.plist under "CFBundleDocumentTypes". iTunes can also recognise video files by the optional meta-data associated with the file in place of the extension. As there is no entry for .avi and most .avi files do not have the extra meta-data iTunes does not support them.

There are three ways to get .avi files to load into the iTunes library, these are packaging it in a supported format (QT-Pro workaround), adding extra entries to the CFBundleDocumentTypes (may cause problems when updating iTunes) or adding the movie-type meta-data to the file. Adding the movie-type meta-data to the file is the quickest, easiest and safest of all of these options (IMHO).

The file-type meta-data can be changed by using Terminal or Applescript/Automator by doing either of the following (note that iTunes does not check the creator type):

Terminal (requires Apple Dev Tools)
Code:
$ SetFile -t "MooV" /path/to/movie.avi
Applescript (something like):
Code:
tell application "Finder"
   set file type of file this_file to "MooV"
end tell
That's it. You should now be able to drag and drop the movie into iTunes.

The next step would be to create a Folder Action or a Droplet that adds the movie-type meta and adds the file to iTunes, see below:

Code:
(*add movie to iTunes

The script will add OSList file-type information to a list of files.  This identifies them 
as movie files, the files are then imported into iTunes.

TO DO:
  Verification of file list passed as video files
  Growl integration (if installed)
  Move repeat loop into separate object script to clean-up code.
*)

--Folder Action [Attach to a folder in Finder]
on adding folder items to this_folder after receiving file_list
	repeat with each_file in file_list
		try
			tell application "Finder" to set file type of file each_file to "MooV"
		end try
	end repeat
	tell application "iTunes" to add file_list
end adding folder items to

--Droplet [Compile and drop items onto application]
on open file_list
	repeat with each_file in file_list
		try
			tell application "Finder" to set file type of file each_file to "MooV"
		end try
	end repeat
	tell application "iTunes" to add file_list
end open
This is my first Applescript so please post improvements/expansions :)

Enjoy,
-Nevyn

waaaa.... your script is greatt... thank youuu
 
Top