Michael Baird March 6th, 2007
I think the title says it all, but in case you hate titles and skip right to the meat of these posts; this write-up is going to walk you through getting videos from the internets automatically (for those without a DVR that lets you keep your vids), convert them to an ipod compatible file (automatically), then add the new video files to iTunes (again automatically) to sync with your ipod the next time you plug it in.
Once you have this set up and running, the only thing you have to do is plug in your ipod and it will sync your new videos. It’s like the “set it and forget it” for ipod videos.
The method I am going to explain makes use of a couple of programs that you are going to need to download and have a basic understanding of. Uber-geekery is not required. This is a windows only solution, sorry haters.
What you will need:
- A torrent client that supports RSS feeds. This is the program you will use to download your video files automatically. I used to use Azureus, but have recently been enjoying uTorrent for its thin memory footprint yet full set of features.
- Autompeg4 – does the batch conversions of the video files you have downloaded. I know there are more robust, faster and possibly better converters (VLC is sweet, unfortunately its batch capabilities are currently limited) , Autompeg4, however, fits the bill perfectly for this situation. It is able to do batch conversions of all of the video files in a directory, and it can be run from the command line – perfect for batch files. Autompeg4 requires a couple of additional files for it to work properly, as is outlined on it’s web page. Some of the links on Autompeg4′s site don’t work any more, so I have included instructions as well as links that I have found to work as of this writing.
- AviSynth – download & install (Version 2.5, not the alpha)
- ffmpeg – download 3GP Converter; unzip the download file, and extract the files “ffmpeg.exe” , “avsredirect.dll”, “cygwin1.dll”, and “cygz.dll” from the “cores” folder. Place these two files in the same folder as AutoMPEG4.exe.
- Mencoder – download the file compiled for your processor type under [Precompiled Mencoder binaries - XviD 1.1.2 - x264 svn] & extract mencoder.exe into the same folder as AutoMPEG4.exe.
- Mp4box – download & extract mp4box.exe into the same folder as AutoMPEG4.exe
- Microsoft .NET 2.0 Runtime Environment – Download & Install
The contents of your autompeg4 directory once you have downloaded and extracted everything you need.
Ok. Now to be clear on the above requirements, you must install Microsoft .NET 2.o, uTorrent and Avisynth, the other files need only be downloaded and put in a single directory.So lets get started with the setup. First and foremost, you need to set up uTorrent to download your video files automatically. For this exercise we will use a TV show as an example. The site that I recommend using for all your TV show needs is tvrss.net, it almost always has what you are looking for and it supports RSS feeds for your TV show searches.To set up uTorrent to download automatically:
- First, we will set up uTorrent to download a file to one directory, then when the file is done downloading, it will be moved to a new directory. This will make sure that when we are encoding files, we will only try to encode complete downloads.
- Under “Options” select “Preferences”, then on the left side, click on “Downloads”
- Make sure the boxes are checked next to “Put new downloads in:” & “Move completed downloads to:” and un-check the box next to “Always show dialog on manual add”
- Click on the “…” next to both the new and completed boxes and choose two separate folders for the files. For example in “My documents” create one folder named “downloads” and one named “completed” and choose these two locations for each location.
- Now go to tvrss.net and find the show you want by clicking on “Shows” and finding your show on the list. Select a distribution group, either usually works fine, but check the list of videos and choose the one with the most distribution, then click on “search” to only show that distribution group’s episodes.
- Right click on “Search-based rss feed” and copy the link address. In internet explorer it’s called “Copy Shortcut”, in firefox it’s called “Copy link location”
- Open up uTorrent and under “Options” select “RSS Downloader…”
- Click on “Add” and then paste the copied link from tvrss.net into the box (try ctrl+v) or right click in the box and select “paste” and click on OK.
- Once you have added the link, click on the tab named “Favorites” and click on “Add” down at the bottom. Then with your new filter highlighted, add “**” (two asterisk) in the box next to”Filter:”, then click close. This tells uTorrent to download all of the available files.
- You may notice now that uTorrent adds a lot of videos to the queue, if you don’t wan all of the old, ones, right click on them, and select “Remove and Delete .torrent + data”.
Ok, now if I have been clear, and you have followed directions, you are now downloading videos automatically, and when they have completed downloading they are automatically being moved to a new directory, sitting there all pretty, waiting to be converted and put on your shiny new ipod (automatically).
Now lets set up Autompeg4 to convert your video files. The sweet thing about this setup is that it doesn’t come with a pretty interface, no bells, no whistles, only raw converting power. It’s able to be run from a command line, which means you can use simple Batch files to do all of the heaving lifting, and you can use your system scheduler to run these scripts on a regular schedule, but I will get back to that later.
You will see that when you downloaded Autompeg4 it came with a file named autompeg4options.txt. This .txt file is what autompeg4.exe gets it’s settings from, so whenever you run autompeg4.exe in the command line or in a batch file, you need to type: autompeg4.exe “autompeg4options.txt”.
Lets go ahead and set up our first batch file now. I will name this file “ividconvert.bat”, and I want this batch file to accomplish 3 things. First I want to copy all of the video files that have been downloaded by uTorrent into a temporary directory, so that we don’t do any conversion and corrupt any of the original video files that have been downloaded. Second we will run autompeg4.exe with our edited autompeg4options.txt file. After the conversion, it will run a cleanup batch file which will in turn run the iTunes syncing batch file, both detailed in a bit.
Your first batch file should look something like this:
cd “c:\directory where utorrent moves your completed videos to\”
copy *.avi “c:\folder for your temporary video files\”
cd “c:\directory where autompeg4.exe is located\”
You can check out my example ividconvert.bat [right click and 'save as'].
Now edit your autompeg4options.txt file to set up for encoding. The finished file should look like this:
sourceDirectory=c:\folder for your temporary video files
What to learn from this file: It looks in your temp video folder for all files with a .avi extension, converts them to a ipod manageable size (320×240 pixels) with a video bitrate of 200 and an audio bitrate of 64. It then creates a new .mp4 file with these settings and puts it in a folder named “c:\folder for your temporary video files\convertedvids\”. Please take care to create these folders before running the conversion, or it may get messy.
You can take a peek at my example autompeg4options.txt [right click and 'save as'].
Now we need to create a couple more batch files and put them in the same directory as autompeg4.exe. The first cleans up the temp video directory and moves your new .mp4 files to a nice new folder, away from all the conversion clutter. I call it cleanup.bat and it looks like this:
cd “c:\folder for your temporary video files\”
cd “c:\folder for your temporary video files\convertedvids\”
move *.mp4 “c:\path to my documents\my videos\ipod videos\”
cd “c:\directory where autompeg4.exe is located\”
You can check out my example cleanup.bat [right click and 'save as'].
The next batch file runs iTunes library updater and adds your new .mp4 files to iTunes. It’s name is itlu.bat, and it goes a little something like this:
“%PROGRAMFILES%\iTunes Library Updater\ITLUconsole.exe” /a /l /r /e:”.mp4″ “c:\documents and settings\mike\my documents\my videos\ivids”
And now finally, we will edit the file “autompeg4template.txt”. This file is basically the heart of the process. It is in charge of all the behind the scenes action. The original file that came with the autompeg4 download uses 2 passes to convert the video. I think I prefer a single pass at the moment, it converts faster and I haven’t seen any significance in video quality or file size by using two passes. So edit the “autompeg4template.txt” file to look like this:
mencoder.exe[EXEARGS]%INPUT% -ovc lavc -passlogfile “.stats” -nosound -lavcopts vcodec=mpeg4:turbo:vpass=1:vbitrate=%VIDEOBITRATE%:vqdiff=2:vqblur=0:vqcomp=0 -o “video.m4v” -of rawvideo
mp4box.exe[EXEARGS]-add “video.m4v”:fps=29.97 -new %OUTPUT%
ffmpeg.exe[EXEARGS]-i %INPUT% -vn -acodec aac -ab %AUDIOBITRATE% audio.mp4
mp4box.exe[EXEARGS]-add “audio.mp4″:lang=eng %OUTPUT%
Note that all arguments for each exe file should be on one line. Check out my example autompeg4template.txt [right click and 'save as'].
That does it for converting. If it is set up correctly, you should now be downloading files automatically, and you have set up the complete conversion and syncing with iTunes by running one batch file. But wait, I promised complete automation didn’t I?
Fine. In windows, open up your Control Panel then open “Scheduled Tasks”. Open “File>New>Scheduled Task” and name it something cute, like fluffykittens or ividconvert. Now right-click on your new task and click on “Properties”. Next to “Run:” click on browse and find the file you created name “ividconvert.bat”. In the box next to “Run as:” put in “NT AUTHORITY\SYSTEM” without the quotes. This will run your conversion as a system process, making it almost invisible. Make sure the box next to “Enabled” is checked, then click the “Schedule” tab at the top. I would leave the schedule on daily and maybe set it to every 2 days, any longer and it will be crunching for hours on end, depending on the amount of videos you are downloading. Now set the start time according to your schedule, preferably when you or anyone else won’t be near the computer. Sleepy time works great. Now click the “Settings” tab and check the box next to “Wake the computer to run this task”. Finally click on “OK”.
That should be it. Now all you have to do is plug in your ipod occasionally and your videos will sync.
Please keep in mind that this method works as described for me. It may not work for you. The programs I used are not my own and are the property of their creators. I have noticed that running the itlu.bat file under “NT AUTHORITY\SYSTEM” doesn’t always work as planned, if that is the case, simply remove the reference to itlu.bat from the cleanup.bat file, and make a new scheduled task the same way you did above and keep the “Run as:” set to the default user. This defaul method usually requires that the account user in question has a password associated with their login. If you don’t have a password, and don’t want one in able to run a task, disable the requirement like so:
For Windows XP Profession users: Go to Start/Administrative Tools/’Local Security Policy/Security Settings\Local Policies\Security Options Accounts: Limit local account use of blank passwords to console logon only. This is enabled by default, disable it.
For Windows XP Home users: Go to Start/Run/Regedit and navigate to this key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
Change the key named ‘limitblankpassworduse’ (Type: REG_DWORD) to 0 (disabled) or 1 (enabled).
A great tutorial on scheduling tasks can be found here [via lifehacker]
I hope you find this tutorial informative. If you have any questions feel free to ask in the comments. I may not reply though, simply because writing this silly tutorial leaves me feeling pretty burned out. I have a lot of respect for the peeps at lifehacker, makezine, hackaday & the like.
Oh, and while I did spell check once, I did not proof read this post. So if you see an mistakes send a postcard noting the error to the address listed at the beginning of this post.
Made you look.