6.5. Encoding to MPEG format

MEncoder can create MPEG (MPEG-PS) format output files. Usually, when you are using MPEG-1 or MPEG-2 video, it is because you are encoding for a constrained format such as SVCD, VCD, or DVD. The specific requirements for these formats are explained in the VCD and DVD creation guide section.

To change MEncoder's output file format, use the -of mpeg option.

Example:

mencoder input.avi -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video \
    -oac copy other_options -o output.mpg

Creating an MPEG-1 file suitable to be played on systems with minimal multimedia support, such as default Windows installs:

mencoder input.avi -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 \
    -o output.mpg -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
    -lavcopts vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3

Same, but using libavformat MPEG muxer:

mencoder input.avi -o VCD.mpg -ofps 25 -vf scale=352:288,harddup -of lavf \
    -lavfopts format=mpg -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
    -lavcopts vcodec=mpeg1video:vrc_buf_size=327:keyint=15:vrc_maxrate=1152:vbitrate=1152:vmax_b_frames=0

Hint:

If for some reason the video quality of the second pass did not satisfy you, you may re-run your video encode with a different target bitrate, provided that you saved the statistics file of the previous pass. This is possible because the statistics file's primary goal is to record the complexity of each frame, which doesn't depend heavily on bitrate. You should note, though, that you'll get the best results if all passes are run with target bitrates that do not differ very much.