0

When I use this code:

ffmpeg -i a.mp4 -filter:v "setpts='if(between(T,3,5),PTS*3,PTS)'" -b:v 3000k -s 1440x720 d.mp4

I get output which stops at 3rd second and run in slow motion from 9th second, and ends somewhere at 14th. Rescaling and changing bitrate doesn't affect this. No warnings shown at output. So why it freezes output for 6 seconds?

1 Answer 1

1

Your setpts expression leaves a gap after t=3.

This is the mapping from input to output timestamps:

0 --> PTS   --> 0
1 --> PTS   --> 1
2 --> PTS   --> 2
3 --> PTS*3 --> 9
4 --> PTS*3 --> 12
5 --> PTS*3 --> 15
6 --> PTS   --> 6 --> 15.001
7 --> PTS   --> 7 --> 15.002
8 --> PTS   --> 8 --> 15.003

...

The easier but longer way to do this is to use a combination of trim, setpts and concat filters as shown in https://video.stackexchange.com/q/21800/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .