Convert MPG to Y4M — Free Online Tool

Convert MPG files (MPEG-1/MPEG-2 encoded video) to Y4M (YUV4MPEG2), a fully uncompressed raw video format. This is ideal for feeding high-fidelity source frames into video processing pipelines, encoders, or tools like x264, x265, and VapourSynth that accept Y4M as a lossless intermediate.

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

During this conversion, FFmpeg decodes the compressed MPEG-1 or MPEG-2 video stream from the MPG container — reversing the lossy DCT-based compression — and writes the resulting raw YUV pixel data into a Y4M file. Each frame is stored uncompressed in YUV colorspace with a plain-text header per frame describing resolution, framerate, and chroma subsampling (typically 4:2:0, matching the MPEG-2 source). Because Y4M has no audio support, any MP2 or MP3 audio tracks in the MPG file are silently dropped. The output is substantially larger than the input since no compression is applied to the video data.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg command-line tool, which handles all decoding, stream processing, and output writing for this conversion.
-i input.mpg Specifies the input MPG file. FFmpeg will demux the MPEG-1/MPEG-2 container and decode the compressed video stream (and any MP2/MP3 audio, though audio is not mapped to the output).
-c:v rawvideo Instructs FFmpeg to encode the output video stream as rawvideo, which when combined with the .y4m file extension causes FFmpeg to write the YUV4MPEG2 format — uncompressed planar YUV frames with Y4M stream and frame headers.
output.y4m Sets the output filename and triggers Y4M container muxing. The .y4m extension is what tells FFmpeg to use the yuv4mpegpipe muxer, producing a valid YUV4MPEG2 file compatible with x264, x265, VapourSynth, and other tools in the lossless video processing ecosystem.

Common Use Cases

  • Feeding decoded MPEG-2 broadcast or DVD footage into a lossless re-encoding pipeline using x264 or x265 to avoid generation loss from intermediate re-compression
  • Supplying raw YUV frames from an MPG source to VapourSynth or AviSynth video filter scripts that require Y4M pipe input
  • Archiving the decoded frame content of a VCD or DVD-rip MPG as an uncompressed reference before applying filters such as deinterlacing or upscaling
  • Using Y4M output as a reference video stream for SSIM or PSNR quality metric comparisons against other encoded versions of the same MPEG-2 source
  • Preparing MPG footage for frame-accurate editing in tools like Shotcut or Kdenlive that benefit from uncompressed Y4M intermediates to avoid seek inaccuracies in MPEG streams

Frequently Asked Questions

Yes, within the limits of what was already encoded in the MPG file. The MPEG-1/MPEG-2 compression in the source is lossy, so any artifacts baked into those frames will be present in the Y4M output. However, the Y4M file is a lossless, exact pixel-for-pixel representation of what the MPG decoder produces — no additional quality loss is introduced during this conversion.
MPG files use MPEG-1 or MPEG-2 compression, which achieves significant size reduction through DCT transforms, motion compensation, and inter-frame prediction. Y4M stores every frame as raw, uncompressed YUV pixel data with no compression whatsoever. A typical MPEG-2 file compressed at 6–8 Mbps can expand to several gigabytes as a Y4M file, since raw 4:2:0 video at standard definition requires roughly 150–200 MB per minute.
The audio is dropped entirely. Y4M is a video-only format — it has no provision for storing audio streams. The MP2 or MP3 audio typically found in MPG files cannot be included in the output. If you need the audio preserved, you should extract it separately using FFmpeg before or after the Y4M conversion.
Framerate is preserved and written into the Y4M per-stream header. Interlacing metadata from the MPEG-2 stream is reflected in the Y4M frame headers, which can indicate top-field-first or bottom-field-first interlaced content. However, downstream tools vary in how they interpret Y4M interlacing hints, so you may still want to apply deinterlacing explicitly if your target workflow requires progressive frames.
Yes, the FFmpeg command works on arbitrarily large MPG files when run locally on your desktop. The in-browser tool supports files up to 1GB, but full DVD-rip MPG files can be 4GB or more and should be processed via the command line. Simply copy the displayed command — 'ffmpeg -i input.mpg -c:v rawvideo output.y4m' — and run it in a terminal. Be aware that the Y4M output will be vastly larger than the input, so ensure you have sufficient disk space before converting.
Yes, and this is one of Y4M's primary use cases. You can modify the FFmpeg command to pipe raw Y4M output directly to another encoder by replacing the output filename with a pipe descriptor, for example: 'ffmpeg -i input.mpg -c:v rawvideo -f yuv4mpegpipe - | x265 --y4m -o output.hevc -'. This avoids writing the enormous intermediate file to disk entirely and is the standard workflow for tools like x264, x265, and VVenC.

Technical Notes

Y4M (YUV4MPEG2) stores video in planar YUV colorspace, and the chroma subsampling of the output will match what the MPEG-2 decoder produces — almost universally 4:2:0 for standard MPEG-2 content. The Y4M format includes a stream-level header (beginning with 'YUV4MPEG2') containing width, height, framerate as a rational fraction, interlacing mode, and chroma subsampling, followed by individual frame headers marked with 'FRAME'. FFmpeg's rawvideo codec writes this format correctly when the .y4m extension is used. There is no quality setting to configure — the output is always a lossless decoded representation of the MPEG source. Metadata such as aspect ratio is conveyed through Y4M headers, but chapter markers, subtitle streams, and multiple audio tracks present in more capable containers are not supported by Y4M and are discarded. Because MPEG-2 often encodes content at a display aspect ratio different from the storage aspect ratio (using SAR/DAR flags), verify that downstream tools correctly interpret the aspect ratio from the Y4M header to avoid stretched output.

Related Tools