BarkerChippy
BarkerChippy

Reputation: 121

ffmpeg speed up video from 25 to 60 fps dropping frames

I'm trying to speed up a video from 25fps to 60 fps. I want the same exact number of frames, just presented to me faster and whatever gets me 60 of them per second.

ffmpeg -i Spider.mov -r 62500/1000 -filter:v "setpts=PTS*0.4" -c:v libx264 Spider4k60.mov

This works and doesn't drop or duplicate any frames. But my player won't do 62.5 fps.

But when I tried:

 ffmpeg -i Spider.mov -r 60 -filter:v "setpts=PTS/2.4" -c:v libx264 -y Spider4k60.mov

even though that is the correct fraction (60/25=2.4) I get about one dropped and one duplicated frame per second.

Likewise:

 ffmpeg -i Spider.mov -r 60 -filter:v "setpts=PTS*0.416666666667" -c:v libx264 -y Spider4k60.mov

gives me the same.

Any thoughts? I would think PTS/2.4 would be the proper solution.

Upvotes: 0

Views: 869

Answers (1)

Gyan
Gyan

Reputation: 93349

Timestamps are denominated in terms of a timebase which is the clock-keeping scale.

setpts will assign the value nearest to the expression value which is possible in the stream timebase. When compressing timestamps, like here, make sure that enough resolution is available using the settb filter.

For 25 and 60, 300 is LCM but let's pick something higher, like 6000.

-filter:v "settb=1/6000,setpts=PTS/2.4"

If your video is constant frame rate, this will do what you want. If it's VFR, it's possible that -r 60 will still cause frames to be dropped/duped. Add -vsync vfr for that.

Upvotes: 2

Related Questions