shahryar
shahryar

Reputation: 89

YUV file format

Does anybody know YUV:4:2:0 file format? I mean how a video is stored in a file with this format (in detail).

Upvotes: 7

Views: 33754

Answers (4)

Gregor Hartl Watters
Gregor Hartl Watters

Reputation: 606

I think you would be looking for the "YUV4MPEG2" file format (extension: '.y4m').

It has a very short header (about 40 bytes), followed by the raw bytes for each YCbCr image (either in 4:4:4, 4:2:2 or 4:2:0 format). Each separate frame starts with the ascii string 'FRAME'.

You can find details on what to include in the header here.

It is, by far, one of the simplest video formats out there. The downside is that, clearly, since it is uncompressed, video sizes rapidly climb into the gigabyte range. It is usually used as a precursor to other common video formats, such as .mp4. You can convert a .y4m to a .mp4 using ffmpeg.

You can play .y4m files directly in VLC Player (there are a few other players, too, but I can't name them off the top of my head).

Upvotes: 1

Hamed
Hamed

Reputation: 1213

Here you can find scripts for manipulating YCbCr (also known as 'YUV') sequences.

http://www.sprljan.com/nikola/matlab.html

Take a look at yuv_export.m and yuv_import.m to see how these files are stored.

Upvotes: 1

Sanjay Kumar Dwivedi
Sanjay Kumar Dwivedi

Reputation: 17

YUV is a file extension for a raster graphics file often associated with the Color Space Pixel Format. YUV files contain bitmap image data stored in the YUV format, which splits color across Y, U, and V values. It stores the brightness (luminance) as the Y value, and the color (chrominance) as U and V values. YUV files can be opened and converted using xnView.

Upvotes: 0

Nick
Nick

Reputation: 25799

YUV 4:2:0 isn't a file format its a video data format specifying the ratio between the Y, the U and the V components per pixel. You would typically store such data in a container format such as AVI or MOV.

Have a look at Wikipedia for a description of YUV. A file of YUV will just be a sequential collection of YUV frames.

Upvotes: 7

Related Questions