YUV4MPEG2: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
No edit summary
 
m (Update samples link)
Line 1: Line 1:
* Extension: .y4m
* Extension: .y4m
* Samples: http://www.mplayerhq.hu/MPlayer/samples/yuv4mpeg2/
* Samples: http://samples.mplayerhq.hu/yuv4mpeg2/


YUV4MPEG2 is a simple file format designed to hold uncompressed frames of [[YUV]] video formatted as [[YUV 4:2:0]] data for the purpose of encoding, likely to [[MPEG]]-2.
YUV4MPEG2 is a simple file format designed to hold uncompressed frames of [[YUV]] video formatted as [[YUV 4:2:0]] data for the purpose of encoding, likely to [[MPEG]]-2.

Revision as of 20:30, 19 August 2006

YUV4MPEG2 is a simple file format designed to hold uncompressed frames of YUV video formatted as YUV 4:2:0 data for the purpose of encoding, likely to MPEG-2.

Data Format

A Y4M file begins with a plaintext, quasi-freeform header. The first 9 bytes comprise a file signature of 'YUV4MPEG2' followed by a space (ASCII 0x20). Following the signature is any number of parameters separated by a space (ASCII 0x20). The parameters that should definitely be present are width, height, and frame rate:

  • frame width: 'W' followed by a plaintext integer; example: 'W720'
  • frame height: 'H' followed by a plaintext integer; example: 'H480'
  • frame rate: 'F' followed by the number of frames per second, a colon, and a 1 (need more information on this one --Multimedia Mike); example: 'F30:1'

Other parameters include:

  • interlacing: 'I' followed by a p to denote progressive scan (what indicates interlaced? 'i'? Are there any other modes? --Multimedia Mike); example: 'Ip'
  • Parameter 'A': Unknown; perhaps aspect ratio? example: 'A0:0'

Following the header is any number of frames coded in YUV 4:2:0 format in Y-U-V plane order. Each frame begins with the 5 bytes 'FRAME' followed by a sixth byte of 0x0A. The length of each frame can be computed as:

 frame length = width * height * 3 / 2