我一直疑问为什么有些视频解码时显示格式是:H264,大部分又是:AVC1

我在搜索编程资料时在微软的msdn上发现的:

原文:http://msdn.microsoft.com/en-us/library/dd757808(v=vs.85).aspx

FOURCC:AVC1   描写叙述:H.264 bitstream without start codes.

FOURCC:H264   描写叙述:H.264 bitstream with start codes.





H.264 Bitstream with Start Codes



H.264 bitstreams that are transmitted over the air, or contained in MPEG-2 program or transport streams, or recorded on HD-DVD, are formatted as described in Annex B of ITU-T Rec. H.264. According to this specification, the
bitstream consists of a sequence of network abstraction layer units (NALUs), each of which is prefixed with a start code equal to 0x000001 or 0x00000001.

这段话的大致意思是:带有開始码的H.264视频通常是用于无线发射、有线广播或者HD-DVD中的。这些数据流的開始都有一个開始码:0x000001 或者 0x00000001.





H.264 Bitstream Without Start Codes



The MP4 container format stores H.264 data without start codes. Instead, each NALU is prefixed by a length field, which gives the length of the NALU in bytes. The size of the length field can vary, but is typically 1, 2, or
4 bytes.

这段话的大致意思是:没有開始码的H.264视频主要是存储在MP4格式的文件里的。它的数据流的開始是1、2或者4个字节表示长度数据。

原文中的"NALU"简单说是H.264格式中的最主要的单元,是一个数据包。

H.264 Video Types

The following media subtypes are defined for H.264 video.

Subtype FOURCC Description
MEDIASUBTYPE_AVC1 'AVC1' H.264 bitstream without start codes.
MEDIASUBTYPE_H264 'H264' H.264 bitstream with start codes.
MEDIASUBTYPE_h264 'h264' Equivalent to MEDIASUBTYPE_H264, with a different FOURCC.
MEDIASUBTYPE_X264 'X264' Equivalent to MEDIASUBTYPE_H264, with a different FOURCC.
MEDIASUBTYPE_x264 'x264' Equivalent to MEDIASUBTYPE_H264, with a different FOURCC.

The main difference between these media types is the presence of startcodes in the bitstream. If the subtype is MEDIASUBTYPE_AVC1, thebitstream does not contain start codes.

H.264 Bitstream Without Start Codes

The MP4 container format stores H.264 data without start codes.Instead, each NALU is prefixed by a length field, which gives thelength of the NALU in bytes. The size of the length field can vary, butis typically 1, 2, or 4 bytes.

When start codes are not present in the bitstream, the following media type is used.

Major type MEDIATYPE_Video
Subtype MEDIASUBTYPE_AVC1
Format type FORMAT_MPEG2Video

The format block is an MPEG2VIDEOINFO structure. This structure should be filled in as follows:

  • hdr: A VIDEOINFOHEADER2 structure that describes the bitstream. No color table is present
    after theBITMAPINFOHEADER portion of the structure, and biClrUsed must be zero.
  • dwStartTimeCode: Not used. Set to zero.
  • cbSequenceHeader: The length of the dwSequenceHeader array in bytes.
  • dwProfile: Specifies the H.264 profile.
  • dwLevel: Specifies the H.264 level.
  • dwFlags: The number of bytes used for the length field that appears before each NALU. The length field indicates the size of the following NALU in bytes. For example, if dwFlags is 4, each NALU is preceded
    by a 4-byte length field. The valid values are 1, 2, and 4.
  • dwSequenceHeader: A byte array that may contain sequence parameter set (SPS) and picture parameter set (PPS) NALUs.

The MP4 container might contain sequence parameter sets (SPS) orpicture parameter sets (PPS) as special NAL units in file headers or ina separate stream (distinct from the video stream). When the format isestablished, the media type can specify SPS and PPS
NAL units in the dwSequenceHeader array. IfcbSequenceHeader is greater than zero, dwSequenceHeaderis the start of a byte array containing SPS and PPS NALUs, delimited by2-byte length fields, all in network
byte order (big-endian). It ispossible to have both SPS and PPS, only one of these types, or none.The actual type of each NALU can be determined by examining thenal_unit_type field of the NALU itself.

When this media type is used, each media sample starts at thebeginning of a NALU, and NAL units do not span samples. This enablesthe decoder to recover from data corruption or dropped samples.

H.264的视频类型



下面媒体亚型定义的H.264视频。



亚型fourcc值描写叙述

MEDIASUBTYPE_AVC1“AVC1”H.264比特流没有启动代码。

MEDIASUBTYPE_H264“H264”開始编码的H.264比特流。

MEDIASUBTYPE_h264'H264'的相当于到MEDIASUBTYPE_H264,与不同的fourcc值。

“X264的'MEDIASUBTYPE_X264的相当于到MEDIASUBTYPE_H264,与不同的fourcc值。

“X264”MEDIASUBTYPE_x264相当于到MEDIASUBTYPE_H264,用不同的fourcc值。

这些媒体类型之间的主要差别是存在的比特流中的startcodes。假设亚型是MEDIASUBTYPE_AVC1,thebitstream不包括启动代码。



H.264的码流没有启动代码

MP4容器格式存储H.264没有開始codes.Instead的数据,每一个的NALU是由前缀长度字段,从而使字节的NALU
thelength。长度字段的大小能够有所不同,butis通常为1,2,或4个字节。



当启动代码是在比特流中不存在,以下的介质类型。



主要类型MEDIATYPE_Video的

亚型MEDIASUBTYPE_AVC1

格式类型FORMAT_MPEG2Video

 



格式块是MPEG2VIDEOINFO结构。这样的结构应填写例如以下:



HDR:一个VIDEOINFOHEADER2的结构描写叙述的比特流。没有颜色表是存在的BITMAPINFOHEADER结构部分后,biClrUsed必须是零。

dwStartTimeCode:未使用。设置为零。

cbSequenceHeader的在字节dwSequenceHeader数组的长度。

dwProfile:指定H.264的个人资料。

dwLevel:指定H.264水平。

的dwFlags:用于长度字段出如今每次的NALU的字节数。长度字段表示在字节下面的NALU的大小。比如,假设dwFlags是4个,每一个的NALU之前由4个字节的长度字段。有效的值是1,2和4。

dwSequenceHeader:一个字节数组可能包括序列參数集(SPS)和图像參数集(PPS)NALUs。

MP4容器可能含有序列參数集(SPS)orpicture參数集(PPS)的文件头或INA单独的流(从视频流中不同)的特殊NAL单元。当isestablished的格式,媒体类型能够指定在dwSequenceHeader阵列SPS和PPS
NAL单元。假设cbSequenceHeader大于零,dwSequenceHeaderis含SPS和PPS的NALUs,分隔BY2字节长度字段,全部在网络字节顺序(大端)字节数组開始。它ispossible
SPS和PPS,仅仅有这些类型之中的一个,或能够通过审查的NALU本身thenal_unit_type领域确定每一个的NALU none.The实际类型。



当使用这样的媒体类型,每一个媒体样本的NALU的thebeginning開始,NAL单元不跨越样本。这enablesthe解码器来恢复数据损坏或丢弃的样品。

翻译:

技术贴:解码时AVC1和H264的差别的更多相关文章

  1. H264/AVC视频解码时AVC1和H264的区别

    AVC1与H264的区别 http://blog.csdn.net/qiuchangyong/article/details/6660253 H.264 Video Types The followi ...

  2. AVC1与H264的差别

    今天上网时偶尔发现这个在我脑海里疑惑的问题的答案. H.264 Video Types The following media subtypes are defined for H.264 video ...

  3. (转)MP4文件两种格式AVC1和H264的区别及利用FFMPEG demux为h264码流事项

    出自:http://www.mworkbox.com/wp/work/314.html 2013-05-04 MP4的视频H264封装有2种格式:h264和avc1,对于这个细节,很容易被忽略.笔者也 ...

  4. 与其争论java和.net的差别,还不如多想点用编程技术挣钱的方式

    年前和最近,我发现在博客园和其它地方,有不少争论java和.net哪个好的文章,其实这是种好现象.虽然到了架构层面,技术是通用的,但兼听则明,而且技多不压身,多种挣钱的方式总不会错. 本人最近主攻Ja ...

  5. 【FFMPEG】各种音视频编解码学习详解 h264 ,mpeg4 ,aac 等所有音视频格式

    目录(?)[-] 编解码学习笔记二codec类型 编解码学习笔记三Mpeg系列Mpeg 1和Mpeg 2 编解码学习笔记四Mpeg系列Mpeg 4 编解码学习笔记五Mpeg系列AAC音频 编解码学习笔 ...

  6. 收藏的技术文章链接(ubuntu,python,android等)

    我的收藏 他山之石,可以攻玉 转载请注明出处:https://ahangchen.gitbooks.io/windy-afternoon/content/ 开发过程中收藏在Chrome书签栏里的技术文 ...

  7. CPU纯软件全虚拟化技术

    我们在前面的文章中提到了虚拟化技术的大致分类情况,即分为全虚拟化.半虚拟化和硬件辅助虚拟化3大类.而我们虚拟化技术最主要的虚拟主体就是我们的硬件CPU.内存和IO,那么我们的CPU在全虚拟化模式下如何 ...

  8. 对于Java培训出身的同学,接下来该怎么学习技术?

    首先恭喜从培训班出来找到工作的同学,确实挺不容易的,4个月的培训,每天从早上9点到晚上9点,也是996,主要的活动地方就是宿舍和教室, 让我现在也去培训,我估计还熬不下来. 尤其是对于从小白开始的同学 ...

  9. 集显也能硬件编码:Intel SDK && 各种音视频编解码学习详解

    http://blog.sina.com.cn/s/blog_4155bb1d0100soq9.html INTEL MEDIA SDK是INTEL推出的基于其内建显示核心的编解码技术,我们在播放高清 ...

随机推荐

  1. iOS开发笔记 基于wsdl2objc调用asp.net WebService

    1.准备 先下载待会要用到的工具 WSDL2ObjC-0.6.zip WSDL2ObjC-0.7-pre1.zip 我用的是WSDL2ObjC-0.6.zip 1.1搭建asp.net WebServ ...

  2. c#软件工程师笔试题

    近来有打算重新找工作,还没提离职,投了几家公司简历,其中一家比较中意的公司给发了面试题,其实,好像是好几天前的事了,主要是Gmail邮箱很少用,所以一直都没去看,今天看到题目给解了. 题目如下: 题目 ...

  3. iOS 纯代码适配iPhone6,6+

    链接地址:http://blog.csdn.net/codywangziham01/article/details/37658399 转自:http://www.maxiaoguo.com/cloth ...

  4. c++ primer plus 习题答案(8)

    p475.2 //头文件: class Cd{ private: char *performers; char *label; int selections; double playtime; pub ...

  5. C-重定向

    说实话,第一次接触重定向这一个概念,感觉是那么的神奇简洁不可思议…………………… freopen() 本来应该是打开的是文件指针,但是分配了指针,使她(亲切)指向了标准输入.输出.错误流. 用 法: ...

  6. Stack trace对性能的影响

    package ceshi; public class ExceptionTest { public long maxLevel = 20; public static void main(Strin ...

  7. chrome dev tools

    chrome dev tools介绍一下Chrome dev tools 的基本使用和一些意想不到的小技巧.\\Chrome Developer Tools 是Chrome内嵌的一系列编辑和调试的工具 ...

  8. Codecs是以plugin的形式被调用的(显示中文的codec plugin文件是qcncodecs4.dll),可静态载入和动态载入

    作为非英语国家人员开发的类库,QT有充分的理由优先考虑支持Unicode和各国自定义字库编码.大家也知道了QT对软件Internationalization有一套完整的开发模型,包括专门为此写的lin ...

  9. HDU 3571 N-dimensional Sphere

    高斯消元,今天数学死了无数次…… #include <cstdio> #include <cstring> #include <cmath> #include &l ...

  10. In Action(最短路+01背包)

    In Action Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...