IPod Video Conversion Guide
iPod Video Conversion Guide for VLC 0.8.6a
Written by loqu (AKA Rob), http://www.kludgeroo.com/linked/videolan/vlc_ipod_converstion_8.6a.html
The following is a guide for converting (transcoding to file) any video that VLC Media Player (VLC) can play into a format that the Apple iPod can play. This should be "fool proof." This guide does not cover the process of putting those files onto an iPod. I've tested this guide on many containers, with and without subtitles. This is an evolving guide, so please refer to http://www.kludgeroo.com/linked/videolan/vlc_ipod_converstion_8.6a.html for the original.
Before I begin I'd like to thank the good people over at http://www.videolan.org for making a great multi-platform media program. I decided to make this guide, because I had to invest much of my time to get this to work. This is my way of giving back to the community.
Why Use VLC to Convert Video for the iPod?
If you're looking for the absolute highest quality in video conversion, then do NOT use VLC to convert Video for the iPod. There are many, probably too many, programs already available.
I prefer to use VLC to convert to iPod video, because I know that if VLC can play the file, then VLC can convert it for my iPod. I can also use VLC in a script, which means I can tie it into my intranet, run conversions automatically, and/or keep "profiles" (by using scripts) for each video format that I'd like to convert. In addition, converting to iPod video with VLC is very quick, because the encoder is only doing one pass. This means that VLC is not just good for converting to iPod video, but it is also good for converting to any type of video, where I need versatility and speed.
If considering the disk space on an iPod and the battery life, I think it is unnecessary to worry about file size/quality. Whereas a person can store their entire music library on an iPod, a person will not be able to store their entire video library on an iPod. At some point, that person will need to come home, dock the iPod, and transfer files. It is more likely that a movie, a music video, or at most a complete television series will be stored on the iPod.
Converting a Video with the Graphical User Interface
Open VLC. Please be sure you are using the default settings for VLC. Please be especially sure that you do not have "repeat" set, as you will infinitely overwrite your transcoded file.
Click "File" then "Open File", which will bring up the Open dialog.
"
Be sure that you are on the File tab. Click Browse and select the file that you would like to convert. Now check the Stream/Save box and click the Settings ... button. This will open the Stream Output dialog. This is where the magic happens.
- Notice that when you first open the dialog (if you haven't already tried to stream/save a file in this session) the Stream output MRL box at the top is empty. As you make your selections in the rest of this window, that box will fill up with your options in a form that the VLC executable understands.
- First, check the File box, then click the Browse... button to the right. Now choose the name of the file that will be created during the conversion. Be sure to change the extension to "mp4".
- Now choose the Encapsulation method. This is also known as the "container". Select MP4.
- Go to Transcoding options next and check Video codec. Change the box to it's immediate right to h264. The next box to the right changes the bitrate of the video. I recommend 768 kb/s.
- Still in the Transcoding options area, check the Audio codec box, and change the box to it's immediate right to mp4a. The next box to the right changes the audio bitrate. I recommend 64 kb/s or 96 kb/s.
So far, everything is fairly standard, but here comes the tricky part. Go back up to the "Stream output MRL Target:" box. Notice that the box is full of text. Look for the part that has #transcode{ }, and type width=320,canvas-height=240 somewhere inside the { }. Do not add extra spaces. This setting changes the width to 320 pixels and adds black bars above and below the movie, allowing all movies to maintain the appearance of their original aspect ratio. Be careful here. If you change any of the settings below this box, you will have to re-enter the width and height settings.
Click OK to close the Stream ouput dialog, then click OK to close the File open dialog. The movie should now start playing without showing the picture on the screen. When it is complete you should have an iPod compatible file.
Converting a Video through the Command-line
Conversion via the command-line is a little beyond the scope of this document, but using VLC in a script is my favorite way to convert videos. This generally allows me the leisure of dragging the file onto the script and magically getting my new iPod file in a certain directory.
Generally speaking, the format of the command can be:
On a Windows machine, I use the following batch script for drag and drop functionality. Once a file is dropped onto it, vlc converts the video to a folder that is set in the script.
@REM Remove the quotes from %1 variable for vlc paramters
@SET infile=%1
@SET infile=%infile:"=%
@REM Strip directory paths from %1 ...
@FOR /F "delims=" %%i in ("%infile%") do SET filename=%%~ni
@SET outdir=%userprofile%\My Documents\ipod video\
@SET outfile=%outdir%%filename%.mp4
@REM The following command should be on ONE line only.
@REM Be sure to remove the carriage returns in your batch file.
"C:\Program Files\VideoLAN\VLC\vlc.exe" -vvv "%infile%" :sout="#transcode{width=320, canvas-height=240, vcodec=mp4v, vb=768, acodec=mp4a, ab=96, channels=2}:standard{access=file,mux=mp4,url=%outfile%}" vlc:quit
Converting with Subtitles
The basic rule for subtitles is: if you can see them in VLC, then you can put them in your converted video; however, getting this to work can be tricky. Essentially, you use the soverlay option in the #transcode{...} section to tell VLC that it needs to combine the video and the subtitle streams into one video stream. Of course, that means nothing if you don't know how to get subtitles to display in the first place.
Subtitles for video can be stored in the orginal file as images or text. Subtitles can also come from a separate text file. It all depends on the original video file. Despite where the subtitles come from, you need to first get the subtitles to appear in VLC during normal playback.
If the subtitles are a part of the original file (as with DVD, SVCD, OGM, or MKV video), you will need to use the sub-track option to select the desired subtitle track. You will specify this option after the #transcode {...} section.
"
To find the track numbers for the original file, play the file in VLC, click on the Video menu, and view the available tracks under Subtitles Track. The value that you will use for sub-track is the value in this list minus 1. From the picture above, you would specify sub-track=2 to get the second English track listed. (Use sub-track=5 for Deutsch.) To tie it all together, your #transcode{...} section would look like this:
#transcode{...,soverlay}:stuff{...options...} :sub-track=2
Depending on the original file, you may also be able to get away with using the sub-language option instead of specifying the exact subtitle track. Note that this would play the first English track if we specified sub-language=English. Your #transcode{...} section would look like this:
#transcode{...,soverlay}:stuff{...options...} :sub-language=English
Now that you have the video playing with subtitles, you can create a video with the subtitles overlayed on the video, using the same methods at the top of the document.
For best results, first transcode to file without setting a new width or height (the width=320,canvas-height=240 setting in the #transcode{...} section). After you have made the larger file with the subtitles overlayed, then convert to the smaller iPod width and height. This will make it so that your subtitles appear in the correct proportions on the smaller screen size.
Testing Your New File
Now as I stated earlier, I've run many tests on different input file formats and containers. Currently it is very rare for me to find a file that I cannot convert. As far as testing the file goes, I strongly recommend using Apple's Quicktime player. It is much faster than repeatedly transferring the video to your iPod, disconnecting the iPod, and playing the video. Unfortunately, Quicktime is only available on Mac and Windows.
Solving Problems with Your New File
Here are some of my most notable problems and their solutions.
VLC closes without outputting anything or the file is 0kb.
- Make sure you are only converting the movie, not a playlist.
- If you're using a script, make sure your script is correct. (I admit, the one I provided will probably have faults.)
My file is very small or only audio is recorded or only some of the video is present.
- More than likely, the input file is slightly corrupted in a spot or you are using the mp4v generic codec instead of the h264 codec. h264 really does work more consistently.
- Try adding fps=25,samplerate=44100 to the #transcode{...} section.
- Your CPU may be getting too hot. Seriously. This was happening to me on one of my machines, and when I tried it on another, conversion worked fine. Using a thermometer on the original CPU/heatsink, I discovered that the CPU jumped to 70 degrees during conversion! Solution: get another fan.