Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg how to control fps tbr tbn tbc parameters

Tags:

ffmpeg

RT, i have two avi file,

A.avi: fps 30 tbr 30 tbn 30 tbc 30.
B.avi: fps 2 tbr 2 tbn 2 tbc 2.

the problem is how to set the same value 30 on B.avi?

like image 314
kaka_ace Avatar asked Apr 10 '13 16:04

kaka_ace


3 Answers

You can re-encode with a specified frame rate:

ffmpeg -i B.avi -codec:v mpeg4 -r 30 -qscale:v 2 -codec:a copy C.avi

What these options mean:

  • -codec:v mpeg4 - Use the encoder called mpeg4 for MPEG-4 Part 2 video.
  • -r 30 - Set output frame rate as 30.
  • -qscale:v 2 - Set video output quality using a constant quantization parameter. Recommended range is 2-5 for mpeg4.
  • -codec:a copy - Copy the audio from input to output to avoid re-encoding.

Note that ffmpeg will simply duplicate frames to achieve your desired output frame rate. If instead you were reducing your frame rate ffmpeg would drop frames.

like image 66
llogan Avatar answered Nov 16 '22 14:11

llogan


You can change timebase or tbn tbc by -video_track_timescale, e. g. to change the tbn and tbc to 30:

ffmpeg -i 1.avi -c:v copy -video_track_timescale 30 1.avi
like image 26
picapica Avatar answered Nov 16 '22 14:11

picapica


if you want more presice control, not only control fps. but also tbr, tbn, tbc. assume you understand what mean of it. tbc,tbn,tbr

check

ffmpeg -x264opts timebase=???

or

ffmpeg -time_base

or use format factory, default it give you same tbr, tbn, tbc.

like image 3
liuyang1 Avatar answered Nov 16 '22 14:11

liuyang1