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

僤鯓⒐⒋嵵緔 提交于 2021-02-05 11:38:16

问题


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:


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


来源:https://stackoverflow.com/questions/41257298/rescaling-and-slowing-down-a-movie-at-the-same-time-with-ffmpeg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!