使用ffmpeg同时缩放和减慢电影播放速度 [英] Rescaling and slowing down a movie at the same time with ffmpeg
问题描述
我希望与ffmpeg一起使用标记来减慢我正在制作的电影:
I would like with ffmpeg to slow down a movie I am creating using the flag:
-filter:v "setpts=2.0*PTS"
但是我的静止图像的高度不能被2整除,因此为了避免错误:不能被2整除的高度(1238x833)
,我正在使用标志:
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"
(我也尝试过 -vf scale = 1238:-2
).
当我这样做时,影片就生成了,但是并没有放慢速度,就像没有 -filter:v"setpts = 2.0 * PTS"
一样.
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
非常感谢!
推荐答案
作用在同一输入上的多个过滤器必须串联在一起.所以,
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
这篇关于使用ffmpeg同时缩放和减慢电影播放速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!