03 libx264

x264

h.264

specific

reference:https://www.videoproc.com/resource/h264-codec.htm

  • I-frame contains the complete information of the image, it is coded independently of other non-I-frame pictures.
  • P-frame contains differences relative to preceding frames.
  • B-frame contains differences relative to both preceding and following frames.
  • GOP (Group of Pictures) is made of I, P, B frames starting with I frame. A typical structure could be IBBPBBPBBI or IBBPBBPBBPBBI. The more frames between I-frames, the longer the GOP.
帧内帧间预测

帧内内预测,264新增加。
帧间预测,早期版本有,264支持9个方向,4种分块模式(16x16,16x8,8x16,8x8)。

运动估计、运动补偿

运动估计,帧被分离到宏块中,在帧内寻找最比配的像素块。
运动补偿,当前宏块与运动估计的差值

转换与量化

利用DCT与量化,保留高频信号。

去块滤波

解决各种压缩过程种使用宏块为单元,造成块间出现可察觉变化。

熵编码

H264使用CABAC将二进制算数编码

裸流

使用NALU格式,

+--------------------------+------------------------------------------+
|       NAL header         |    RBSP                                  |
+--------------------------+------------------------------------------+

x264

use the ffmpeg to generate the x264 stream.

#mp4 to 264
//带了帧率
ffmpeg -i yourvideoname.mp4 -c:v libx264 outputfilename.264
//不带帧率
x264 test1.mp4 -o test4.264
ffmpeg -i test.mp4 -an -vcodec libx264 -crf 23 test.264

#  264 to mp4
ffmpeg -framerate 24 -i input.264 -c copy output.mp4
x264 raw_stream.264 -o playable_video.mp4
profile
name名称8x8dctcqmbframescabacweightpinterlaced
1baseline基线noflat0no0no
2main主要noflat不限不限不限不限
3high不限不限不限不限不限不限
4high10高10位不限不限不限不限不限不限
  • cqm: 自定义量化矩阵(custom quantization matrices), 默认有flat 和 JVT
  • weightp: 使用加权预测,模式越高越慢。
  • cabac: 弹性二进制编码
  • interlaced: 隔行扫描
preset
name名称b-adaptbframesdirectmemerangepartitionsrc-lookaheadrefsubmetrellisweightpother
ultrafast极快00dianone01000no-8x8dct , aq-mode0 , no-cabac , no-deblock, no-mbtree, no-mixed-refs , scenecut0 , no-weightb
superfast超快diai8x8,i4x401101no-mixed-refsno-mbtree
veryfast很快101201no-mixed-refs
faster较快20241no-mixed-refs
fast30261
medium
slow2autoumh5058
slower较慢2autoumhall60892
veryslow很慢28autoumh24all6016102
placebo216autotesa24all6016112slow-firstpass , no-fast-pskip
  • b-adapt 设置弹性B帧位置决策算法。
  • bframe: B在IP之间数量
  • direct:动态预测模式
  • merange: 运动估计最大范围,单位i像素
  • partitions:宏块大小
  • rc-lookahead: mb-tree使用帧数。
  • subme:像素估算复杂度
  • trellis:执行trellis quantization提高效率
tune
name名称refbframesdeblockpsy-rdaq-strengthother
1film电影-1:-1:0.15
2animation动画{Double if >1 else 1}{+2}1:10.4:0.6
3grain颗粒-2:-2:0.250.5no-dct-decimate deadzone-inter6 deadzone-intra6 ipratio1.1 pbratio1.1 qcomp0.8
4stillimage静态图像-3:-32.0:0.71.2
5psnrPSNR测试noaq-mode0
6ssimSSIM测试noaq-mode2
7fastdecode快速解码nono-cabac no-weightb weightp0
8zerolatency零延迟0force-cfr no-mbtree sync-lookahead0 sliced-threads rc-lookahead0
  • ref: 控制解码图片缓冲,P可以向前参考多少帧
  • psy-rd: psy-RDO, psy-Trellis强度
  • aq-strength:弹性量化强度

VP8

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我在长沙玩技术

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值