[MEncoder-users] H264 encoding for iPod and Flash

James Hastings-Trew jimht at shaw.ca
Tue Oct 23 08:51:38 CEST 2007


Mart wrote:
> Hi,
> Does anyone have a working command line for mencoder that will encode
> video to AAC+H264, such that the file is compatible with both the iPod
> (5G onwards) and the latest Adobe Flash plugin? Single pass encoding
> is most useful, if that's possible.
I have no idea about Flash, or compatibility with it. Here is my 
personal recipe for iPod Touch encoding with Mencoder. Note that this 
requires the use of another utility after the encoding. Note also that 
this is a Windows solution - if you are using linux you'll need to do 
some research to obtain a tool that does the same thing nicmp4box does - 
add the "correct" uuid "atom" that iTunes requires for compatibility 
with the ipod. (nicmp4box: http://nic.dnsalias.com/ )

|mencoder INPUT -sws 9 -of lavf -lavfopts format=mp4
/ -vf scale=576:320,dsize=576:320,harddup
/ -ovc x264
/ -x264encopts 
bitrate=1381:vbv_maxrate=1500:vbv_bufsize=2000:nocabac:me=umh: 
subq=6:trellis=1:level_idc=30:global_header:threads=2:pass=1:turbo
/ -oac faac
/ -faacopts mpeg=4:object=2:br=160:raw -channels 2 -srate 48000 -o TEMP.mp4

mencoder INPUT -sws 9 -of lavf -lavfopts format=mp4
/ -vf scale=576:320,dsize=576:320,harddup
/ -ovc x264
/ -x264encopts 
bitrate=1381:vbv_maxrate=1500:vbv_bufsize=2000:nocabac:me=umh: 
subq=6:trellis=1:level_idc=30:global_header:threads=2:pass=2
/ -oac faac
/ -faacopts mpeg=4:object=2:br=160:raw -channels 2 -srate 48000 -o TEMP.mp4

nicmp4box -add TEMP.mp4 OUTPUT.mp4|

This is a two pass solution. You can turn it into a one pass solution by 
eliminating the second pass and the ":pass=1:turbo" options from the 
x264encopts. But I don't recommend it. Scale is up to you and you'll 
have to apply additional filters (pullup,softskip,pp=lb) and other 
options (-ofps 24000/1001 or 30000/1001) according to your source 
material. But this should give you a push in the right direction.




More information about the MEncoder-users mailing list