8

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?

Share a link to this question
CC BY-SA 3.0
3

3 Answers 3

7

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.

Share a link to this answer
CC BY-SA 3.0
7

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
Share a link to this answer
CC BY-SA 4.0
1
  • 1
    This was helpful for me. I have a video I want to prepend with some seconds of black. The concatenated video was played much slower, the effective frame-rate only a quarter of the desired frame-rate. I was able to use ffmpeg -f lavfi -i color=size=1920x1080:rate=60:color=black -t 10 -video_track_timescale 60k black.mp4 to generate a video with a tbn matching the actual video. The tbc does not seem to be important in this context.
    – Hermann
    Sep 21, 2020 at 18:06
3

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.

Share a link to this answer
CC BY-SA 3.0
1
  • 3
    ffmpeg -i input.mp4 -time_base 1/30 -c:a copy -c:v copy output.mp4 Is what I used. The time_base parameter successfully changed the 'tbn' to match on both videos without re-encoding. You may need to apply additional parameters if other settings need to be uniform before joining the videos. May 24, 2019 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.