当前位置:网站首页>Three steps of ffmpeg CBR precise bitstream control
Three steps of ffmpeg CBR precise bitstream control
2022-06-11 17:39:00 【,,,, Nanshan light rain】
x264 You can set VBR and CBR The encoding mode of ,VBR Variable bit rate ,CBR Is a constant bit rate . Although on the Internet VBR Mostly , however CBR There is still a .
ffmpeg It's through -b:v To specify the video bit rate , But this setting is the average , It can not control the fluctuation range well . If you want to control fluctuations , It is also necessary to control the maximum code rate and the minimum code rate , namely -b:v,maxrate,minrate. At the same time, in order to better control the fluctuation during coding, you can also set the buffer size , Setting the -bufsize that will do .buffer The smaller is not the better , It's just right , Such as 1Mbit/s,bufsize Set to 50KB, It can well control the fluctuation of code rate .
ffmpeg -i input.mp4 -c:v libx264 -x264opts "bframes=10:b-adapt=0" -b:v
1000k -maxrate 1000k -minrate 1000k -bufsize 50k -nal-hrd cbr -g 50 -sc_threshold 0
output.ts
Let's analyze this command line , As follows .
● Set up B Number of frames , And every two P Include between frames 10 individual B frame
● Set the video bit rate to 1000kbit/s
● Set the maximum code rate to 1000kbit/s
● Set the minimum code rate to 1000kbit/s
● Set the encoded buffer The size is 50KB
● Set up H.264 The coding HRD The signal form is CBR
● Set every 50 Frame a GOP
● Set scene switching not to force keyframes
Generated according to the above parameter settings output.ts file , Use Bitrate Viewer Observe the rate fluctuation effect , The result is shown in Fig. 4-6 Shown .
It can be seen from the figure that the code rate fluctuation is the minimum 996kbit/s, The maximum bit rate is 1001kbit/s, The bit rate is controlled
Supplementary information B frame :
If you don't want to B frame , multi-purpose B Frames can make h264 The real compression ratio reaches 200,I The frame compression rate is the lowest ,P Frame medium ,B The frame is the highest , therefore B Frames also increase the encoder load , But it can reduce the bit rate . Compared with not using , multi-purpose B When the frame , The same bit rate video is clearer .
Add :
ABR yes VBR and CBR The hybrid scheme of ,VBR Generally used for media storage , Instead of network transmission , In fact, network transmission is called CBR It's usually ABR, As long as the bit rate is controlled within the unit time .ABR Coding is... In speed VBR Coded 2 To 3 times , But lower than CBR.
CBR The disadvantage of coding is that the quality is unstable , When there is movement , The quality will go down , Especially when the set bit rate is low .
VBR The advantage of is that when the content is simple , The allocated bit rate is less , When the video is complex, more bit rates are allocated , So when the file size is the same ,VBR The video quality of is better than CBR. When both are of the same quality ,VBR The size may be just CBR Half of .
边栏推荐
猜你喜欢

Read and understand the development plan for software and information technology service industry during the "14th five year plan"

How to become an optimist organization?

Use exe4j to convert The jar file is packaged as Exe file

Biden ordered to enforce the zero trust structure

Service learning notes 01 start method and life cycle

Merge two ordered linked lists ---2022/02/24

How to simplify a lot of if... Elif... Else code?

CLP information -5 keywords to see the development trend of the financial industry in 2022

Bracket generation ---2022/02/25

Threejs uses indexeddb cache to load GLB model
随机推荐
Service learning notes 04 other service implementation methods and alternative methods
How to simplify a lot of if... Elif... Else code?
Typescipt Basics
Delete the penultimate node of the linked list ---2022/02/22
av_read_frame返回值为-5 Input/output error
[solution] codeforces round 798 (Div. 2)
Semaphore PV operation of process interaction and its code implementation
[foundation of deep learning] learning of neural network (3)
How to become an optimist organization?
Service learning notes 02- actual combat startservice and bindservice
tidb-ddl的速度的调整
Tidb CDC create task error unknown or incorrect time zone
你还不懂线程池的设计及原理吗?掰开揉碎了教你设计线程池
6-8 creating and traversing linked lists
ADB command learning notes
有效的括号---2022/02/23
6-1 需要多少单词可以组成一句话?
threejs中设置物体的贴图+场景的6面贴图 +创建空间
threejs利用indexeddb缓存加载glb模型
搜狐全員遭詐騙,暴露哪些問題?