How to Transcode Video to MPEG-2 Using FFmpeg

This article provides a straightforward guide on how to transcode video files into the MPEG-2 format using the mpeg2video encoder inside FFmpeg. You will learn the essential command-line syntax, key parameters for controlling quality and bitrate, and practical examples for creating compatible MPEG-2 outputs.

Basic MPEG-2 Transcoding Command

To convert a input video file to MPEG-2, you need to specify the mpeg2video encoder for the video stream. Below is the standard command-line structure:

ffmpeg -i input.mp4 -c:v mpeg2video -b:v 5M -c:a mp2 -b:a 192k output.mpg

Parameter Breakdown:

Controlling Quality with Constant Quality (VBR)

Instead of setting a fixed bitrate, you can use the -qscale:v (or -q:v) option to enable Variable Bitrate (VBR) encoding based on a quality scale. This ensures consistent visual quality throughout the video.

ffmpeg -i input.mp4 -c:v mpeg2video -qscale:v 3 -c:a ac3 -b:a 192k output.mpg

Encoding for DVD Compatibility

MPEG-2 is the standard format for DVD-Video. FFmpeg includes built-in target profiles that automatically set the correct resolution, bitrate, framerate, and GOP (Group of Pictures) structure required for DVD standards.

For NTSC (primarily North America):

ffmpeg -i input.mp4 -target ntsc-dvd output.mpg

For PAL (primarily Europe and Asia):

ffmpeg -i input.mp4 -target pal-dvd output.mpg

Using the -target flag overrides manual codec and bitrate settings to guarantee that the output file strictly complies with DVD authoring specifications.