Intel Media SDK H264 encoder GOP setting
1 I帧,P帧,B帧,IDR帧,NAL单元
I frame:帧内编码帧,又称intra picture,I 帧通常是每个 GOP(MPEG 所使用的一种视频压缩技术)的第一个帧,经过适度地压缩,做为随机访问的参考点,可以当成图象。I帧可以看成是一个图像经过压缩后的产物;
P frame: 前向预测编码帧,又称predictive-frame,通过充分将低于图像序列中前面已编码帧的时间冗余信息来压缩传输数据量的编码图像,也叫预测帧;
B frame: 双向预测内插编码帧,又称bi-directional interpolated prediction frame,既考虑与源图像序列前面已编码帧,也顾及源图像序列后面已编码帧之间的时间冗余信息来压缩传输数据量的编码图像,也叫双向预测帧;
IDR frame:I和IDR帧都是使用帧内预测的,在编码和解码中为了方便,要首个I帧和其他I帧区别开,把第一个I帧叫IDR,这样就方便控制编码和解码流程,所以IDR帧一定是I帧,但I帧不一定是IDR帧;IDR帧的作用是立刻刷新,使错误不致传播,从IDR帧开始,重新算一个新的序列开始编码。
NAL单元:全称Network Abstract Layer,即网络抽象层,在H.264/AVC视频编码标准中,整个系统框架被分为了两个层面:视频编码层面(VCL)和网络抽象层面(NAL)。其中,前者负责有效表示视频数据的内容,而后者则负责格式化数据并提供头信息,以保证数据适合各种信道和存储介质上的传输。因此我们平时的每帧数据就是一个NAL单元(SPS与PPS除外)。在实际的H264数据帧中,往往帧前面带有00 00 00 01 或 00 00 01分隔符,一般来说编码器编出的首帧数据为PPS与SPS,接着为I帧。
2 GOP(Group of pictures)
所谓GOP,意思是画面组,一个GOP就是一组连续的画面。GOP结构一般涉及两个数字,例如,M=3,N=12。第一个数字M指定I帧和P帧之间的距离,第二个数字N指定两个I帧之间的距离:及画面组的大小。对于上面的例子M=3,N=12,GOP结构表示为:IBBPBBPBBPBBI。在一个GOP内I frame的解码不依赖于任何的其它帧,而p frame的解码则依赖于其前面的I frame或者P frame,B frame的解码则依赖于其前的最近的一个I frame或者P frame 及其后的最近的一个P frame。
3 H264 encoder GOP setting
Intel Media SDK Encoding Sample 用法如下
sample_encode.exe h264 -i video.yuv -w 640 -h 480 -o out.mkv -hw -d3d -mkv -b 1000 -f 30
sample_encode.exe h264 -i video.yuv -w 640 -h 480 -o out.mp4 -hw -d3d -mux -b 1000 -f 30
编码参数包括:输入格式、帧速率、输出比特率、输入视频流宽高、输出视频流宽高等等。这里我们发现,比没有设置I、B、P帧信息的相关参数,也就是说Demo中并没有开发这样的参数设置。通过查看Intel Media SDK的Guide,发现Intel有提供这样的参数让我们可以调整I、B、P的构成,具体就是GopOptFlag:
GopOptFlag
Description
The GopOptFlag enumerator itemizes special properties in the GOP (Group of Pictures) sequence.
Name/Description
MFX_GOP_CLOSED
B-frames of the first B-interval can never reference the previous GOP
MFX_GOP_STRICT
The encoder must strictly follow the given GOP structure as defined by parameter GopPicSize,
GopRefDist etc in the mfxVideoParam structure. Otherwise, the encoder can adapt the GOP structure
for better efficiency, whose range is constrained by parameter GopPicSize and GopRefDist etc
而GopOptFlag所在的位置是:
mfxVideoParam -> mfxInfoMFX -> GopOptFlag
此外还需要利用到的相关参数可以参考mfxInfoMFX的说明,主要包括:
mfxU16 GopPicSize;
mfxU16 GopRefDist;
mfxU16 GopOptFlag;
mfxU16 IdrInterval;
GopPicSize
Number of pictures within the current GOP (Group of Pictures); if GopPicSize=0, then the GOP size is unspecified.
If GopPicSize=1, only I-frames are used.
当前GOP中画面的个数,若GopPicSize=0,则认为GOP尺寸未指定,若GopPicSize=1,则将只使用I帧
GopRefDist
Distance between I- or P- key frames; if it is zero, the GOP structure is unspecified. Note:
If GopRefDist = 1, there are no B-frames used.
I或P关键帧之间的距离;若为零,则认为GOP结构未指定,若GopRefDist=1,则将不使用B帧
GopOptFlag
ORs of the GopOptFlag enumerator indicate the additional flags for the GOP specification;
IdrInterval
the sequence header before every Nth I-frame. If IdrInterval=0(default), SDK inserts the sequence header once at the beginning of the stream
对于H264,IdrInterval指定了IDR帧的间隔,单位为I帧;若IdrInterval=0,则每个I帧均为IDR帧。若IdrInterval=1,则每隔一个I帧为IDR帧,以此类推。对于
MPEG2, IdrInterval定义了序列头间隔,单位为I帧,若IdrInterval=N,SDK将在每第N个I帧之前插入序列头;若IdrInterval=0(默认),SDK将在流开头一次
性插入序列头。
举例说明下:

图 1

图 2

图 3
以上图1和图2中红色表示I帧蓝色表示P帧绿色表示B帧,其中图2和图3是同一个H264文件,图3可体现IdrInterval = 1的作用,即两个Idr帧间隔一个I帧,所以也可以把IDR帧看做是SPS和PPS后面第一个I帧!
参考:
http://www.cnblogs.com/cslunatic/p/3565984.html
http://en.wikipedia.org/wiki/Group_of_pictures
http://blog.csdn.net/jtujtujtu/article/details/6565287
Intel Media SDK H264 encoder GOP setting的更多相关文章
- (转)Integrating Intel® Media SDK with FFmpeg for mux/demuxing and audio encode/decode usages 1
Download Article and Source Code Download Integrating Intel® Media SDK with FFmpeg for mux/demuxing ...
- Getting Started with the Intel Media SDK
By Gael Hofemeier on March 19, 2015 Follow Gael on Twitter: @GaelHof Media SDK Developer’s Guide Med ...
- Intel® Media SDK Media Samples Linux 学习笔记(转)
最近折腾intel media sdk,主要硬件平台是在HD4600的核显上进行测试,intel media sdk是intel提供的一种基于核显的硬件编解码的解决方案,之前已经有使用ffmpeg进行 ...
- Intel® Media SDK(一)
A cross-platform API for developing media applications on Windows* Fast video playback, encode, proc ...
- Intel Media SDK安装步骤
!!!(gcc/g++版本要在4.8以上,本人使用的是5.4版本) 要先安装依赖,按以下步骤依次执行 1.LIBVA git clone https://github.com/intel/libva. ...
- Intel Media SDK 性能測试
经过測试,发如今windows 7上 i3 i5 上Intel Media SDK 1080P仅仅能解6路,720P仅仅能解8路, 不知大家有没有測试过?
- 微软商店一直安装不上Intel Media SDK DFP
具体表现为一直安装失败,但是下载进度条一直在,无法去除. 此方法来自 https://answers.microsoft.com/en-us/windows/forum/all/error-code- ...
- How to run Media SDK samples on Skylake【转载】
In the last few days, we have seen lot of concern for using Intel® Media 2016 on 6th generation Inte ...
- Intel® Media Server Studio Support
复制自网址:https://software.intel.com/en-us/intel-media-server-studio-support/code-samples Code Samples M ...
随机推荐
- 【AR实验室】ARToolKit之Example篇
0x00 - 前言 PS : 我突然意识到ARToolKit本质可能就是一个可以实时求解相机内外参的解决方案. 拿到一个新的SDK,90%的人应该都会先跑一下Example.拿到ARToolKit的S ...
- Virtual Box配置CentOS7网络(图文教程)
之前很多次安装CentOS7虚拟机,每次配置网络在网上找教程,今天总结一下,全图文配置,方便以后查看. Virtual Box可选的网络接入方式包括: NAT 网络地址转换模式(NAT,Network ...
- DynamicObject - 代理对象的种类
开箱即用,DynamicProxy提供了多种代理对象,主要分成两个大类: 基于继承(Inheritance-based) 基于继承的代理是通过继承一个代理类来实现,代理拦截对类的虚(virtual)成 ...
- JavaScript的继承实现方式
1.使用call或apply方法,将父对象的构造函数绑定在子对象上 function A(){ this.name = 'json'; } function B(){ A.call(this); } ...
- Mybatis XML配置
Mybatis常用带有禁用缓存的XML配置 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE ...
- Java获取本机的IP与MAC地址
有些机器有许多虚拟的网卡,获取IP地址时会出现一些意外,所以需要一些验证: // 获取mac地址 public static String getMacAddress() { try { Enumer ...
- 【SAP业务模式】之ICS(二):基础数据
讲完业务,计划在前台做一下ICS的基本操作,不过在操作之前,得先建立好基本的基础数据. 1.首先创建接单公司LEON,对应工厂是ADA: 2.创建生产公司MXPL,对应工厂是PL01: 3.创建接单公 ...
- 我的MYSQL学习心得(七) 查询
我的MYSQL学习心得(七) 查询 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据类 ...
- Xamarin.Android通知详解
一.发送通知的机制 在日常的app应用中经常需要使用通知,因为服务.广播后台活动如果有事件需要通知用户,则需要通过通知栏显示,而在Xamarin.Android下的通知需要获取Notification ...
- 打造TypeScript的Visual Studio Code开发环境
打造TypeScript的Visual Studio Code开发环境 本文转自:https://zhuanlan.zhihu.com/p/21611724 作者: 2gua TypeScript是由 ...