y4m格式解析

YUV4MPEG2格式

YUV4MPEG2格式是一种未压缩的视频文件格式,由文件头和各个帧的数据组成,每帧数据是YCbCr420,YCbCr422或YCbCr444格式。下图是y4m格式文件的结构。

 

数据格式

文件头:文件头是以明文形式存储的,前10个字节为固定的"YUV4MPEG2 "第十个字节为空格(ASCII 0x20)。紧接着是各个参数,以空格分割(ASCII 0x20)。然后文件头尾部是一个换行(ASCII 0x0A)。

文件头的参数如下:

  • 帧宽:'W'后跟明文整数,如'W720'表示帧宽为720

  • 帧高:'H'后跟明文整数,如'H480'表示帧高为480

  • 帧率:'F'后跟以':'分隔的两个明文整数

    • 'F30:1' = 30fps

    • 'F25:1' = 25 FPS (PAL/SECAM standard)

    • 'F24:1' = 24 FPS (Film)

    • 'F30000:1001' = 29.97 FPS (NTSC standard)

    • 'F24000:1001' = 23.976 FPS (Film transferred to NTSC)

  • 交错方式:'I'后跟一个单字符

    • 'Ip' = Progressive

    • 'It' = Top field first

    • 'Ib' = Bottom field first

    • 'Im' = Mixed modes (detailed in FRAME headers)

  • 参数'A':表示像素宽高比(注意不是图像宽高比)

    • 'A0:0' = unknown

    • 'A1:1' = square pixels

    • 'A4:3' = NTSC-SVCD (480x480 stretched to 4:3 screen)

    • 'A4:5' = NTSC-DVD narrow-screen (720x480 compressed to a 4:3 display)

    • 'A32:27' = NTSC-DVD wide-screen (720x480 stretched to a 16:9 display)

  • 参数'C':颜色空间

    • 'C420jpeg' = 4:2:0 with biaxially-displaced chroma planes

    • 'C420paldv' = 4:2:0 with vertically-displaced chroma planes

    • 'C420' = 4:2:0 with coincident chroma planes

    • 'C422' = 4:2:2

    • 'C444' = 4:4:4

  • 参数'X':被忽略,不处理

下图是一个y4m视频的格式信息。

 

Reference

感兴趣的请关注微信公众号Video Coding

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
编译好的x265,带y4m文件 Syntax: x265 [options] infile [-o] outfile infile can be YUV or Y4M outfile is raw HEVC bitstream Executable Options: -h/--help Show this help text and exit -V/--version Show version info and exit Output Options: -o/--output Bitstream output file name --log-level Logging level: none error warning info debug full. Default info --no-progress Disable CLI progress reports --[no-]cu-stats Enable logging stats about distribution of cu across all modes. Default disabled Input Options: --input Raw YUV or Y4M input file name. `-` for stdin --fps Source frame rate (float or num/denom), auto-detected if Y4M --input-res WxH Source picture size [w x h], auto-detected if Y4M -f/--frames Maximum number of frames to encode. Default all --seek First frame to encode Quality reporting metrics: --[no-]ssim Enable reporting SSIM metric scores. Default disabled --[no-]psnr Enable reporting PSNR metric scores. Default disabled Profile, Level, Tier: --profile Enforce an encode profile: main, main10, mainstillpicture --level-idc Force a minumum required decoder level (as '5.0' or '50') --[no-]high-tier If a decoder level is specified, this modifier selects High tier of that level Threading, performance: --threads Number of threads for thread pool (0: detect CPU core count, default) -F/--frame-threads Number of concurrently encoded frames. 0: auto-determined by core count --[no-]wpp Enable Wavefront Parallel Processing. Default enabled --[no-]pmode Parallel mode analysis. Default disabled --[no-]pme Parallel motion estimation. De
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值