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)
Applescript (something like):
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:
This is my first Applescript so please post improvements/expansions
Enjoy,
-Nevyn
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
Code:
tell application "Finder"
set file type of file this_file to "MooV"
end tell
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
Enjoy,
-Nevyn
Last edited: