From MultimediaWiki
Revision as of 14:45, 3 June 2006 by Multimedia Mike (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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