Does anybody know YUV:4:2:0 file format? I mean how a video is stored in a file with this format (in detail).
4 Answers
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.

- 25,026
- 7
- 51
- 83
-
2Thanks, but there is a file format ".yuv" i mean how video store in this file – shahryar Mar 04 '11 at 13:35
-
7The .yuv file format is a convention - you can't be sure what does contain! It is not an 'official' file format like .avi. However, most of the time, a .yuv file will contain a series of yuv images, one after the other, so it will be a raw video file. These are headerless, so there will be no info on the resolution of the yuv images or the fps of the video. So if you have some YUV images, just write them one after the other in the same file and tada, you'll have a YUV video! Concerning the YUV images, most of the time you will have 4:2:0 images with the format mentioned in wikipedia. – Serafeim May 09 '11 at 13:09
-
@Serafeim that should be the answer! The thing is - even though it's obviously not a container like MPEG or AVI, there's no definitive (even short) description of how is data stored in .yuv files when you start looking for test video sequences (which are usually provided in the form of these .yuv files). – peetonn Mar 17 '16 at 20:45
-
@peetonn been there, done that :( I remember the difficulties I had experienced while trying to read these YUV files with test sequences ... Just remembering the foreman (https://media.xiph.org/video/derf/thumbnails/foreman_cif-0001.jpg) gives me the creeps! – Serafeim Mar 17 '16 at 21:12
-
3VLC supports a yuv format, regardless of it's a specific file format or not. That's clearly what the OP intended to ask about. – Joey Carson Jun 19 '16 at 00:47
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.

- 1,910
- 1
- 22
- 22

- 1,175
- 3
- 20
- 46
-
3Please, try to read this http://stackoverflow.com/help/deleted-answers, to get more understanding how to **not** answer. Namely: "Answers that do not fundamentally answer the question": **barely more than a link to an external site** – Radim Köhler Nov 14 '13 at 07:52
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).

- 518
- 1
- 3
- 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.

- 2,144
- 21
- 30

- 17
- 1
-
doest it store any metadata (i.e. resolution)? are there any separators between frames or they just go adjacent to each other? – peetonn Mar 17 '16 at 20:43
-
No! That is the whole point. But in y4m there is only one addition: header with precisely that. No separator. – Валерий Заподовников Apr 16 '22 at 14:06