Create MPEG-1 System Stream with FFmpeg

This guide provides a straightforward tutorial on how to multiplex video and audio into an MPEG-1 System Stream container using the FFmpeg command-line tool. You will learn the specific FFmpeg commands, codecs, and parameters required to successfully output compliant MPEG-1 (.mpg or .mpeg) files for legacy hardware and compatibility needs.

Understanding MPEG-1 System Stream Requirements

The MPEG-1 System Stream (often designated by the .mpg, .mpeg, or .dat file extensions) is a legacy container format. To ensure strict compatibility and avoid muxing errors, the container must contain specific codecs:

  • Video Codec: MPEG-1 Video (mpeg1video)
  • Audio Codec: MPEG-1 Audio Layer II (mp2) or MP1

The Basic FFmpeg Command

To convert a modern video file (like an MP4) into an MPEG-1 System Stream, you need to transcode both the video and audio to their respective MPEG-1 compliant codecs and specify the MPEG muxer.

Run the following command in your terminal:

ffmpeg -i input.mp4 -c:v mpeg1video -q:v 4 -c:a mp2 -b:a 192k -f mpeg output.mpg

Command breakdown:

  • -i input.mp4: Specifies the input source file.
  • -c:v mpeg1video: Encodes the video stream using the MPEG-1 video codec.
  • -q:v 4: Sets the video quality scale (a lower number means higher quality; 1-31 range). Alternatively, you can use -b:v 1500k to set a constant bitrate.
  • -c:a mp2: Encodes the audio stream using the mandatory MP2 format.
  • -b:a 192k: Sets the audio bitrate to 192 kbps.
  • -f mpeg: Forces the output format to be a standard MPEG-1 System Stream.

Creating a Standard-Compliant VCD Stream

If you are writing the MPEG-1 System Stream for Video CD (VCD) creation, FFmpeg provides a built-in target profile. This profile automatically handles all resolution, bitrate, GOP size, and format restrictions required by the MPEG-1 standard.

Use the target flag for automated configuration:

ffmpeg -i input.mp4 -target vcd output.mpg

This command automatically sets the video to MPEG-1 at 1150 kbps (352x240 for NTSC or 352x288 for PAL) and the audio to MP2 at 224 kbps, multiplexed perfectly into an MPEG-1 System Stream.