Convert Y4M to MPG — Free Online Tool
Convert Y4M (YUV4MPEG2) uncompressed video files to MPG format using MPEG-2 video encoding and MP2 audio in your browser. This tool is ideal for encoding raw intermediate video from encoding pipelines or video processing tools into a broadcast-compatible MPEG-2 stream for playback, archiving, or DVD authoring.
to
FFmpeg Command
Copy this command to run the same conversion locally with FFmpeg on your desktop. Download FFmpeg
Drop your Y4M file here
or click to browse
Free — no uploads, no signups. Your files never leave your browser.
Settings
Note: Browser-based encoding uses approximate quality targets. For precise CRF compression, copy the FFmpeg command above and run it on your desktop.
Estimated output:
Conversion Complete!
DownloadHow It Works
Y4M files store raw, uncompressed YUV pixel data frame-by-frame with no temporal compression — every frame is fully self-contained. During conversion, FFmpeg reads each raw frame and encodes it using the MPEG-2 video codec, which applies discrete cosine transform (DCT)-based inter-frame and intra-frame compression to dramatically reduce file size. The audio channel (if present in the Y4M source, which is uncommon) is encoded as MP2, the standard audio codec for MPEG-1/2 containers. The resulting MPG file wraps both streams in an MPEG program stream, a format historically used for VCD, DVD, and broadcast television. Because Y4M is completely uncompressed, no quality is lost reading the source — all quality decisions happen entirely in the MPEG-2 encoding step.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg application, the open-source multimedia processing engine that handles reading the raw Y4M frames and encoding them into the MPEG-2 MPG output. |
-i input.y4m
|
Specifies the input Y4M file containing raw, uncompressed YUV video frames. FFmpeg automatically detects the YUV4MPEG2 format and reads the per-frame header metadata to determine resolution, framerate, and colorspace. |
-c:v mpeg2video
|
Selects the MPEG-2 video encoder, which compresses the raw YUV frames from the Y4M source using DCT-based intra- and inter-frame compression to produce a broadcast- and DVD-compatible video stream. |
-c:a mp2
|
Selects the MP2 (MPEG-1 Audio Layer II) encoder for any audio stream present in the source — MP2 is the native and most compatible audio codec for MPEG-1/2 program stream containers used in MPG files. |
-q:v 2
|
Sets the MPEG-2 video quantization scale to 2 (on a scale of 1–31, where 1 is highest quality). This near-maximum setting produces visually excellent MPEG-2 output suitable for archiving or DVD authoring while still achieving substantial compression over the uncompressed Y4M source. |
-b:a 192k
|
Sets the MP2 audio bitrate to 192 kilobits per second, the standard bitrate for MPEG program stream audio that balances file size and audio fidelity and is compatible with hardware MPEG-2 decoders. |
output.mpg
|
Specifies the output filename and instructs FFmpeg to write an MPEG program stream (.mpg), wrapping the encoded MPEG-2 video and MP2 audio into the legacy container format used for VCD, DVD, and broadcast applications. |
Common Use Cases
- Encoding the output of a raw video processing pipeline (e.g., from a tool like AviSynth, VapourSynth, or libav piping) into a broadcast-compatible MPEG-2 MPG file for delivery or archiving
- Preparing uncompressed Y4M test sequences or reference video for DVD authoring workflows that require MPEG-2 encoded program streams
- Converting Y4M reference video from video codec testing suites into MPG for compatibility with legacy hardware players and set-top boxes that support MPEG-2 but not raw formats
- Reducing the enormous file size of a Y4M intermediate file for long-term storage while retaining broadcast-grade MPEG-2 quality using the default q:v 2 setting
- Generating MPG files from raw Y4M captures for compatibility with older non-linear editing systems or broadcast ingest tools that require MPEG-2 program streams
- Creating VCD- or SVCD-compatible MPG files from lossless Y4M source material captured or exported by professional video tools
Frequently Asked Questions
Y4M stores every video frame as full, uncompressed YUV pixel data, so even a few seconds of standard-definition video can occupy hundreds of megabytes or more. MPEG-2 encoding applies aggressive temporal compression — encoding only the differences between frames rather than each frame in full — along with DCT-based spatial compression within each frame. At the default quality setting of q:v 2, the output MPEG-2 stream is high quality but will typically be 50–200x smaller than the original Y4M file depending on content complexity.
Yes — MPG with MPEG-2 video is a lossy format, so the conversion introduces compression artifacts that are not present in the lossless Y4M source. However, because Y4M is fully uncompressed, the encoder reads a perfect, undegraded source signal, meaning all quality loss is determined solely by the MPEG-2 encoder settings. Using the default q:v 2 (the highest quality end of the scale) produces visually excellent results that are appropriate for broadcast and DVD authoring purposes.
Y4M is primarily a video-only format; audio is rarely embedded in Y4M files as the format was designed for inter-application piping of raw video frames. If your Y4M file does contain an audio stream, it will be encoded to MP2 at 192k bitrate, which is the standard audio codec for MPEG-1/2 program streams. If there is no audio in the source, the MPG output will simply contain no audio track, which is valid for the format.
The -q:v flag controls MPEG-2 quantization scale, where 1 is the highest quality and 31 is the lowest. The default command uses -q:v 2, which is near-maximum quality. To reduce file size at some quality cost, increase the value — for example, -q:v 5 or -q:v 8. For the absolute highest quality MPEG-2 output, you can also switch to constant bitrate using -b:v instead, e.g., -b:v 8000k for an 8 Mbps stream suitable for DVD.
Yes — replace -c:v mpeg2video with -c:v mpeg1video in the FFmpeg command to encode using the older MPEG-1 codec, which is required for VCD-compliant files. MPEG-1 has stricter resolution and bitrate constraints (typically 352x240 at 1.15 Mbps for NTSC VCD) and is less efficient than MPEG-2, but it offers broader compatibility with very old hardware players and software that predates MPEG-2 support.
Yes — on the command line, you can use a shell loop to process multiple files. On Linux or macOS, run: for f in *.y4m; do ffmpeg -i "$f" -c:v mpeg2video -c:a mp2 -q:v 2 -b:a 192k "${f%.y4m}.mpg"; done. On Windows PowerShell: Get-ChildItem *.y4m | ForEach-Object { ffmpeg -i $_.FullName -c:v mpeg2video -c:a mp2 -q:v 2 -b:a 192k ($_.BaseName + '.mpg') }. This is especially useful for converting large Y4M files over 1GB, which exceed the browser tool's file size limit.
Technical Notes
Y4M encodes video in planar YUV colorspace (typically 4:2:0, 4:2:2, or 4:4:4), and the MPEG-2 encoder natively operates on YUV data, meaning no colorspace conversion is required during encoding — the raw pixel planes are passed directly to the DCT compression stage. MPEG-2 in an MPG program stream supports a wide range of resolutions and bitrates but has strict compliance requirements for VCD (352x240/288, 1.15 Mbps) and DVD (up to 720x576 or 720x480, up to ~9.8 Mbps). The MPG container does not support chapters, subtitle streams, or multiple audio tracks, so none of these can be preserved from the source (Y4M does not carry them either). MP2 audio at 192k is the standard for MPEG program streams and is decoded natively by virtually all MPEG-2 hardware decoders. The -q:v scale in MPEG-2 is not linearly perceptual — the difference between q:v 1 and q:v 3 is visually significant, while differences between q:v 20 and q:v 25 are harder to perceive at typical viewing distances. For archival use, q:v 2 is recommended as a strong balance of quality and compatibility.