This guide will show you how to create Hi-Resolution iPod compliant MPEG-4 Videos that are of sufficient quality for TV-Out iPod use or playback on a HTPC. The created files will utilize x264 or XviD Video and aac Audio from the multi-platform workhorse encoder "ffmpeg". The cross-platform GUI batch encoding application "WinFF" has been developed by one of our own members here at Videohelp.com "Bigg Matt", you can check out his site at www.biggmatt.com. The scope of this guide will be limited to simple conversion from .MPG,.VOB or .AVI to .mp4.
iPOD VIDEO CONSTRAINTS:
Many people are under the impression that creating MPEG-4 Video for the iPod is very complicated, in truth it really isn't. Regular Windows and Open-Source MPEG-4 Codecs like DivX, 3ivX, XviD and Nero Digital can all be used to create iPod Videos under the 4 following constraints:
1. Bitrate cannot exceed 2500kbps.
2. No B frames or other ASP tweaks in the video stream.
3. Must be in a .mp4 or .mov Container with AAC Audio not exceeding 160kbps.
4. Frame Resolution Width x Height cannot exceed 307200 pixels in TOTAL.
In other words you can use ANY Width x Height as long as it is divisible by
16 (for the encoder). Common sizes that work are 640x480 for "fullscreen"
and 720x400, 704x384, or 640x352 for "widescreen"
The constraints for H.264 Video for the iPod are as follows:
1. Bitrate cannot exceed 1500kbps.
2. No B frames or CABAC in the video stream.
3. Must be in a .mp4 or .m4v container with Low Complexity AAC Audio
not exceeding 160kbps
4. Resolution cannot exceed Width of 640. So we use 640x480 for
"fullscreen" and 640x352 for "widescreen"
*NOTE* The H.264 files created by this guide playback flawlessly on the iPod itself but cannot be synced to an iPod with "iTunes", this is a peculiarity of iTunes looking for a special "uuid atom" in the .m4v/.mp4 container. Since this is a Linux guide it shouldn't be an issue, but I wanted to be clear about it. There are no difficulties with syncing these files using "Gtkpod-aac". The XviD files are compliant with iTunes on any platform. Since WinFF also runs on Windows these presets can also be used in Windows as long as iTunes is not the syncing software. So if you use "Anapod Explorer" or "Floola" for instance these presets should also work in Windows, although I haven't tested this.
A Linux OS, this guide was originally done in Ubuntu Feisty 7.04 but the software apps are common to most popular distros.
A recent build of ffmpeg with XviD, x264 lifaad and libfaac enabled. Some suggested builds that work are the "Stable/Etch" build at www.debian-multimedia.org. this build is best for Debian based distros. Ubuntu (or derivative) users may want to stay within Ubunto repos and use the medibuntu ffmpeg builds which can be found by following the instructions at www.medibuntu.org
**NOTE** If you have upgraded your ffmpeg build and discovered that the WinFF presets are no longer working, don't panic. Try these presets here: http://biggmatt.com/winff-forums/index.php?topic=93.0
Your specific distro's help forums should be able to help you with getting and setting up ffmpeg.
WinFF .33+ - This is the GUI frontend to allow us to bend ffmpeg to our will. Get it at http://biggmatt.com/home/. Select the correct package for your distro, Bigg Matt has very conveniently provided both .deb and .rpm packages.
*NOTE* WinFF now has H.264 and XviD iPod (and even PSP) presets built-in, and even more are available on the WinFF Forum here: http://biggmatt.com/winff-forums/index.php?board=3.0
gtkpod-aac 0.99.+ - This is a great Linux iPod application that will sync our videos to the iPod. The version I used is also from www.debian-multimedia.org
Floola 2.5+ - Floola is a cross platform iPod utility that also can be used for this guide both in Linux and Windows. Check it out at www.floola.com
30, 60 or 80 Gig 5th/6th Generation Apple iPod with current 1.2+ firmware
Latest gtkpod-aac (version 12) will reportly support new Nano's and Classic 80/160Gb models
iPod Touch is not supported yet
USB 2.0 Ports
OK LET'S GET COOKIN':
1. Launch WinFF, Click on the "Add" button or as of version 0.33 Drag n' Drop.
2. Browse to the video file(s) you want to convert.
3. I find it a good idea to click on the "Play" button to make sure ffmpeg has all the necessary decoders working to convert the file. As a rule of thumb if ffmpeg will play it then it will most likely convert it. Also this is a good time to determine the aspect ratio (Fullscreen, Widescreen, or Anamorphic) of your source so you know what preset to select.
4. Choose the format you want to convert to. If you are not sure of the difference between "Widescreen" and "Anamorphic" just use Widescreen. Also determine if you want H.264 or XviD
5. The presets for iPod are all ready to go with compliant frame resolutions and bitrates, they are optimized for TV-Out iPod use, If you want small screen presets for portable use only look here: http://biggmatt.com/winff-forums/index.php?topic=90.0
6. In the Options ->"Additional Command Line Parameters (Advanced)" field you can enter some extra useful goodies like this (don't use quotations):
"-pass 1" will tell ffmpeg you want to do the first pass of a two-pass encode
"-pass 2" will perform the second pass, you must overwrite the first pass
"-threads 2" will use both cores if you have an AMDx2 or Intel Core-Duo processor.
7. Click on the "Start Converting" button and you should see the ffmpeg terminal window open and start converting your file. If WinFF complains that it "can't find ffmpeg" you need to find the location of the ffmpeg executable file in the ->Edit ->Preferences ->Linux/Unix tab.
8. When your file has finished converting the ffmpeg terminal will close. Sync it to your iPod with gtkpod-aac or Floola.
-If you want to import DVD .VOB's then they will need to be one contiguous VOB,
This can be achieved using Mplayer by using the following terminal command:
-The 2-pass check box isn't working in the Linux version of WinFF, For two pass encodes use Step 6.Code:mplayer dvd://1 -dumpstream -dumpfile NAME.vob
-Check the deinterlace box if your source file is interlaced, (ie DV camcorder, MPEG TV Captures etc.)
-The supplied presets are tweaked for better quality results, this means slower encoding speeds but better quality. For most purposes 1 pass is sufficient especially with x264, this is a matter of personal preference of course. Speeds will vary with your hardware.
Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or try DVDFab and copy, convert or make Blu-rays and DVDs! :)
+ Reply to Thread
Results 1 to 16 of 16
I can't get any of your guide to work on my 5G Ipod with 1.1 firmware. I use Ubuntu Feisty, and I also cannot get Gtkpod to work either. I think my main problem is that I never used ITunes with my Ipod. I always used a program called Anapod Explorer. I've seen other information that you need to have ITunes initialize the database at least once to get it working with other programs.
Video encoding for the Ipod is extremely disappointing under Linux. The only encoding I can do that actually plays back on the Ipod is the basic mp4 wrapper mpeg4 encoding. Xvid and h264 don't playback. It's a shame, in Windows I used this awesome frontend called SUPER. That program kept the ffmpeg and mencoder command lines hidden, so I don't know what they were doing, but whatever it was it was able to produce mpeg4 and h264 for the Ipod.
Edited to say, do you think if I bite the bullet and load ITunes on another computer and update my firmware to 1.2 then I will be able to get h264 and xvid to playback using your presets?
I have tested the guide on both my 60Gig and my Daughter's 30 gig. Firmware 1.2.1 is critical! Otherwise the larger frame resolutions are not supported with either XviD or H.264 and you will be disappointed. You are right the best way to update the firmware is to sync with iTunes 7, this could even be done on someone else's computer as long as you have your own library backed up. Your problems with gtkpod are probably related to not having an iTunes .db on your iPod yet. To correctly mount your iPod in gtkpod you must make sure the mount point is set using "/media" not "/mnt". For example "/media/IPOD NAME/" instead of IPOD NAME put in whatever name your iPod displays on the desktop when Feisty mounts it.
I was playing more last night and discovered that a Linux ffmpeg frontend called "Thin Liquid Film" is capable of producing h264 which plays back on my Ipod. This morning a bell rang in my head and I realized the only reason it worked is because it is encoding in 320x240. I need to test this under WinFF by modifying your h264 preset to use 320x240 instead of 640x480. I recall now that under Windows using SUPER I was always encoding h264 in 320x240 and that's why it worked.
I'm also curious if your xvid preset will work if I change the resolution to 320x240? I'll have to try that later.
As far as firmware 1.2.1, gtkpod, and iTunes...I guess I'll load iTunes on a WinXP box and get it straightened out. Ideally I'd like to use gtkpod and then I'll have no need for the Windows Anapod application. That would be really cool! It will also be cool to be able to use your guide as written and not have to fuss with lowering the resolution. Encoding AND uploading both within Linux is my goal! I'll try it tonight and let you know what happens.
I tried to install "thinliquidfilm" and another program called VIVE! from source and had absolutely no luck with either of them, that's what prompted me to try WinFF and do the guide in the first place. Your iPod as is should be able to do H.264@ 320x240 and XviD@ 512x384 Fullscreen and 624x352 Widescreen. I can't guarantee that my H.264 preset will work because the official iPod specs for H.264 using firmware 1.1 are using H.264 with a "level" of 1.2 and the later specs allowed for level 3.0. Anyway the best case scenario would be to update the firmware and go from there. Let me know how you get along.
Well what do ya know?? I updated the firmware to 1.2.1 and now everything works! The WinFF presets and gtkpod!! Awesome! And Apple said that v1.2.1 was just "bug fixes", I guess some pretty major bugs huh??
Well anyway, I agree with you on VIVE, I got segmentation faults with it 4 out of 5 times. WinFF is definitely the nicest frontend I've come across, I love the presets functionality.
A few more questions for you. How can I specify the bitrate for the audio to be 160 kpbs? In your preset I tried adding "ab 160" but it doesn't seem to do anything.. Also, do you know of a good graphical MP4/MOV tag editor for Linux that I can use with my newly encoded videos? Also, I was curious about your computer's performance with your presets. I for example am getting about 47 fps with the h264 one and about 5 fps with the xvid one. This is on an E6420 Core 2 Duo at stock speeds. Why is the xvid so slow? The file sizes are about double the h264 and I don't think the quality is as good. I put "-threads 2" in your presets and the funny thing is that the h264 utilizes both cores, but the xvid does not. It must be something in the xvid library that can only use one core while encoding??
Glad you got it to work! As far as changing the audio bitrate, are you entering 160 in the "additional commandline" field at the bottom or in the "Audio" bit rate field? You only need to enter "160" not "-ab 160". In the "Audio" bit rate field it should overwrite what the preset is. If that fails you can just edit the command in the preset itself (I'll show you how if needed). As far as XviD speed supposedly the XviD4 Core that ships with Feisty was not speed optimised, Users of AviDemux were also complaining about slow encoding speeds. I enabled the "Ubuntu proposed-updates" in my repositories and this allows for an updated XviD4 that is faster, On my system XviD is still 2-4fps slower than x264 though. I mostly use H.264 because as you have noted it has far better quality. This is more due to the difference in the Codecs themselves than the presets. For tagging the latest gtkpod works pretty well, just right click on the file and select "edit file details".
Do you understand ffmpeg's pecularities about specifying bitrates? I use a compiled version from March 2007 which supports the restricted formats. I noticed when I enter something like "-ab 160" I still end up with a 64 kbps file, but if I enter "-ab 160000" then it seems to come out as a 160 kbps file. I was modifying this within your preset. I had also tried it using the additional command line and the Audio field. I read somewhere that the newer versions of ffmpeg use a kilobit format for bitrates, so 160 kbps has to be entered 160k and the same applies to the video bitrates. The confusing part is that the video bitrates don't seem to be affected. They can be entered as "1500" to mean 1.5 Mbps, but if I enter "160" for the audio, it doesn't mean 160 kbps.
I;m glad you brought it up, I was going to ask about what happens when you enter something in the WinFF text box fields that contradicts what is in the preset. So for example if the preset specifies 48000 for the audio sampling and the user enters 44100 in the text box, does that override the 48000 Hz setting? How does it do that, is it because of the order the options are placed within the ffmpeg command line?
I didn't try it yet and I'm not at my box now, but does gtkpod support multiple file tag modifying? So if I select 5 files for example, and I want to change the Genre tag on all of them to "Rock" for example, can I do this as a batch operation in gtkpod or do I need to edit each one individually?
I must have some kind of codec issue with my xvid, because I couldn't believe that I only get 5 fps encoding. I'll check into it later.
Sorry to be brief, I'm a little short on time, If you are using the Medibuntu ffmpeg it is dated 2007 but is actually a much older build, that is why the numbers are entered differently. If your build is a 2007 SVN or newer then you will need to use 1500k or 160k, make sure "-b" is the number you change not "-maxrate" also your maxrate can't be lower than your average bitrate. As far as winFF questions check out www.biggmatt.com he has just started a new forum and Bigg Matt is very forthcoming with replies and info. As for gtkpod you can select multiple entries in the settings if you check off change all files simultaneously.
Thanks for the info. I cleared it up now. BiggMatt says when values are entered in the text boxes they are defaulted to "kb". So if you enter 160, it means 160 kbps. You can also just always specify the "k" in any version to avoid ambiguity.
Instead of using the text boxes or additional commands I just modified the presets to my liking and give them different names, thus the strong point of using WinFF. I see the option in gtkpod now for changing tags on multiple files. This is a good thing because I was getting worried that there was no appz in Linux to modify tags on multiple mpeg4 files.
Linux RULES!!! :P
Sounds like you've got it all under control and them some!! I was actually kind of hesitant to do the guide because I thought there would be little or no interest, so thanks for your interest! All the best. - GMaq
I have tried to pick apart the commands you use for the Xvid iPod to find out what makes it so slow with little success.
Using WinFF the fps encoding is about 45 or 50 sometimes MUCH slower (sometimes 5 or 6). The advanced options
bit rates have little effect. Not sure how they would anyway as they are appended to the end of the command while the original bit rates remain.
Using my own script I get 110 fps on the same file I tried with WinFF.
Suggested Xvid iPod command line options.
ffmpeg -f mp4 -y -vcodec xvid -b 400k -qmax 10 -bufsize 4096 -g 300 -acodec aac -ab 96k -ac 2 -i "Path-to-input-file.avi" -s 320x180 -aspect 16:9 "Path-to-output-file.mp4"
As you can see, this is for a wide screen input file.
A full screen would be -s 320x240 -aspect 4:3
I have not tried WinFF for other functions so I can only report on the iPod conversion.
Thanks for your great effort and time.
One more thing
This is obviously not for TV output. EDITI just found out thats why WinFF is slower. It uses a resolution for TV out.)
TV output would likely be 640x480 for full screen and 640x360 for wide screen.
Sorry for the confusion.
The speed of XviD is drastically reduced by frame resolution as you have noted, also some of the extra flags and motion vector improvements I have added to the presets also slow it down, Your sample script is not including those extra commands so of course will be faster, If you want more speed just edit the extra parameters out of the preset. I watch my iPod movies on a 42" Plasma TV, so when I created the presets I was trying to get the most quality and hit the "sweet spot" for each codec. It would be interesting if you could report back with what fps you can achieve in WinFF with your script. Also please note that XviD supports multithreading so if you have a duo core or x2 processor enter "-threads 2" in the extra commandline options field and you can expect about a 30% increase in encoding speed. Thanks for your comments!
I'm not sure what you mean about installing dotnet, In Linux WinFF is a single .deb package that installs and utilizes the existing ffmpeg on the system. In the Windows version there is no need for dotNET like MeGUI and others require. Anyway to answer your original question I found this website to be a wealth of info on ffmpeg command line, most of the x264 WinFF presets are at least partially based on these:
Oh Thankyou. Was mistaken as I'm XP. Nice website link.