So I found out the hard way that the new ipod’s (with video out) can actually play 640×480 video and also figured out how to get iTunes to accept the encoded files (so that I could sync them with the device)…….here is the run down:
- “TV-Out” mode – 1.5Mbit/s 640×480 H.264 videos
- BIT_RATE <= 1500 kbps
- 640×480
- Up to 30 fps
- “Low-Complexity” H.264 Baseline Profile
- 1 reference frame
- Up to H.264 level 3
- 640 pixels maximum frame width
- Sample Aspect Ratio (SAR) must be 1:1
- UUID atom must exist containing the following hex data: 6B 68 40 F2 5F 24 4F C5 BA 39 A5 1B CF 03 23 F3….This allows you to add the video into iTunes. You need AtomicParsley for this which can be checked out from their subversion repository . See below for usage.
- For 1-pass encoding use:
- For 2-pass encoding use:
ffmpeg -i INPUT -acodec libfaac -ab 128k -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me umh -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 10M -bufsize 10M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect WIDTH:HEIGHT OUTPUT.mp4
AtomicParsley OUTPUT.mp4 --DeepScan --iPod-uuid 1200 --overWrite
ffmpeg -i INPUT -an -pass 1 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions 0 -me epzs -subq 1 -trellis 0 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 10M -bufsize 10M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect WIDTH:HEIGHT OUTPUT.mp4 ffmpeg -i INPUT -acodec libfaac -ab 128k -pass 2 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me umh -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 10M -bufsize 10M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect WIDTH:HEIGHT OUTPUT.mp4
AtomicParsley OUTPUT.mp4 --DeepScan --iPod-uuid 1200 --overWrite
- “Standard” mode – 768kbit/s 320×240 H.264 videos
- BIT_RATE <= 768 kbps
- 320×240
- Up to 30 fps
- H.264 Baseline Profile up to level 1.3
- For 1-pass encoding use:
- For 2-pass encoding use:
ffmpeg -i INPUT -acodec libfaac -ab 128k -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +mixed_refs -me umh -subq 5 -trellis 1 -refs 5 -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 768k -bufsize 2M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -title SOME_TITLE OUTPUT.mp4
ffmpeg -i INPUT -an -pass 1 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions 0 -me epzs -subq 1 -trellis 0 -refs 1 -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 768k -bufsize 2M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -title SOME_TITLE OUTPUT.mp4 ffmpeg -i INPUT -acodec libfaac -ab 128k -pass 2 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +mixed_refs -me umh -subq 5 -trellis 1 -refs 5 -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 768k -bufsize 2M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -title SOME_TITLE OUTPUT.mp4
9 responses to “FFmpeg commands for ipod video encoding…”
If this works, I will personally hunt you down and kiss you!
I’ve been looking for a way to automate the conversion to mp4 of movie files I download as torrents. Vuze can automatically move them to a folder upon completion, and using Folder Actions in OS X I can launch a script as soon as the file is moved there. However, ffmpegX was simply not co-operating with AppleScript.
I knew I could use the “do shell script” command within AppleScript to run ffmpeg as a command line tool from within the ffmpegX package, but I’ve been having a ton of trouble getting all the parameters right. I’m hoping your commands will do the trick!
Cheers!!
Hi Rob,
Hehehe…..okay no kissing, but you can buy me a Beer :-) I’m pretty sure this works and I actually really like your idea with the folder actions. I might try it using that. The command is a pain in the butt to type in so a folder action would help a lot :-).
Let me know if you run into trouble…..
TTYL
Many
Well, I’m close. I’m getting an error from ffmpeg about an unknown codec “libfaac”. So I downloaded libfaac, compiled it, installed it, and it is now in /usr/local/lib. ffmpeg still can’t find it. So I copied the libfaac libraries to /usr/lib so that they are now in two places. Still no luck. Any suggestions?
Hey Rob,
Assuming you’re using OSX you can do one of the following:
Either Recompile ffmpeg with flags –enable-libfaac and –enable-libfaad (obviously get those compiled and working first) OR if you’re lazy like me :-) let someone else do it for you:
sudo port install ffmpeg +lame +libogg +vorbis +xvid +x264 +a52 +faac +faad +dts
Let me know either way…..I would personally go with mac ports…..easier on the brain :-)
TTYL
Many
Rob,
I screwed up the port command. Here is the right one:
sudo port install ffmpeg +gpl +postproc +lame +theora +libogg +vorbis +xvid +x264 +a52 +faac +faad +dts
I’m getting there. Terminal now returns the error “sudo: port: command not found” when I try to recompile ffmpeg. Where do I get “port” from?
Hi Rob,
Grab the installer from http://www.macports.org/ and issue that command once you get it installed. Go have a coffee/lunch/dinner or something (It took about 30 minutes to suck all the stuff down and compile it). MAKE SURE YOU USE THE SECOND COMMAND I SENT LAST NIGHT……The one with +gpl.
BTW. It works like a charm…..and looks like you don’t need to do the parsley stuff to get it to show up in iTunes…..just drag and drop your movie into itunes (or ipod touch) and it runs.
If you figure out the folder action stuff let me know.
TTYL
Many
Ok, I’ve got everything installed, everything compiled. So now I’m attempting to run (and am actually, in fact, running!) ffmpeg using the command you have above (with the appropriate bits substituted):
/opt/local/bin/ffmpeg -i /Users/jonesy/Documents/Azureus\ Downloads/AUTOMATIC_DOWNLOADS/CSI.S09E05.HDTV.XviD-LOL.avi -acodec libfaac -ab 128k -s 640×480 -vcodec libx264 -b 800 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me umh -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 100 -maxrate 10M -bufsize 10M -rc_eq ‘blurCplx^(1-qComp)’ -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 16:9 /Users/jonesy/Documents/Azureus\ Downloads/AUTOMATIC_DOWNLOADS/CSI.S09E05.HDTV.XviD-LOL.avi.mp4
And it doesn’t matter if I run this in Terminal directly or through AppleScript using the “do shell script” command, the resulting mp4 file is an incomplete 21MB everytime. (I know the file is good, though, because ffmpegX converted it with no problem.)
I’m sorry I keep pestering you with this, but automating these conversions will make life so much easier in the future :-)
Rob
Hi Rob,
Im away from my home machine (in San Diego for a conference), but I tried it at home and it was fine. Have you tried a different file? The other thing is that you might want to move the file to another directory…..maybe azereus is locking it or something.
Also I noticed your command had -bt 100 that’s bitrate 100kbs……is that what you want? I used 1500 (ie: 1500kbps)…..
anyways couple of things to look at.