Become a member of the iLounge Forums. Register Now!
To start viewing messages, select the forum that you want to visit from the selection below.
If this is your first visit, be sure to check out the Forum FAQ and Forum Policy.

Topic: AVI Videos in iTunes

Reply Thread Tools Topic Search
Old 12-16-2007, 09:24 PM
#1
 
Freshman Lounger
 
Join Date: Dec 2007
Posts: 2
AVI Videos in iTunes

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 by nevyn; 12-16-2007 at 09:43 PM.
nevyn is offline  
Reply With Quote

Join the iLounge Community and the ad above will disappear.

Old 08-17-2008, 04:11 PM
#2
 
Freshman Lounger
 
Join Date: Aug 2008
Posts: 1
First try

Your script runs smoothly. Fine Job!
Casm is offline  
Reply With Quote
Old 08-17-2008, 04:33 PM
#3
 
Freshman Lounger
 
Join Date: Aug 2008
Posts: 3

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?
Nentecular is offline  
Reply With Quote
Old 08-17-2008, 08:57 PM
#4
 
Freshman Lounger
 
Join Date: Dec 2007
Posts: 2

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
nevyn is offline  
Reply With Quote
Old 08-25-2008, 03:35 PM
#5
 
Freshman Lounger
 
Join Date: Aug 2008
Posts: 1

Quote:
Originally Posted by nevyn
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!!
paolo.sereni is offline  
Reply With Quote
Old 11-09-2008, 08:26 AM
#6
 
Freshman Lounger
 
Join Date: Oct 2003
Posts: 4

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 is offline  
Reply With Quote
Old 11-22-2008, 04:54 PM
#7
 
Freshman Lounger
 
Join Date: Oct 2003
Posts: 4

Quote:
Originally Posted by HiTekAlex
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?
HiTekAlex is offline  
Reply With Quote
Old 11-30-2008, 12:13 PM
#8
 
Veteran Lounger
 
S2_Mac's Avatar
 
Join Date: Oct 2006
Location: About 3 feet in front of the monitor
Posts: 4,878

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.
S2_Mac is offline  
Reply With Quote
Old 12-03-2008, 09:51 AM
#9
 
Freshman Lounger
 
Join Date: Dec 2008
Posts: 2

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 by gardellen; 12-03-2008 at 10:42 AM.
gardellen is offline  
Reply With Quote
Old 01-14-2009, 03:18 AM
#10
 
Freshman Lounger
 
Join Date: Jan 2009
Posts: 2

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
pmcd is offline  
Reply With Quote
Old 03-06-2009, 11:49 AM
#11
 
Freshman Lounger
 
Join Date: May 2006
Posts: 14

Is there a similar way to do this in Windows XP?
larryo108 is offline  
Reply With Quote
Old 03-16-2009, 02:00 PM
#12
 
Freshman Lounger
 
Join Date: Mar 2009
Posts: 4

Quote:
Originally Posted by larryo108
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.
JSPR is offline  
Reply With Quote
Old 04-07-2009, 01:18 PM
#13
 
Freshman Lounger
 
Join Date: Apr 2009
Posts: 1
Not if you don't have QT Pro

Quote:
Originally Posted by JSPR View Post
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.
sdeez is offline  
Reply With Quote
Old 07-05-2009, 04:07 PM
#14
 
Freshman Lounger
 
Join Date: Jul 2009
Posts: 2
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
cecered is offline  
Reply With Quote
Old 07-05-2009, 04:08 PM
#15
 
Freshman Lounger
 
Join Date: Jul 2009
Posts: 2

thank you Nevyn! it's flawless
cecered is offline  
Reply With Quote

Topic: AVI Videos in iTunes

Reply Thread Tools Topic Search

Become a member of the iLounge Forums. Register Now!
To start viewing messages, select the forum that you want to visit from the selection below.
If this is your first visit, be sure to check out the Forum FAQ and Forum Policy.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





View iLounge History. Read our old Forums Archive (2001-2003)
All times are GMT -4. The time now is 04:01 AM.


Shop for Accessories: Cases, speakers, chargers, etc.