使用ffmpeg使用滑动过渡构建图像幻灯片时出现问题 [英] Problems building Image slideshow with sliding transition using ffmpeg

查看:83
本文介绍了使用ffmpeg使用滑动过渡构建图像幻灯片时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ffmpeg和以下命令通过幻灯片过渡来创建图像幻灯片:

I'm trying to create image slideshow with slide transition using ffmpeg and the following command:

ffmpeg -loop 1 -i img1.jpg -loop 1 -i img2.jpg -loop 1 -i img3.jpg ^
-filter_complex ^
"nullsrc=size=800x600[v0]; ^
[0:v]trim=duration=5,scale=800x600,setpts=PTS-STARTPTS[v1]; ^
[1:v]trim=duration=5,scale=800x600,setpts=PTS-STARTPTS[v2]; ^
[2:v]trim=duration=5,scale=800x600,setpts=PTS-STARTPTS[v3]; ^
[v0][v1]overlay=x='min(-w+(t*w/0.5)\,0)':shortest=1[vv0]; ^
[v1][v2]overlay=x='min(-w+(t*w/0.5)\,0)':shortest=1[vv1]; ^
[v2][v3]overlay=x='min(-w+(t*w/0.5)\,0)':shortest=1[vv2]; ^
[vv0][vv1][vv2]concat=n=3:v=1:a=0 [video]" -map "[video]" output.mp4

我希望每张图像从左滑入0.5秒,再停留4.5秒,然后再与下一张重叠,依此类推.

I want every image to slide in from left for 0.5 seconds and stay for further 4.5 seconds, before it's being overlapped by the next one and so on.

第一个问题是,仅用3张图像构建视频就需要2-3分钟,而我想添加更多图像,这将导致构建时间过长.

First problem is that it takes 2-3 minutes to build video with just 3 images and I want to add more images which will result in extremely long build time.

第二个问题是视频的长度应为15秒,但只有8个,因为第一个图像显示5秒钟,第二个图像显示2秒钟,最后一个图像仅显示1秒钟.

Second problem is that video should be 15 seconds long, but it's only 8 as first image is shown for 5 seconds, second is shown for 2 and the last one just for 1 second.

我们将非常感谢您的帮助.

Your help will be greatly appreciated.

推荐答案

在过滤器内部生成的输入键盘只能使用一次.因此,您应该拆分那些将被重用的流.

An input pad generated inside a filter complex can be used only once. So, you should split those streams which will be reused.

ffmpeg -loop 1 -i img1.jpg -loop 1 -i img2.jpg -loop 1 -i img3.jpg ^
-filter_complex ^
"nullsrc=size=800x600[v0]; ^
[0:v]trim=duration=5,scale=800x600,setpts=PTS-STARTPTS,split[v1a][v1b]; ^
[1:v]trim=duration=5,scale=800x600,setpts=PTS-STARTPTS,split[v2a][v2b]; ^
[2:v]trim=duration=5,scale=800x600,setpts=PTS-STARTPTS[v3]; ^
[v0][v1a]overlay=x='min(-w+(t*w/0.5)\,0)':shortest=1[vv0]; ^
[v1b][v2a]overlay=x='min(-w+(t*w/0.5)\,0)':shortest=1[vv1]; ^
[v2b][v3]overlay=x='min(-w+(t*w/0.5)\,0)':shortest=1[vv2]; ^
[vv0][vv1][vv2]concat=n=3:v=1:a=0 [video]" -map "[video]" output.mp4

这篇关于使用ffmpeg使用滑动过渡构建图像幻灯片时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆