h264等格式转码的常识

1、宏块匹配像素精度: MPEG2中,运动估计的精度是1/2的像素,通过线性插值实现(可能有简单修正);   H264和MPEG4 都可以支持1/4像素的精度

2、参考帧的数量:MPEG2,MPEG4的P帧只能有一帧参考帧,B帧可以有两帧参考帧 ;H.264可以最多有15帧参考帧,一般情况下选择3-5帧作为参考帧。

3、滤波器的结构插值滤波器不同,在MPEG4里面是简单的线性插值,而H264里面是5抽头的滤波器;MPEG2没有环内deblocking工具,MPEG4有deblocking工具,但是属于postprocessing;  H264有环内deblocking工具 。

4、I帧的编码:    MPEG2没有INTRA预测,但是有DC参数预测;MPEG4没有INTRA预测,支持DC预测,并且支持两个AC参数的预测。H264支持INTRA预测,4*4共有9种模式。 

5、匹配宏块大小的区别:MPEG2最小匹配块尺寸为8*8,MPEG4同样也为8*8,H.264最小可以到4*4尺寸。

6、DCT变换的不同:MPEG系列为8*8的DCT变换,逆变换时会出现漂移现象;H264为整数4*4的DCT变换,而且直流系数经过HADMARD变换之后做的DCT变换,整数DCT变换可以防止逆变换时出现漂移现象。

7、量化之后的编码:MPEG2/MPEG4则都是基于huffman,并且头部的语法相对比较简单,很少使用变长码; H264提供基于上下文的CAVLC和CABAC 。

8、 编码之后的结构:MPEG2/MPEG4都是分层结构;H264则是提供NAL单层结构,提供参数集合的形式。

9、量化参数的区别:MPEG4提供31个量化参数(量化模式:常量化,系统默认量化矩阵,自定义量化矩阵),H264提供51个量化参数(量化模式:常量化,量化矩阵,自定义有否还不确定);

关于视频编码I P B帧存储

假设从摄像头采集,采集顺序 1 2 3 4 5 ,最终编码结果是:1编码成I帧,2,3,4编码成B帧,5编码成P帧。
让我们来看下编码,存储以及解码,显示的具体步骤:

视频帧采集后,经过编码器encode以及mux成容器格式,编码和存储过程如下:

编码:
1)先编码 1,编成I帧
2)2,3,4准备编码成b帧,先缓存下来,记录下采集的时间点,后续作为pts基准
3)再编码 5,编成P帧,(注意5虽然先编码,dts相对2,3,4靠前,但是它的采集时间比2,3,4要晚,所以pts大于2,3,4)
4)编码 2, 3, 4 ,编成B帧

编码后立即经过mux写文件,所以存储顺序和编码顺序是一致的,编码后的顺序为(dts顺序)
1 5 2 3 4
I P B B B
视频保存下来后,如果通过player播放,需要解码和渲染,解码和显示的过程如下:
解码:(按照dts顺序)
1 5(参考1) 2(参考1,5) 3(参考1,5) 4(参考1,5)

解码后重新排序(按照pts),显示
1 2 3 4 5

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OpenH264 是思科公司发布的一个开源的 H.264 编码和解码器。编码器特性Constrained Baseline Profile up to Level 5.2 (4096x2304)Arbitrary resolution, not constrained to multiples of 16x16Rate control with adaptive quantization, or constant quantizationSlice options: 1 slice per frame, N slices per frame, N macroblocks per slice, or N bytes per sliceMultiple threads automatically used for multiple slicesTemporal scalability up to 4 layers in a dyadic hierarchySpatial simulcast up to 4 resolutions from a single inputLong Term Reference (LTR) framesMemory Management Control Operation (MMCO)Reference picture list modificationSingle reference frame for inter predictionMultiple reference frames when using LTR and/or 3-4 temporal layersPeriodic and on-demand Instantaneous Decoder Refresh (IDR) frame insertionDynamic changes to bit rate, frame rate, and resolutionAnnex B byte stream outputYUV 4:2:0 planar input解码器特性Constrained Baseline Profile up to Level 5.2 (4096x2304)Arbitrary resolution, not constrained to multiples of 16x16Single thread for all slicesLong Term Reference (LTR) framesMemory Management Control Operation (MMCO)Reference picture list modificationMultiple reference frames when specified in Sequence Parameter Set (SPS)Annex B byte stream inputYUV 4:2:0 planar output支持的操作系统Windows 64-bit and 32-bit (initial release is only 32-bit, 64-bit will follow soon)Mac OS X 64-bit (initial release does not include this target, will follow soon)Linux 64-bit and 32-bit (initial release is only 32-bit, 64-bit will follow soon)Android 32-bit (initial release does not include this target, will follow soon)iOS 64-bit and 32-bit (not supported yet, may be added in the future)支持的处理器Intel x86 optionally with MMX/SSE (no AVX yet, help is welcome)ARMv7 optionally with NEON (initial release does not include this target, will follow later)Any architecture using C/C fallback functions 标签:OpenH264

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值