Talk:How to get iTunes to sync other video formats to Apple TV

From AwkwardTV
Jump to: navigation, search

News & Info

• Organized & cleaned up the discussion area a bit. --jamsoft 17:44, 12 July 2007 (CEST)

Q & A

Q: Is there an applescript available to automate the conversion?
A: Yes, however it's far from ideal (see the Apple TV Fooler discussion below)

Q: Is this process entirely lossless? (i.e. no loss of video/audio quality)
A: Using the Apple TV Fooler script yes, Using VisualHub no
Q: Is it possible to fool Itunes on a windows PC? It seems that QuicktimePro can't read DivX files on winodws.


  • I've requested that the methods given on the main page of this article be added to the program VisualHub to easily automate the entire process. Make sure to post your thoughts in this thread if you'd like see this feature added as well.

VisualHub bridges the gap between numerous complicated video formatting standards, and people that just want to get the job done - just what you would expect from the Mac. If you're looking for something a little more flexible, VisualHub's up for that challenge too. An extensive Advanced panel lets you change all pre-set aspects of encoding...and then some.

Automation Tech Preview
Starting with VisualHub 1.24, a Tech Preview of the automation support in VisualHub 2.0 was offered. This allows VisualHub users to create their own automated workflows (or “scripts” as the kids are calling them nowadays) that can do anything from convert a video to another format with a single click, or watch a server for a set of files and launch a distributed Xgrid workflow, burning a disc when complete (and more. People can go absolutely nuts with scripts. I should know...). VisualHub is automatable via the AppleScript language - simple, concise, yet powerful.
Automation Guide
Script Dictionary

External Links
Techspansion Website
Techspansion Support Forums
General Discussion
Knowledge Base

Random Talk

• This is perhaps the most interesting development on ATV so far. An automated way of altering and getting the media into itunes would be great.

iTunes sends the Apple TV a list of all the video files in its library and the Apple TV copies those it believes it can play. ATV then returns a list of files it can't play to iTunes
  • Instead of mucking with each and every video file, why not spoof this check? Has anyone looked into, say, making iTunes think ATV returns the full list of files as eligible?
-Grinningcat 05:04, 7 July 2007 (CEST)

Apple TV

Hello all
I've modified one of Apple's demo applescripts, that originally allowed conversion of movies/pictures into .mov format, to do what is described in this how to. It functions as a droplet, so you just drag stuff onto the icon and it does it's stuff. The only thing I can't make it do is re-scale to the proportions of the new file, but this doesn't seem to cause any problems, as on appleTV you can't play the movie in anything other than fullscreen anyway - so if anything it'll only look ugly in iTunes.
This can batch convert items as well as do one at a time, and uses the extensions listed as working on this site to filter what it can convert. Of course you'll need to make sure you've got the relevant codecs and stuff installed before you run it, as currently it doesn't check.
I'd like to make it add converted files to iTunes automatically after processing them, but I can't seem to make it work; it tells me "iTunes got an error: Can't make some data into the expected type." I don't know if this is because the methods I'm using to try to add the files to iTunes are reserved for audio files.. I've left my current iTunes code in the version I've updated commented out, so feel free to take a look.
It puts a temp folder on the desktop as part of the process. I had the folder hidden for a while, but then realised that the various failed attempts at running before I got it sorted left loads of hidden folders lurking when it crashed before deleting them. Theres probably a smoother way to do this but this will do for now.
This needs TESTING really. I've not hacked my apple tv as of yet, so I've only tried it with a couple of mpeg files that apparently AppleTV can handle without hacking. I've also not tried it with batches.
Anyway, check it out: Apple TV
--MNiT 11:40, 12 June 2007 (CEST)
Oh, should mention: Currently this deletes the file you're processing after it's done. YOu can stop it doing that by commenting out the two lines in the script. I've put a comment in highlighting where they are so they should be easily found.
--MNiT 12:41, 12 June 2007 (CEST)

It doesn't seem to do anything with files that have already been saved to .movs, otherwise it seems to work - good job!

There is a list of properties at the very begining of the script that defines which file formats it should accept. I've added .mov to the list and updated the links.--MNiT 21:06, 19 June 2007 (CEST)
Good Job!, working perfectly

Matroska? Using Perian 1.0b4 and all formats I've tried work except .mkv (added .mkv to allowed file formats in script). Great otherwise! Thanks. -pwbset (6.27.07)

Hi. Quicktime takes its time loading matroska files, so the process needs to wait till the file is entirely loaded before it can work correctly as far as I can see. I'm not sure how to implement this with applescript, or if its even possible to implement it.. I'd stick to doing matroska files manually for now. mnit PS, matroska 720p and above files are too much (for some reason) for the apple tv to deal with.. a very annoying problem I'm currently trying to work my way around.
-- elkabyle, 15:01, 01 Dec 2009
I've managed to play 720p mkv files on my AppleTV, but only after re-encoding with Handbrake (constant quality 60.78%) as mkv file. I then tried to use AppleTvFooler script to save as .MOV, that didn't work unfortunately. The conversion stops at 5 minutes or so. I had to do the conversion manually with Quicktime 7 Pro.
Anybody knows why the appleTvFooler script would not work in that case? Thanks for the great script anyway, very useful for all the other movies, non-720p.
Slightly off-topic, I stopped encoding using mp4 files since I noticed a much darker image. mkv seems to be the way to go.
Getting a script error during any batch conversion that crashes QT and ATV Fooler after the final copy process. Appears randomly, but happens very often. Since the final "wrapped" file is copied it's not a big deal, but stops batches, which is annoying. - pwbset (6.28.07) Image
Upon updating Quicktime Player to 7.2 via Software Update Apple TV Fooler no longer works. The new Quicktime Player application quits with NSInternalScript error just after the "paste" action, but before "flattening". Tested with multiple .avi files. Any ideas? -pwbset (7.13.07)
Seems to be on the "save self contained document 1 in file new_file" line, document 1 seems to be right, new_file seems to be right... -pftqg (7.14.07)
I had a lot of bugs along these lines when scripting this originally, I'm not too well versed on applescript so I've got to admit to being clueless... mnit

--Sorry, but this is not working for me. I can watch the resulting video in iTunes just fine, but ATV just plays black screen with no sound. Could it be the 5000 kbps bitrate limit Apple says the ATV has for h.264 files? The file I am trying to play is a raw dvd uncompressed file that weighs in at about 5,600 kbps. Since we are sticking an h.264 tidbit on the front of the file, I wonder if iTunes is choking on it? If so, that would make this entire process mostly useless since most new dvd's are going to be over 5,000 kbps...

To clarify, I HOPE there is just something wrong with my setup. Anyone else having problems watching streamed movies produced this way? --Stuka 21:31, 14 July 2007 (CEST)

silly question perhaps but, have you got perian installed on the ATV? Otherwise I'm not sure what could be happening. mnit Oh, are these matroska files? Apple tv can't really deal with matroska at all for some reason - its highly annoying.

-- Would it be possible to integrate the *auto add to itunes* feature of Movie2iTunes? I'm in no way connected with them, but this would be really useful. That specific droplet doesn't work I think because of the Apple TV's detection methods. I.e. needs to be h264 at the start. Thanks! --Sembdes 22:07, 24 July 2007 (CEST)

I had a good long fiddle trying to get the very same script integrated with this but failed every time. Again I'm not really very good with applescript... ATVFooler is about the limit of my expertise, and most of that is harvested from an Apple example script...
--I added this code adapted from a Doug's Applescript tutorial in place of the original commented out section and it worked perfectly:
--adds converted file to itunes
tell application "iTunes"
add new_file
end tell

--Josephbphillips 05:34, 14 November 2007 (CET)

-- I have just tested the script on Leopard and it now works with no issues. -- agreen91 21:03 CEST 28/10/2007

-- I tried this on Leopard and it mostly works, but it errors out after deleting the original and coping the mov to the original directory. It leaves the temp folder with a copy of the mov in it on the desktop. The error says "Can't make (Path:to:my:desktop:tempfoldernumber) in to type reference". Any ideas?
-- I am also seeing the "can't make alias into type reference" error on Leopard. Any apple scripters out there? -- pwbset 29/11/07
--I fixed it, on my machine anyway. Under the heading "--this sub-routine processes files", one of the last lines is "delete temp_folder". Either delete that line or comment it out by adding -- in front of the line. This worked for me. I also added a line immediately above that to close quicktime when finished. Logically enough, it simply says "quit".--Josephbphillips 05:16, 7 December 2007 (CET)
--Even better fix: Change the line 'delete temp folder' to 'tell application "Finder" delete temp folder'.--kbotc 01:08, 25 September 2008
Awesome project, though! Much easier, faster, and better quality than converting with VH. The only issue I have (other than the error listed above) is that I would like to also automate the process of adding meta data. I have tried to understand how something like Doug's Applescript for "Set Video Kind of Selected" works so that I could either build a stand alone droplet or build it in to this droplet, but rather than prompting the user for values, add predefined values. For example, every file processed by the droplet would have video kind set to "TV show" and show name set to "Some Show". Any ideas?
Here is some advice from

Create a short (5-second) MPEG-4 video that can be tagged as described. Tag this 5-second clip with the episode information (show, season, episode #, etc.)
Once the iTunes database stores the information for your 5-second clip, locate the actual 5-second video file in your finder (or explorer), and delete it. Click get info in iTunes and an exclamation point appears next to your TV episode, because you just deleted it.
iTunes will ask if you want to manually locate the missing file. When it does, point it to your referenced .mov file. Your TV episode information will be retained and you can organize your files that way (at least this works in Windoze).

I am just learning, and just trying to be helpful with my limited understanding, but it seems like we could combine this idea with the atv fooler. What if we used an MP4/M4v format reference clip instead of a mov? Would that work? How do I go about testing that? --Josephbphillips 00:59, 12 November 2007 (CET)

--I don't know how to proceed with the above idea, but instead I cobbled together a script that will add metadata to all of the files in a user-created smart playlist. I set up folder rules to monitor my download folder and open video files with the "fooler" script, and then use a separate script to add the resulting file to iTunes. Lastly, i run an instance of this script for each show I regularly download. I know there is a better way to roll this in to a single script with if statements, but baby steps. I hope it is helpful to someone- I'd love to be able to give back a little of what I have gained from this site!

--Before running, create a smart playlist using the "name contains" variable to select the appropriate files. This example presumes you have set a smart folder named "Sample Show Name". It will edit all of the metadata for the shows in this smart playlist as set below. Thanks to allenhuffman on for the script that I modified to achieve this.
tell application "iTunes"
set smartPlaylists to (get every user playlist whose smart is true and name contains "Sample Show Name")
repeat with thisPlaylist in smartPlaylists
set allTracks to every track of thisPlaylist
repeat with this_track in allTracks
set video kind of this_track to TV show
set show of this_track to "Sample Show Name"
set season number of this_track to "1"
on error
display dialog "Failed to add Metadata"
end try
end repeat
end repeat
end tell

--Josephbphillips 02:49, 12 November 2007 (CET)

hello...i adore this script...

but have been frustrated with it for a while...because after every file i drop on it...i get the cant delete the file error that was discussed i end up with tons of temp folders on my desktop that i have to take the time to delete...and i have had to do one video file at a time...very annoying...but thank you Josephbphillips for telling us to put that -- in front of delete temp folder...what a life saver...the only thing i didnt like is i like to check my trash before it is ever emptied so i just put two more of those - in front of empty trash right below the delete temp file place and now it doesnt empty my trash...and i can now drop multiple videos on the droplet and it just works...

so thanks again Josephbphillips and thank you MNiT for this amazing gift...i use it every day i think...and now i can really use it less because now it can do what it was meant to do...great job and thank you so much for the help...

would be nice if i could get a script to take that file move it from my macbook to my imac and put it in that i can do thank you again for the life saver...the months of converting files using Elgato's Turbo264, Handbrake, and Visual Hub were a waste of time...and thanks to this droplet i am saved...thank you again

--Now4real954 01:35, 27 February 2009 (CET)

Haven't you been experiencing any problems now ATV has multiple language support? It seems as audio tracks are not identified they all appear as "English" (including the muted track). When trying to select an audio track ATV just selects the first track available, which happens to be the tricky one. So you end up with no sound at all.

I've been looking for a workaround trying to label the tracks properly, but I haven't success so far. Any ideas on this?

--Franky 20:23, 9 April 2009 (CEST)

Update: I found the "language" property in the "track" object of the QuickTime Suite. My AppleScript skills are not good enough to change the name to the different tracks, though.
--Franky 18:59, 10 April 2009 (CEST)

For .movs that have already been saved, change the language of the AAC track to "French" and set your AppleTV's audio language to "English" (note that Default won't work). To get AppleTV Fooler to do this for you, simply show package contents for the app, locate the in the Resources folder, and change the AAC audio track to French, then save. Greg.

ok i have a problem now...and i need can i change where the appletv fooler puts the temp file that it uses while it is doing the conversion processes...because my internal hard drive is too small and i have no room to do it there anymore...please help me...

i want to change it to one of my firewire drives with a specific folder to use...because for some strange reason my hard drive is full and i can not use this application...and its angering me someone with some sort of knowledge of applescript can tell me where to put and what to put in the script editor then i can get back to work on my videos...thank you is my email address to let me know you have answered this question...please help me

scott--Now4real954 02:03, 15 June 2009 (CEST)

Files created with Apple TV Fooler seem to have stopped working properly as of Apple TV version 2.4. The files still sync properly, but they no longer have any audio. Video is fine. I know of a couple of people other than myself who are experiencing the same problem. Beware of upgrading your Apple TV to version 2.4 until this problem is better understood and fixed.

--Jpasqua 06:56, 29 June 2009 (CEST)

I have an app, TVMagic2 (really bad name, I know) that takes files, wraps them, and then adds it to iTunes including populating metadata from the tvrage api, I also have a simple app that will comb through files and change the language of the AAC audio track to French, which seems to be enough to make my Apple TV 2.4 play them.

TVMagic2 can be found at - if there's interest in the other app I'll release the source on github as well.

--pftqg 17:55, 29 June 2009 (PDT)

It would seem that Apple TV Fooler doesn't work with Snow Leopard and Quicktime X. The error that's given is "Can't set <<class iapl>> of application "QuickTime Player" to true." Any thoughts?


--stevelucky 12:11, 19 July 2009 (PDT)

From the looks of things apple has changed the QuickTime api a bit in this release. You can get around this by doing the following:
1: Right Click / ctrl click - Apple TV Fooler ans show package contents
2: open the contents folder
3: open the resources folder
4: open the scripts folder
5: open the main.scpt file ( you will need to modify the code)
6: replace all instances of "QuickTime Player" with "QuickTime Player 7"
7: comment out or remove both set «class iapl» to the status_flag and set «class iapr» to the status_flag lines
8: save and close the script

You will need to make sure that you have QuickTime 7 installed inorder to continue using the apple tv fooler at this point

I'm working on trying to move the droplet to Snow Leopard's new Services Menu, but I'm assuming just copying and pasting the script won't work. I moved the file outside then reference it within the new Automator Service, but I'm not quite sure how to approach this. Has anyone decided to try this out or go in this direction?

--Spydi 7:06, 15 September 2009 (MST)

AppleScript to Rescale .mov Dimensions

Here's how to rescale the blank .mov to the dimensions of the new video. It cleans it up nicely.

--Match dimensions
set movDimensions to dimensions of track 3 of document 1
set dimensions of track 2 of document 1 to movDimensions

I also made a few modifications to my own copy of the script. I moved the temp folder to the /tmp directory (who'd have thunk?). I changed it so that the original file is not deleted after processing, and I changed it so that Quicktime will not quit without saving unsaved movies. I'm relatively AppleScript savvy, so if anybody wants these changes, or others let me know. Temple 19:41, 2 September 2009 (CEST)

I would be interested in seeing your scripts. Even if I don't need all of the tweaks, it would be great as an example and might trigger some new ideas.

--Josephbphillips 01:37, 29 October 2009 (CET)

Quicktime to fix no audit or sound on .mov files

Hi All,

I've had the same experience since upgrading my Apple TV to version 2.4. ie, there is no audio on Quicktime files that have been generated using the Apple TV script.

I have found a rough work around that is fiddly but works great! I'd rather not re-encode all my video files!

It's simple. Follow these steps:

1. Using Quicktime, open the .mov file you have created using the Apple TV scripted 2. Hit Apple key and J to open "Show Movie Properties" from the "Window" menu item 3. Select and highlight the first audit track 4. Click on "Other Settings" and change the Language to French or anything non-English 5. Save the .mov file and add it to iTune and then sync with your Apple TV 6. Now here is the trick! While playing the .mov file on your ATV, press and HOLD the play button. This will allow you to select the good English audio track 7. Sweet audio is returned.

I know its not fantastic but without any coding skills, it works. I look forward to someone having an easier fix or some improved script or code!

-- I've posted an AppleScript that automates the setting of French on the AAC audio Track 1 in AppleTV Fooler-created .movs: - Greg