Rescaling and slowing down a movie at the same time with ffmpeg

152 views Asked by At

I would like with ffmpeg to slow down a movie I am creating using the flag:

-filter:v "setpts=2.0*PTS"

However the height of my still images is not divisible by 2, so to avoid the error: height not divisible by 2 (1238x833), I am using the flag:

-vf scale="trunc(iw/2)*2:trunc(ih/2)*2"

(I also tried -vf scale=1238:-2).

When I do this the film is generated but it isn't slowed down, like if the -filter:v "setpts=2.0*PTS" wasn't there.

Is there something particular to do in order to have both option working at the same time?

Here is the complete command I am using:

ffmpeg -an -i ./movie/cphmd1.%05d.ppm -vcodec libx264 -pix_fmt yuv420p -b:v 5000k -r 24 -crf 18 -filter:v "setpts=2.0*PTS" -vf scale="trunc(iw/2)*2:trunc(ih/2)*2" -preset slow -f mp4 cphmd1_slower.mp4

Many thanks in advance!

1

There are 1 answers

0
Gyan On BEST ANSWER

Multiple filters acting on the same input, in series, have to be chained together. So,

ffmpeg -an -i ./movie/cphmd1.%05d.ppm -vcodec libx264 -pix_fmt yuv420p -b:v 5000k -r 24 -crf 18 -vf "setpts=2.0*PTS,scale=trunc(iw/2)*2:trunc(ih/2)*2" -preset slow -f mp4 cphmd1_slower.mp4