本文主要是介绍ffmpeg设置视频 tbr、tbn、tbc,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
时间基相关的定义
- tbr 表示帧率,该参数倾向于一个基准,往往tbr跟fps相同。(the time base in AVStream that has come from the container)
- tbn 表示视频流 timebase(时间基准),比如ts流的timebase 为90000,flv格式视频流timebase为1000 (the time base in AVCodecContext for the codec used for a particular stream)
- tbc 表示视频流codec timebase ,对于264码流该参数通过解析sps间接获取(通过sps获取帧率)(tbr is guessed from the video stream and is the value users want to see when they look for the video frame rate)
时间基相关的设置
分别设置tbn为80k、tbc为45、tbr为25
ffmpeg -hide_banner -i input.mp4 -c:v libx264 -time_base 1/80000 -enc_time_base 1/45 -r 25 -f mp4 output.mp4 -y
output视频输出信息
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x1280, q=-1--1, 25 fps, 80k tbn, 45 tbc (default)
详细的转码日志
ffmpeg -hide_banner -i input.mp4 -c:v libx264 -time_base 1/80000 -enc_time_base 1/45 -r 25 -f mp4 output.mp4 -y
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':Metadata:major_brand : qt minor_version : 0compatible_brands: qt creation_time : 2020-08-03T12:32:30.000000ZDuration: 00:00:20.54, start: 0.000000, bitrate: 4446 kb/sStream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)Metadata:creation_time : 2020-08-03T12:32:30.000000Zhandler_name : Core Media AudioStream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280, 4316 kb/s, 16.11 fps, 16 tbr, 600 tbn, 1200 tbc (default)Metadata:creation_time : 2020-08-03T12:32:30.000000Zhandler_name : Core Media Videoencoder : H.264
Stream mapping:Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fa61d010800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fa61d010800] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x7fa61d010800] 264 - core 159 r2999 296494a - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':Metadata:major_brand : qt minor_version : 0compatible_brands: qt encoder : Lavf58.29.100Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x1280, q=-1--1, 25 fps, 80k tbn, 45 tbc (default)Metadata:creation_time : 2020-08-03T12:32:30.000000Zhandler_name : Core Media Videoencoder : Lavc58.54.100 libx264Side data:cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)Metadata:creation_time : 2020-08-03T12:32:30.000000Zhandler_name : Core Media Audioencoder : Lavc58.54.100 aac
frame= 926 fps=213 q=-1.0 Lsize= 3969kB time=00:00:20.51 bitrate=1585.4kbits/s dup=595 drop=0 speed=4.71x
video:3614kB audio:321kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.865847%
[libx264 @ 0x7fa61d010800] frame I:8 Avg QP:18.62 size: 56722
[libx264 @ 0x7fa61d010800] frame P:233 Avg QP:22.08 size: 11749
[libx264 @ 0x7fa61d010800] frame B:685 Avg QP:25.08 size: 743
[libx264 @ 0x7fa61d010800] consecutive B-frames: 1.1% 0.4% 1.3% 97.2%
[libx264 @ 0x7fa61d010800] mb I I16..4: 13.0% 32.4% 54.6%
[libx264 @ 0x7fa61d010800] mb P I16..4: 2.1% 4.1% 0.9% P16..4: 42.2% 9.5% 6.5% 0.0% 0.0% skip:34.7%
[libx264 @ 0x7fa61d010800] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 19.6% 0.2% 0.0% direct: 0.2% skip:79.9% L0:48.1% L1:51.0% BI: 0.8%
[libx264 @ 0x7fa61d010800] 8x8 transform intra:49.1% inter:72.7%
[libx264 @ 0x7fa61d010800] coded y,uvDC,uvAC intra: 53.5% 62.9% 12.8% inter: 6.0% 7.8% 0.1%
[libx264 @ 0x7fa61d010800] i16 v,h,dc,p: 40% 24% 24% 12%
[libx264 @ 0x7fa61d010800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 12% 40% 4% 4% 6% 3% 4% 3%
[libx264 @ 0x7fa61d010800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 14% 18% 7% 8% 9% 5% 6% 3%
[libx264 @ 0x7fa61d010800] i8c dc,h,v,p: 50% 18% 27% 6%
[libx264 @ 0x7fa61d010800] Weighted P-Frames: Y:3.4% UV:0.4%
[libx264 @ 0x7fa61d010800] ref P L0: 66.2% 16.2% 12.6% 4.9% 0.2%
[libx264 @ 0x7fa61d010800] ref B L0: 91.8% 6.7% 1.5%
[libx264 @ 0x7fa61d010800] ref B L1: 93.2% 6.8%
[libx264 @ 0x7fa61d010800] kb/s:1438.45
[aac @ 0x7fa61d012000] Qavg: 235.295
这篇关于ffmpeg设置视频 tbr、tbn、tbc的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!