[MEncoder-users] ipod video encoding settings assistance

lists.mplayerhq.hu at spam.phoenixdigital.com lists.mplayerhq.hu at spam.phoenixdigital.com
Sun Sep 7 10:41:38 CEST 2008


Hi All,

I got some assistance a few months back in getting my settings right for 
encoding videos in h264 so they would play back on the xbox360.... Now I 
was under the assumption that the video files I was making would be ipod 
compatible but however they do not transfer over to my iphone due to 
some incompatibility itunes does not specify.

Can someone please steer me in the right direction as to what is wrong 
with my mencoder settings?

I have am performing a 2 pass encode with the following

Pass1
mencoder.exe "input.mpg" -o NUL -passlogfile "x264-2pass.log" -nosound 
-ovc x264 -x264encopts 
bitrate=400:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:threads=auto:nofast_pskip:trellis=1:partitions=p8x8,b8x8,i8x8,i4x4:mixed_refs:bime:keyint=250:keyint_min=25:frameref=3:bframes=6:b_adapt:b_pyramid:weight_b:direct_pred=auto:subq=6:brdo:chroma_me:cabac:deblock:nossim:nopsnr:level_idc=41:pass=1:turbo=1

Pass2
mencoder.exe "input.mpg" -o "output.avi" -aspect 16:9 -passlogfile 
"x264-2pass.log" -oac faac -faacopts mpeg=4:br=128:object=2 -ovc x264 
-x264encopts 
bitrate=400:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:threads=auto:nofast_pskip:trellis=1:partitions=p8x8,b8x8,i8x8,i4x4:mixed_refs:bime:keyint=250:keyint_min=25:frameref=3:bframes=6:b_adapt:b_pyramid:weight_b:direct_pred=auto:subq=6:brdo:chroma_me:cabac:deblock:nossim:nopsnr:level_idc=41:pass=2 


Then I use mp4box to put the video into an mp4 container
MP4Box -aviraw video "output.avi"
MP4Box -aviraw audio "output.avi"
MP4Box -add "output_video.h264" -add "audio.aac" -fps 25  "output.mp4"

An example file can be found here
http://home.phoenixdigital.com/temp/Test.mp4

Here is the full script I use to convert videos in windows. I just drag 
and drop the video files onto this batch file and away it goes.
---------------------------------------------
@echo off

REM This file will convert any video file playable by mplayer into an 
mp4 file which is streamable to an xbox 360
REM To use this program just drag the files you want to convert and drop 
them onto this batch file in windows explorer
REM The video is encoded in H264 and the audio in AAC

REM REQUIREMENTS:
REM MENCODER - can be obtained from http://www.mplayerhq.hu
REM MP4Box - can be obtained from http://kurtnoise.free.fr/mp4tools/

REM You can change the standard settings here
set mencoder_video_bitrate=400
set mencoder_audio_bitrate=128
set mencoder_path=C:\System\Apps\Mplayer
set mbox_path=C:\System\Apps\MP4Box
set mencoder_cropping=-vf crop=392:568:70:3,scale=400:304

REM WARNING: Changing these settings may make an mp4 incompatible with 
your xbox 360
set mencoder_ovc=x264 -x264encopts 
bitrate=%mencoder_video_bitrate%:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:threads=auto:nofast_pskip:trellis=1:partitions=p8x8,b8x8,i8x8,i4x4:mixed_refs:bime:keyint=250:keyint_min=25:frameref=3:bframes=6:b_adapt:b_pyramid:weight_b:direct_pred=auto:subq=6:brdo:chroma_me:cabac:deblock:nossim:nopsnr:level_idc=41
set mencoder_oac=faac -faacopts mpeg=4:br=%mencoder_audio_bitrate%:object=2
set mencoder_aspect=-aspect 16:9
set mencoder_pass_logfile=%~dp1x264-2pass.log
set mp4box_fps=25

title X264 Encode: Convert video to h264 format
echo.

echo X264 Encode: Convert video to h264 format
echo.

:loop
if [%1]==[] goto finish

if exist "%~dp1input.mpg" goto fileExists

title X264 Encode: Pass1 "%~n1"...
echo Converting "%~nx1" to "output.avi" in "%~dp1"...

move %1 "%~dp1input.mpg"
echo Analysing video pass 1
start /w /BelowNormal %mencoder_path%\mencoder.exe "%~dp1input.mpg" -o 
NUL -passlogfile "%mencoder_pass_logfile%" -nosound -ovc 
%mencoder_ovc%:pass=1:turbo=1
title X264 Encode: Pass2 "%~n1"...
echo Converting to avi container pass 2
start /w /BelowNormal %mencoder_path%\mencoder.exe "%~dp1input.mpg" -o 
"%~dp1output.avi" %mencoder_aspect% -passlogfile 
"%mencoder_pass_logfile%" -oac %mencoder_oac% -ovc %mencoder_ovc%:pass=2 
%mencoder_cropping%
echo Conversion to AVI container completed.

title X264 Encode: Converting AVI into MP4 container....
echo Converting into MP4 container....
%mbox_path%\MP4Box -aviraw video "%~dp1output.avi"
%mbox_path%\MP4Box -aviraw audio "%~dp1output.avi"
move "%~dp1output_audio.raw" "%~dp1audio.aac"

%mbox_path%\MP4Box -add "%~dp1output_video.h264" -add "%~dp1audio.aac" 
-fps %mp4box_fps%  "%~dp1%~n1.mp4"

move "%~dp1output.mp4" "%~dp1%~n1.mp4"

del "%~dp1audio.aac"
del "%~dp1output_video.h264"
del "%~dp1output.avi"

move "%~dp1input.mpg" %1

echo.

shift
goto loop

:fileExists
echo File "%~dp1input.mpg" already exists in "%~dp1".
echo Conversion halted.
echo.
goto finish


:finish
title X264: Conversion Finished
echo Finished.

pause > nul

Here is the resulting mp4



More information about the MEncoder-users mailing list