@echo off :: :: Encode a source video file as MPEG-2. :: :: Input: The source file needs to be specified as first argument. :: Output: .mpg :: :: Optimized for videos from Panasonic's Lumix LX3 :: :: - Container: Quicktime MOV :: - Codec: MJPEG :: - Resolution: X_RESx720 :: - Audio: 1 Channel (mono) :: :: Notes on MEncoder messages: :: :: - "BUFFER UNDEFLOW at stream 0, raising muxrate to 12196 kb/s, delta_scr: 36269" :: This is an informational message only (can unfortunately only be discerned in the source code). Buffer size is adjusted automatically. :: :: - "BUFFER OVERFLOW: 4704 > 4096, pts: 828837000" :: This is an error message (can unfortunately only be discerned in the source code). :: If it is logged at the end of processing, the last frame is incomplete. :: Resolution: if the buffer size reported is 4096, the "abuf_size" must be increased from its default value of 4 (times 1024). :: :: :: Variables used during encoding set X_RES=1280 set Y_RES=720 set ASPECT_RATIO=16/9 set FRAMERATE=24 set VIDEO_BITRATE=12000 set VIDEO_BITRATE_MAX=16000 set AUDIO_FREQ=48000 set AUDIO_BITRATE=112 set AUDIO_CHANNELS=1 set LAVC_OPTIONS=vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=%VIDEO_BITRATE_MAX%:vbitrate=%VIDEO_BITRATE%:keyint=15:trell:mbd=2:acodec=mp2:abitrate=%AUDIO_BITRATE% set MPEG_OPTIONS=format=dvd:vaspect=%ASPECT_RATIO%:vwidth=%X_RES%:vheight=%Y_RES%:vframerate=%FRAMERATE%:interleaving2:abuf_size=8 :: Safety check for output file existence if not exist %~dpn1.mpg goto Convert echo. echo Output file %~dpn1.mpg already exists. Aborting... echo. goto End :Convert :: 1-pass mencoder -oac lavc -ovc lavc -of mpeg -mpegopts %MPEG_OPTIONS% -ofps %FRAMERATE% -lavcopts %LAVC_OPTIONS% -noskip -channels %AUDIO_CHANNELS% -srate %AUDIO_FREQ% -af lavcresample=%AUDIO_FREQ% -o %~dpn1.mpg %1 :End