2010年11月17日星期三

ffmpeg转ipod参数设置

iPod video guide

Encoding videos suitable for iPods

Thanks to “cartman” on the FreeNode IRC network for testing and providing information for this guide.

The “new” higher resolution capability of the iPod video uses something Apple have dubbed a “Low Complexity” version of the Baseline Profile of H.264. Thankfully someone discovered what this meant. (See here for details - credit goes to Tyler Loch for this information.)

At first I wondered what the use of 640×480 video on a 320×240 screen would be but I was informed that these devices have a TV out. Fun. Anyway, on to the good stuff.




1.5Mbit/s 640×480 H.264 videos (for improved quality using TV out)
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

UUID stuff:
FFmpeg’s libavformat does not yet write this atom but I will request that it be added.
MP4Box from the GPAC project should write the atom but the size of the atom should be 28 bytes and MP4Box files have the UUID atom as 24 bytes. I don’t know what makes up the 28 bytes but I’ve contacted Jean Le Feuvre (the GPAC guy) about this so hopefully it will be fixed in the development code shortly. In the meantime feel free to use NicMP4Box or figure out the hacked code and readd it into MP4Box. I’ve had a look at Nick’s hacks myself and they are fairly minimal.
AtomicParsley works! But only the development code which can be checked out from their subversion repository. See below for usage.

For one pass:

ffmpeg -i INPUT -acodec libfaac -ab 128k -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method umh -subq 6 -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 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect WIDTH:HEIGHT -threads 0 OUTPUT.mp4

AtomicParsley OUTPUT.mp4 --DeepScan --iPod-uuid 1200 --overWrite

For two pass:

ffmpeg -i INPUT -an -pass 1 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions 0 -me_method dia -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 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect WIDTH:HEIGHT -threads 0 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_method umh -subq 6 -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 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect WIDTH:HEIGHT -threads 0 OUTPUT.mp4

AtomicParsley OUTPUT.mp4 --DeepScan --iPod-uuid 1200 --overWrite


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 one pass:

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_method umh -subq 6 -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 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -title SOME_TITLE -threads 0 OUTPUT.mp4

For two pass:

ffmpeg -i INPUT -an -pass 1 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions 0 -me_method dia -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 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -title SOME_TITLE -threads 0 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_method umh -subq 6 -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 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -title SOME_TITLE -threads 0 OUTPUT.mp4


IF ANYONE HAS FEEDBACK ON THE SETTINGS BELOW IT WOULD BE APPRECIATED!
2.5Mbit/s 640×480 MPEG-4 SP videos
BIT_RATE <= 2500 kbps
640×480
Up to 30 fps
Simple Profile

For one pass:

ffmpeg -i INPUT -acodec libfaac -ab 128k -s WIDTHxHEIGHT -vcodec mpeg4 -b BIT_RATE -flags +aic+cbp+mv0+mv4+trell -mbd 2 -cmp 2 -subcmp 2 -g 250 -maxrate 2.5M -bufsize 2M -title SOME_TITLE OUTPUT.mp4

For two pass:

ffmpeg -i INPUT -an -pass 1 -s WIDTHxHEIGHT -vcodec mpeg4 -b BIT_RATE -flags +aic+cbp+mv0+mv4+trell -mbd 2 -cmp 2 -subcmp 2 -g 250 -maxrate 2.5M -bufsize 2M -title SOME_TITLE OUTPUT.mp4

ffmpeg -i INPUT -acodec libfaac -ab 128k -pass 2 -s WIDTHxHEIGHT -vcodec mpeg4 -b BIT_RATE -flags +aic+cbp+mv0+mv4+trell -mbd 2 -cmp 2 -subcmp 2 -g 250 -maxrate 2.5M -bufsize 2M -title SOME_TITLE OUTPUT.mp4

没有评论:

发表评论