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   : 0
    compatible_brands: qt  
    creation_time   : 2020-08-03T12:32:30.000000Z
  Duration: 00:00:20.54, start: 0.000000, bitrate: 4446 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
    Metadata:
      creation_time   : 2020-08-03T12:32:30.000000Z
      handler_name    : Core Media Audio
    Stream #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.000000Z
      handler_name    : Core Media Video
      encoder         : 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   : 0
    compatible_brands: qt  
    encoder         : Lavf58.29.100
    Stream #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.000000Z
      handler_name    : Core Media Video
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2020-08-03T12:32:30.000000Z
      handler_name    : Core Media Audio
      encoder         : 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
  • 3
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值