[Libav-user] Adjust fps

Henry, David David.Henry at echostar.com
Wed Sep 7 20:59:44 EEST 2016

On 9/6/16, 11:23 AM, "Libav-user on behalf of Leandro Raffo"
<libav-user-bounces at ffmpeg.org on behalf of ljraffo at gmail.com> wrote:

>I'm trying to remux a video changing its frame rate, but I'm a bit
>lost in how to do it. This is what I have in mind:
>Suppose I have a 20 fps video and I want to take it for example to 10
>fps, should I drop every second frame (paket) and JUST multiply the
>dts and pts by 2.
>What if I want to go 3 or 7 or 13 fps? I'm guessing I should be
>rescaling the dts and pts using the input_stream time_base or
>avg_frame_rate to get something reliable, but I don't know how!

To change the frame rate, you must first decode the video frames as you
receive them.  Don¹t throw away
The AVPacket before decoding to an AVFrame.  After decoding, you can throw
away every other frame
Or whatever you decide based on your frame rate.  You don¹t need the dts
after decoding.  Don¹t
Change the pts because it¹s the presentation timestamp and you want to
display the frame in the
Same place in the timeline, only fewer frames.

David Henry

More information about the Libav-user mailing list