H.264 Profile、Level、Encoder三张简图 (fps = AVCodecContext->time_base.den / AVCodecContext->time_base.num)
H.264 Profiles
Profiles are sets of capabilities. If your black box only supports the Baseline
profile it'll not be able to decode a stream using High
capabilities.
In VLC
you can set the H.264 profile to be used by the x264
encoder like this:
--sout="#transcode{vcodec=h264,venc=x264{profile=baseline}...
H.264 Levels
Think of levels as a constraint/indicator of required decoder performance. If a decoder supports a certain level for a certain profile then it must be able to decode streams at that level and any of the lower levels.
First of all, the level for 640x480 @ 30 fps is 3
and not 2.2
.
You can calculate this as following:
macrobolocks = ceil(640/16) * ceil(480/16) = 1200
macroblocks/s = macroblocks * 30 = 36000
The reason for ceil
is that non-mod16 resolution are padded to a multiple of 16.
You then take a look at the H.264 Levels. You are within the frame size limit for 2.2
which is 1620
but the max decoding speed is greater than 20252
so you have to choose the next level wich is 3
. You'll also have to consider the maximum bitrate for the Baseline
profile in that table.
If you have an Android device you can download my H.264 Calculator app from the Amazon App Store (I can send you the apk
if you don't like their Orwellian app permissions)
The x264
encoder will automatically choose a level based on your encoding parameters. With VLC
you can actually set the flag yourself using something like:
--sout="#transcode{vcodec=h264,venc=x264{profile=baseline,level=22}"...
Beware, this sets the encoder output flag and doesn't actually produce a Level 2.2
stream. You can put any values you want, so it's possible to mark a Full HD stream at 60 fps as Level 2.2
even if it's nowhere the level limits.
VLC Transcoding
If you want to make sure you're sending a correct stream you'll need to transcode the source material. This is an example for 640x480 @ 30 fps which results in a Level 3
H.264 stream like I showed you above. If you want Level 2.2
you'll need to lower the resolution or framerate or both. Your video bitrate can go lower too in that case.
cvlc input.mp4 --sout="#transcode{vcodec=h264,venc=x264{profile=baseline},fps=30,width=640,height=480,vb=1372,acodec=mpga,ab=128,channels=2,samplerate=44100}:rtp{...}
Mediainfo
Mediainfo is a great tool to get information about a media file. You can check the specs of your input files, but it won't help you detect a wrong level which was forced into or wrongfully chosen by the encoder. The safest way is to re-encode.
下面的这个表拷贝自: https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels
Levels
As the term is used in the standard, a "level" is a specified set of constraints that indicate a degree of required decoder performance for a profile. For example, a level of support within a profile specifies the maximum picture resolution, frame rate, and bit rate that a decoder may use. A decoder that conforms to a given level must be able to decode all bitstreams encoded for that level and all lower levels.
Level | Max decoding speed | Max frame size | Max video bit rate for video coding layer (VCL) kbit/s | Examples for high resolution @ highest frame rate (max stored frames) Toggle additional details
|
||||
---|---|---|---|---|---|---|---|---|
Luma samples/s | Macroblocks/s | Luma samples | Macroblocks | Baseline, Extended and Main Profiles |
High Profile | High 10 Profile | ||
1 | 380,160 | 1,485 | 25,344 | 99 | 64 | 80 | 192 |
128×96@30.9 (8)
176×144@15.0 (4) |
1b | 380,160 | 1,485 | 25,344 | 99 | 128 | 160 | 384 |
128×96@30.9 (8)
176×144@15.0 (4) |
1.1 | 768,000 | 3,000 | 101,376 | 396 | 192 | 240 | 576 |
176×144@30.3 (9)
320×240@10.0 (3) 352×288@7.5 (2) |
1.2 | 1,536,000 | 6,000 | 101,376 | 396 | 384 | 480 | 1,152 |
320×240@20.0 (7)
352×288@15.2 (6) |
1.3 | 3,041,280 | 11,880 | 101,376 | 396 | 768 | 960 | 2,304 |
320×240@36.0 (7)
352×288@30.0 (6) |
2 | 3,041,280 | 11,880 | 101,376 | 396 | 2,000 | 2,500 | 6,000 |
320×240@36.0 (7)
352×288@30.0 (6) |
2.1 | 5,068,800 | 19,800 | 202,752 | 792 | 4,000 | 5,000 | 12,000 |
352×480@30.0 (7)
352×576@25.0 (6) |
2.2 | 5,184,000 | 20,250 | 414,720 | 1,620 | 4,000 | 5,000 | 12,000 |
352×480@30.7 (12)
352×576@25.6 (10) 720×480@15.0 (6) 720×576@12.5 (5) |
3 | 10,368,000 | 40,500 | 414,720 | 1,620 | 10,000 | 12,500 | 30,000 |
352×480@61.4 (12)
352×576@51.1 (10) 720×480@30.0 (6) 720×576@25.0 (5) |
3.1 | 27,648,000 | 108,000 | 921,600 | 3,600 | 14,000 | 17,500 | 42,000 |
720×480@80.0 (13)
720×576@66.7 (11) 1,280×720@30.0 (5) |
3.2 | 55,296,000 | 216,000 | 1,310,720 | 5,120 | 20,000 | 25,000 | 60,000 |
1,280×720@60.0 (5)
1,280×1,024@42.2 (4) |
4 | 62,914,560 | 245,760 | 2,097,152 | 8,192 | 20,000 | 25,000 | 60,000 |
1,280×720@68.3 (9)
1,920×1,080@30.1 (4) 2,048×1,024@30.0 (4) |
4.1 | 62,914,560 | 245,760 | 2,097,152 | 8,192 | 50,000 | 62,500 | 150,000 |
1,280×720@68.3 (9)
1,920×1,080@30.1 (4) 2,048×1,024@30.0 (4) |
4.2 | 133,693,440 | 522,240 | 2,228,224 | 8,704 | 50,000 | 62,500 | 150,000 |
1,280×720@145.1 (9)
1,920×1,080@64.0 (4) 2,048×1,080@60.0 (4) |
5 | 150,994,944 | 589,824 | 5,652,480 | 22,080 | 135,000 | 168,750 | 405,000 |
1,920×1,080@72.3 (13)
2,048×1,024@72.0 (13) 2,048×1,080@67.8 (12) 2,560×1,920@30.7 (5) 3,672×1,536@26.7 (5) |
5.1 | 251,658,240 | 983,040 | 9,437,184 | 36,864 | 240,000 | 300,000 | 720,000 |
1,920×1,080@120.5 (16)
2,560×1,920@51.2 (9) 3,840×2,160@31.7 (5) 4,096×2,048@30.0 (5) 4,096×2,160@28.5 (5) 4,096×2,304@26.7 (5) |
5.2 | 530,841,600 | 2,073,600 | 9,437,184 | 36,864 | 240,000 | 300,000 | 720,000 |
1,920×1,080@172.0 (16)
2,560×1,920@108.0 (9) 3,840×2,160@66.8 (5) 4,096×2,048@63.3 (5) 4,096×2,160@60.0 (5) 4,096×2,304@56.3 (5) |
The maximum bit rate for High Profile is 1.25 times that of the
Base/Extended/Main Profiles, 3 times for Hi10P, and 4 times for
Hi422P/Hi444PP.
The number of luma samples is 16x16=256 times the number of
macroblocks (and the number of luma samples per second is 256 times the
number of macroblocks per second).
http://xcshen.blog.51cto.com/2835389/552669
H.264有四种画质级别,分别是BP、EP、MP、HP:
1、BP-Baseline Profile:基本画质。支持I/P 帧,只支持无交错(Progressive)和CAVLC;
2、EP-Extended profile:进阶画质。支持I/P/B/SP/SI 帧,只支持无交错(Progressive)和CAVLC;
3、MP-Main profile:主流画质。提供I/P/B 帧,支持无交错(Progressive)和交错(Interlaced),
也支持CAVLC 和CABAC 的支持;
4、HP-High profile:高级画质。在main Profile 的基础上增加了8x8内部预测、自定义量化、 无损视频编码和更多的YUV 格式;
想
要说明H.264 HP与H.264
MP的区别就要讲到H.264的技术发展了。JVT于2003年完成H.264基本部分标准制定工作,包含Baseline
profile、Extended profile和Main profile,分别包括不同的编码工具。之后JVT又完成了H.264
FRExt(即:Fidelity Range Extensions)扩展部分(Amendment)的制定工作,包括High
profile(HP)、High 10 profile(Hi10P)、High 4:2:2 profile(Hi422P)、High 4:4:4
profile(Hi444P)4个profile。
H.264 Baseline profile、Extended profile和Main
profile都是针对8位样本数据、4:2:0格式的视频序列,FRExt将其扩展到8~12位样本数据,视频格式可以为4:2:0、4:2:2、
4:4:4,设立了High profile(HP)、High 10 profile(Hi10P)、High 4:2:2
profile(Hi422P)、High 4:4:4 profile(Hi444P) 4个profile,这4个profile都以Main
profile为基础。
在
相同配置情况下,High profile(HP)可以比Main profile(MP)节省10%的码流量,比MPEG-2
MP节省60%的码流量,具有更好的编码性能。根据应用领域的不同,Baseline profile多应用于实时通信领域,Main
profile多应用于流媒体领域,High profile则多应用于广电和存储领域。
H.264 Baseline Profile对应MPEG-4 SP
H.264 Main Profile对应MPEG-4 ASP
H.264 Extended Profile对应MPEG-4 ARTS or FGS
H.264 Baseline Profile对应MPEG-4 Studio。
H.264 Profile、Level、Encoder三张简图
【整理者】61ic.com
【提供者】QuestionMark
【详细说明】H.264 Profile、Level、Encoder三张简图
取自
wikipedia
h.264 profile
h.264 level
h.264 software encoder
本文出自 “流媒体技术工程组” 博客,请务必保留此出处http://xcshen.blog.51cto.com/2835389/552669
对于640*480,可以参考如下的level:
Level | VBV maximum bit rate [1000bits/s] | VBV buffer size [1000bits] | Macroblocks/s | Resolution and frame rate |
1 | 64 | 175 | 1485 | 128×96@30 or 176×144@15 |
1b | 128 | 350 | 1485 | 128×96@30 or 176×144@15 |
1.1 | 192 | 500 | 3000 | 176×144@30 or 320×240@10 |
1.2 | 384 | 1000 | 6000 | 176×144@60 or 320×240@20 |
1.3 | 768 | 2000 | 11880 | 352×288@30 |
2 | 2000 | 2000 | 11880 | 352×288@30 |
2.1 | 4000 | 4000 | 19800 | 352×288@50 |
2.2 | 4000 | 4000 | 20250 | 352×288@50 or 640×480@15 |
3 | 10000 | 10000 | 40500 | 720×480@30 or 720×576@25 |
3.1 | 14000 | 14000 | 108000 | 1280×720@30 |
3.2 | 20000 | 20000 | 216000 | 1280×720@60 |
4 | 20000 | 25000 | 245760 | 1920×1088@30 or 2Kx1K@30 |
4.1 | 50000 | 62500 | 245760 | 1920×1088@30 or 2Kx1K@30 |
4.2 | 50000 | 62500 | 522240 | 1920×1088@60 or or 2Kx1K@60 |
5 | 135000 | 135000 | 589824 | 2560×1920@30 |
5.1 | 240000 | 240000 | 983040 | 4Kx2K@30 or 4096×2304@25 |
从实践来看,640*480@15,级别可设置为(级别必须是2.2):
2.2 | 4000 | 4000 | 20250 | 352×288@50 or 640×480@15 |
Max macroblocks 可设置为 1620
从实践来看,640*480@30,级别可设置为(级别必须是3.0):
3.0 | 10000 | 4000 | 36000 | 640×480@30 |
Max macroblocks 可设置为1620
H.264 Profile、Level、Encoder三张简图 (fps = AVCodecContext->time_base.den / AVCodecContext->time_base.num)的更多相关文章
- 【转】H264视频编码级别说明profile level Encoder
版权声明:本文为博主原创文章,未经博主允许不得转载. 首先要阐明所谓的AVC其实就是H.264标准,是由ITU-T和ISO/IEC组成的联合视频组(JVT,Joint Video Team)一起开发的 ...
- H.264 Profile
提到High Profile H.264解码许多人并不了解,那么到底什么是High Profile H.264解码?其应用效果又是如何呢? 作为行业标准,H.264编码体系定义了4种不同的Profi ...
- x264 - 高品质 H.264 编码器
转自:http://www.5i01.cn/topicdetail.php?f=510&t=3735840&r=18&last=48592660 H.264 / MPEG-4 ...
- h264 profile & level
转自:http://blog.csdn.net/sphone89/article/details/17492433 H.264 Profiles H.264有四种profile,每个profile支持 ...
- iOS VideoToolbox硬编H.265(HEVC)H.264(AVC):1 概述
本文档尝试用Video Toolbox进行H.265(HEVC)硬件编码,视频源为iPhone后置摄像头.去年做完硬解H.264,没做编码,技能上感觉有些缺失.正好刚才发现CMFormatDescri ...
- 直播一:H.264编码基础知识详解
一.编码基础概念 1.为什么要进行视频编码? 视频是由一帧帧图像组成,就如常见的gif图片,如果打开一张gif图片,可以发现里面是由很多张图片组成.一般视频为了不让观众感觉到卡顿,一秒钟至少需要16帧 ...
- 主流H.264编码器对比测试 (MSU出品)
俄罗斯的MSU Graphics & Media Lab (Video Group)出品的H.264编码器性能测试报告.测试了主流的H.264编码器的性能.从测试的结果来看,开源产品x264性 ...
- H.264编码profile & level控制
背景知识 先科普一下profile&level.(这里讨论最常用的H264) H.264有四种画质级别,分别是baseline, extended, main, high: 1.Baseli ...
- H.264(MPEG-4 AVC)级别(Level)、DPB 与 MaxDpbMbs 详解(转载)
转自:http://www.cnblogs.com/zyl910/archive/2011/12/08/h264_level.html 对于H.264(MPEG-4 AVC)而言,级别(Level)是 ...
随机推荐
- Html5 布局经验分享-第1集
移动端的布局与pc端的布局相比 移动端的布局就简单的多,兼容性不必考虑那么多,css3各种特性基本上是可以放肆的写:(个人看法) 本人做移动web 布局一段时间了,把这其中遇到的一些问题总结下来,均是 ...
- 在Windowx下创建以点开头的.hatccess文件
转自:在Windowx下创建以点开头的.hatccess文件 Windows有些目录名是不能创建的,有一些文件按照常规方式也是不能创建的,如在Windows下创建文件夹名为con的目录就不行,在win ...
- Linux下STM32开发环境的搭建
目录 一.概述 1.目的 2.开发环境描述 3.Eclipse构建的STM32集成开发环境结构 4.GDB / GDB Server 调试模型 二.搭建步骤 三.详细的搭建过程 1.安装eclipse ...
- 在树莓派上部署asp.net
今天成功的在树莓派上部署asp.net呢.之前在unbuntu上测试成功了,结果今天操作的时候又不会操作了,主要对Linux太不熟悉了,找资料,资料又不多,这次赶紧记录下来,以备下次查阅. 我用的mo ...
- C#<热血传奇>服务端源代码再次给力更新
前段时间一直在忙公司项目,最近抽点空稍微把部分代码重新整理一下(代码太久没碰很多地方都忘记了 囧~~~) 此次还是更新服务端,并修正上一版里面存在的很多指针 异常BUG... (代码比较烂,还请各位 ...
- Almeza MultiSet Pro(批量安装程序) V8.7.6中文特别版
Almeza MultiSet Pro(批量安装程序)是一款非常实用的工具.它能够帮你批量地安装常用的软件.这将解决每次重装系统后能够快速方便地重装常用软件.使用这款软件不需要编写程序,还可以在安装过 ...
- VS Extension: WPF : 使用全局方式 设置 窗体 foreground background
VS Extension 中 创建 WPF窗体后,总希望窗体的前后背景色和VS当前配色方案一致. 对每个control使用下列定义可以达到效果 Background="{DynamicRes ...
- google 开放I/O源码
在这款应用程序中谷歌对部分功能.API和设计架构进行了非常详细的阐述,其中包括碎片.程序加载.服务.广播.接收器.警告.通知.SQLite数据库.内容提供商.Action Bar.导航Drawer和G ...
- hdu 4815 Little Tiger vs. Deep Monkey
概率dp,有点像背包的做法: dp[i][j]代表前i个数组成的j数的概率为多少 #include<cstdio> #include<cstring> #define maxn ...
- 关于SQL语句中SUM函数返回NULL的解决办法
SUM 是SQL语句中的标准求和函数,如果没有符合条件的记录,那么SUM函数会返回NULL. 但多数情况下,我们希望如果没有符合条件记录的情况下,我们希望它返回0,而不是NULL,那么我们可以使用例如 ...