Y4M file format (.y4m)
Uncompressed YUV4MPEG2, used for codec testing.
Last updated
What is a Y4M file?
In short: A Y4M file (.y4m) is a video file in the Y4M format. Y4M is raw uncompressed video with a one-line text header saying the resolution, frame rate and colour layout, then every frame in full. It can be converted to MP4, MOV or GIF for free in a web browser with iHateFiles, without uploading it.
YUV4MPEG2, a simple wrapper used by the MPEG and Xiph tools for passing raw frames between programs.
Y4M is raw uncompressed video with a one-line text header saying the resolution, frame rate and colour layout, then every frame in full. It exists so codec developers can compare encoders on identical input, and it is enormous by design.
What Y4M is good at
- Completely uncompressed, so nothing confounds a comparison
- Trivial for a program to read or write
- The standard input format for codec benchmarking
Where Y4M falls short
- Gigabytes per minute
- No audio
- No player treats it as a normal video file
When to use Y4M
Convert Y4M to MP4 the moment you want to watch rather than measure.
How to open a Y4M file
FFmpeg, codec development tools, and VLC.
| Windows | VLC, or any codec test tool. It is raw uncompressed frames, so a few seconds can run to gigabytes. |
|---|---|
| macOS | VLC or mpv. |
| Linux | mpv, FFmpeg and every encoder development tool read it natively — this is where it belongs. |
| Phone | Not practical on a phone. |
| In a browser | No browser plays Y4M. |
The thing that usually goes wrong
A few seconds of Y4M can be larger than a whole film in MP4. That is the format doing its job.
Inside a Y4M file
YUV4MPEG2 is not really a video format so much as an agreement about how to write raw frames to a pipe. Each file is a short plain-text header, then the word FRAME before every picture, then the uncompressed samples. You can read the header in a text editor.
It exists because codec developers need an input that has been through no encoder at all. If you are measuring whether AV1 beats VP9, any compression on the source contaminates the result. Y4M is the lossless, uncompressed common ground, which is why every encoder test harness and every FFmpeg pipeline uses it internally.
The consequence is size. A minute of 1080p at 30fps in 4:2:0 is roughly 5.5 GB, uncompressed and unapologetic. Y4M is a working format for a pipeline stage, never a delivery format, and converting one to anything else is nearly always the right move.
| Full name | YUV4MPEG2 |
|---|---|
| Header | Plain ASCII, beginning YUV4MPEG2 |
| Compression | None whatsoever |
| Chroma | 4:2:0, 4:2:2, 4:4:4, mono |
| Audio | Cannot carry any |
| Typical size | ~5.5 GB per minute at 1080p30 4:2:0 |
Questions
What is a Y4M file?
Uncompressed YUV4MPEG2, used for codec testing. Files use the .y4m extension.
How do I open a Y4M file?
Y4M is not widely supported any more. The reliable route is to convert it to a current format, which this page can do in your browser without uploading it.
Can I convert Y4M for free?
Yes. Every conversion here is free and unlimited, because your own device does the work rather than a server we have to pay for.
Is Y4M lossless?
That depends on the codec inside the container rather than the container itself. Everything written here is re-encoded, so expect one generation of loss.