Convert Y4M to MPEG — Free Online Tool

Convert Y4M (YUV4MPEG2) lossless uncompressed video to MPEG format using MPEG-2 video and MP2 audio compression. This tool is ideal for taking raw intermediate video files — commonly output by tools like x264, FFmpeg pipes, or video encoders — and packaging them into the widely-compatible MPEG container for broadcast, legacy playback, or archival distribution.

FFmpeg Command

Copy this command to run the same conversion locally with FFmpeg on your desktop. Download FFmpeg

Free — no uploads, no signups. Your files never leave your browser.

Estimated output:

Conversion Complete!

Download

How It Works

Y4M files contain raw, uncompressed YUV video frames with no temporal compression — every frame is stored in full. During this conversion, FFmpeg encodes that raw video stream using the MPEG-2 video codec, applying DCT-based lossy compression with interframe prediction (I, P, and B frames) to dramatically reduce file size. Since Y4M contains no audio track, FFmpeg will encode silence or skip audio entirely — if your source has a companion audio file, you'd need to add it separately. The output MPEG file wraps the MPEG-2 video in a program stream (.mpeg), which is the format used by DVD video and broadcast systems.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg command-line tool. In the browser version of this tool, the same logic runs via FFmpeg.wasm compiled to WebAssembly, so the command shown here is identical to what you would run in a terminal on your local machine.
-i input.y4m Specifies the input file in YUV4MPEG2 format. FFmpeg reads the Y4M frame headers to determine the resolution, frame rate, colorspace, and aspect ratio of the raw video stream — there is no demuxing required since Y4M is a simple sequential frame format with no container complexity.
-c:v mpeg2video Encodes the raw uncompressed YUV video from the Y4M source using the MPEG-2 video codec. This applies DCT-based interframe compression with I, P, and B frames — a fundamental change from the frame-by-frame uncompressed storage of the Y4M source.
-c:a mp2 Sets the audio codec to MP2 (MPEG-1 Audio Layer II), the standard audio format for MPEG program streams and DVD. Since Y4M contains no audio, this flag will have no practical effect on the output unless a second audio input is added to the command.
-q:v 2 Sets the MPEG-2 video quality using a fixed quantizer scale of 2, near the highest quality end of the 1–31 range. Because the source is lossless Y4M, using a high-quality setting here minimizes the generational quality loss introduced by MPEG-2 compression.
-b:a 192k Sets the MP2 audio bitrate to 192 kilobits per second, which is a standard broadcast-quality bitrate for MP2 audio in MPEG program streams. This setting is effectively unused in practice for Y4M inputs since the source has no audio track.
output.mpeg Specifies the output filename with the .mpeg extension, which tells FFmpeg to write an MPEG program stream container. This format is the standard used for DVD-compatible MPEG-2 video and is playable by virtually all legacy media players and hardware decoders.

Common Use Cases

  • Packaging raw Y4M output from a video synthesis or CGI rendering pipeline into a distributable MPEG file for clients using legacy media players
  • Converting lossless Y4M intermediate files from a video editing workflow into MPEG-2 format for DVD authoring or broadcast ingest systems
  • Compressing large uncompressed Y4M files — which can run into tens of gigabytes — into compact MPEG files for archival storage or sharing
  • Testing MPEG-2 encode quality from a reference lossless source, since Y4M provides a pristine uncompressed baseline for objective quality comparisons
  • Preparing Y4M files generated by tools like libtheora, x264 --output, or custom video pipelines for playback on set-top boxes and legacy hardware that supports MPEG-2
  • Converting frame-accurate Y4M exports from tools like Avisynth or VapourSynth into broadcast-compatible MPEG streams for television production workflows

Frequently Asked Questions

Yes — this conversion is inherently lossy. Y4M stores raw, uncompressed YUV frames with no quality degradation, while MPEG-2 uses DCT-based compression that discards visual information that is difficult to perceive. The default quality setting (-q:v 2) is near the top of the scale, producing high-quality MPEG-2 output, but it will never be pixel-perfect compared to the Y4M source. For critical workflows, keep your Y4M master and treat the MPEG output as a delivery or distribution copy only.
Y4M files are uncompressed — a single second of 1080p video at 24fps can occupy over 300MB of disk space. MPEG-2 applies significant temporal and spatial compression using interframe prediction, reducing file sizes by factors of 50x to 200x or more depending on content complexity and the quality setting used. This dramatic size reduction is the primary reason Y4M is used as an intermediate format rather than a delivery format.
No — the Y4M (YUV4MPEG2) format is a video-only container and carries no audio data whatsoever. The output MPEG file will therefore contain no audio track unless you modify the FFmpeg command to include a separate audio source using an additional -i flag. If you need audio in the output, you would add something like -i audio.wav before the output filename and include -c:a mp2 -b:a 192k to encode it into the MPEG stream.
The -q:v flag sets the MPEG-2 video quality using a fixed quantizer scale, where 1 is the highest quality and 31 is the lowest. The default of 2 produces excellent visual quality at the cost of a larger file size. If you need smaller files and can accept some quality reduction, increasing this value to 4–6 is a reasonable trade-off for most content. For archival purposes, stick with 1 or 2 since you are encoding from a lossless source and want to preserve as much quality as possible.
Yes — on Linux or macOS you can use a shell loop: for f in *.y4m; do ffmpeg -i "$f" -c:v mpeg2video -c:a mp2 -q:v 2 -b:a 192k "${f%.y4m}.mpeg"; done. On Windows PowerShell, use: Get-ChildItem *.y4m | ForEach-Object { ffmpeg -i $_.FullName -c:v mpeg2video -c:a mp2 -q:v 2 -b:a 192k ($_.BaseName + '.mpeg') }. This is especially useful for large Y4M files over 1GB that exceed the browser tool's processing capacity.
This conversion uses MPEG-2 video (the default for the .mpeg container in FFmpeg), not MPEG-1. MPEG-2 supports higher resolutions, better color fidelity, and higher bitrates than MPEG-1, and is the standard used for DVD video and digital broadcast (DVB, ATSC). If you specifically need MPEG-1 for compatibility with very old hardware or software, you can modify the command to use -c:v mpeg1video, but MPEG-2 is the better choice for virtually all modern use cases.

Technical Notes

Y4M files store raw YUV planar video, typically in 4:2:0 chroma subsampling, and include frame headers that describe resolution, frame rate, aspect ratio, and colorspace — all of which FFmpeg reads and passes into the MPEG-2 encoder. MPEG-2 natively supports 4:2:0 chroma subsampling, so no chroma resampling is required during this conversion, preserving the color structure of the source. The output uses MPEG program stream format (.mpeg), which interleaves video and audio into a single multiplexed stream suitable for DVD and broadcast use. One important limitation: Y4M has no support for transparency (alpha channels) and neither does MPEG-2, so this is not a concern in this pipeline. Frame rate and resolution metadata from the Y4M headers are carried into the MPEG-2 output faithfully. Note that very high-resolution Y4M files (e.g., 4K) may produce MPEG-2 streams that exceed the standard's maximum bitrate specification and may not be compatible with strict MPEG-2 decoders — MPEG-2 was designed with SD and HD broadcast resolutions in mind.

Related Tools