Compress Y4M Online — Free File Size Reducer

Reprocess a Y4M (YUV4MPEG2) file through FFmpeg's rawvideo codec while keeping it in the Y4M container — useful for normalizing Y4M headers, stripping non-standard metadata, or verifying file integrity without any quality loss. Since Y4M is an uncompressed lossless format, both input and output are bit-identical in pixel data.

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 (YUV4MPEG2) stores raw, uncompressed YUV pixel data with a plain-text header describing frame dimensions, frame rate, interlacing, and chroma subsampling (e.g., 4:2:0, 4:2:2, 4:4:4). This tool passes the file through FFmpeg using the rawvideo codec on both ends, which means no encoding or decoding of pixel data occurs beyond reading and rewriting the raw YUV frames. The output Y4M file will have a freshly generated, standards-compliant YUV4MPEG2 header written by FFmpeg. Because neither input nor output applies any compression, there is zero generation loss — every pixel value is preserved exactly as-is.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg command-line tool. In the browser-based version of this tool, FFmpeg runs locally via WebAssembly (FFmpeg.wasm), so no data leaves your device.
-i input.y4m Specifies the input Y4M file. FFmpeg's Y4M demuxer reads the YUV4MPEG2 stream header to extract frame dimensions, frame rate, interlacing mode, and chroma subsampling, then reads each raw YUV frame sequentially.
-c:v rawvideo Sets the video codec to rawvideo, instructing FFmpeg to write uncompressed YUV frames directly into the output Y4M container without applying any encoding or pixel format transformation. This ensures zero generation loss between input and output.
output.y4m Specifies the output filename with the .y4m extension, which triggers FFmpeg's YUV4MPEG2 muxer. FFmpeg writes a fresh, standards-compliant YUV4MPEG2 stream header followed by the raw YUV frame data from the input, producing a clean Y4M file.

Common Use Cases

  • Normalize a Y4M file with a malformed or non-standard YUV4MPEG2 header so downstream tools like x264, x265, or VapourSynth can pipe it correctly
  • Verify the integrity of a Y4M intermediate file by round-tripping it through FFmpeg and confirming the output is playable and correctly structured
  • Strip any non-standard or application-specific metadata written into a Y4M header by a tool like FFmpeg's own muxer or a custom encoder pipeline before passing it to another application
  • Re-mux a Y4M file to ensure the frame rate fraction in the header matches the intended playback rate after it was incorrectly written by a video capture or conversion tool
  • Prepare a Y4M intermediate for piping into a lossless encoder like FFV1 or HuffYUV by first confirming the raw file reads cleanly through FFmpeg's rawvideo demuxer
  • Quickly re-export a Y4M file from a browser-based processing step to produce a clean output compatible with command-line encoding pipelines on a local workstation

Frequently Asked Questions

No. Y4M is a completely uncompressed format, and specifying '-c:v rawvideo' instructs FFmpeg to write the raw YUV frames directly without applying any encoding algorithm. The pixel values in the output file are mathematically identical to those in the input. The only thing that changes is the YUV4MPEG2 header, which FFmpeg regenerates according to its own muxer.
Yes. FFmpeg reads the chroma subsampling from the input Y4M header and passes it through the rawvideo pipeline unchanged. The output Y4M header will reflect the same chroma subsampling tag (C420, C422, C444, etc.) as the source file. No color plane resampling occurs during this operation.
The term 'compress' here refers to the processing action, not data compression — Y4M has no compression. The practical use is header normalization: some tools write non-standard or incomplete YUV4MPEG2 headers that break compatibility with strict parsers like those in x264, aom, or VapourSynth. Running the file through this tool produces a clean, FFmpeg-written header without touching the pixel data, which resolves many pipeline compatibility issues.
This is expected. Y4M stores raw, uncompressed YUV frames, so file size is determined entirely by resolution, frame count, frame rate duration, and chroma subsampling — not by any compression setting. A 1920x1080 4:2:0 Y4M file at 24fps will be approximately 1.5 GB per minute of video regardless of content. The output size will be within a few bytes of the input (the difference is just the header length).
The command shown ('ffmpeg -i input.y4m -c:v rawvideo output.y4m') processes a single file. To batch process multiple Y4M files in a Unix shell, you can wrap it in a loop: 'for f in *.y4m; do ffmpeg -i "$f" -c:v rawvideo "normalized_$f"; done'. On Windows Command Prompt, use a for loop with 'for %f in (*.y4m) do ffmpeg -i "%f" -c:v rawvideo "normalized_%f"'. This is particularly useful for normalizing a batch of Y4M intermediates before a multi-pass encoding job.
The YUV4MPEG2 specification does not define an audio container structure, so Y4M files carry no audio track. FFmpeg's Y4M muxer and demuxer are video-only, which is why the command contains no audio flags. If your source content has audio, it must be stored in a separate file (e.g., WAV or FLAC) alongside the Y4M and recombined during the final encode into a container like MKV or MP4.

Technical Notes

Y4M (YUV4MPEG2) files are defined by a plain-text stream header beginning with 'YUV4MPEG2' followed by parameters for width (W), height (H), frame rate (F as a ratio), interlacing (I), and chroma subsampling (C). Each frame is preceded by a 'FRAME' marker and optional per-frame headers. FFmpeg's Y4M muxer writes a strictly standards-compliant header and will regenerate the frame rate as an integer ratio, which occasionally differs from a source file's representation (e.g., 30000:1001 for 29.97fps). The rawvideo codec used here performs no pixel format conversion — it reads and writes the YUV data verbatim as a contiguous byte stream, preserving bit depth (8-bit or 10-bit depending on the pixel format, though FFmpeg's Y4M muxer has limited 10-bit support). Y4M does not support transparency, subtitles, chapters, multiple audio tracks, or any form of metadata beyond the stream and frame headers. File sizes are very large by nature: a 4:2:0 Y4M at 1080p24 consumes approximately 1.49 bytes per pixel per frame, totalling roughly 2.9 GB per minute. This makes Y4M unsuitable for long-term storage or distribution, and it is best used as a short-lived intermediate format within an encoding pipeline.

Related Tools