ffmpeg图像到视频脚本任何人? [英] ffmpeg images-to-video script anyone?
问题描述
我看到的工具通常似乎有ffmpeg在引擎盖下,所以大概是这种的事情可以用脚本完成。但是ffmpeg有很多选择...我希望有人会有一些关闭。
我会有多达100张幻灯片,必须显示的幻灯片对于3.428571428秒或任何我想我可以简单地显示两次。
您可以从一个视频,或从许多
图像创建视频:
从视频中提取图像:
ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
这将从视频中每秒提取一个视频帧,并将
在名为foo-001.jpeg
','foo-002.jpeg
'等。图像
将被重新缩放以适应新的WxH值。如果你想提取
只有有限数量的框架,你可以使用
组合的上述命令与-vframes或-t选项,或者与-ss
组合来开始提取从某个时间点开始。从许多图像创建视频
:ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
语法
foo-%03d.jpeg
指定使用由零填充的三位数组成的
的十进制数来表示序列号。它
与C printf函数支持相同的语法,但只有接受正常整数的
格式是合适的。
这是文档的摘录,有关ffmpeg的文档页面的更多信息,请查看。
I'm wanting to take a bunch of images and make a video slideshow out of them. There'll be an app for that, right? Yup, quite a few it seems. The problem is I want the slides synced to a piece of music, and all the apps I've seen only allow you to show each slide for a multiple of a whole second. I want them to show for multiples of 1.714285714 seconds to fit with 140 bpm.
The tools I've seen generally seem to have ffmpeg under the hood, so presumably this kind of thing could be done with a script. But ffmpeg has sooo many options...I'm hoping someone will have something close.
I'll have up to about 100 slides, the ones that have to show for 3.428571428 secs or whatever I guess I can simply show twice.
You can extract images from a video, or create a video from many images:
For extracting images from a video:
ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
This will extract one video frame per second from the video and will output them in files named '
foo-001.jpeg
', 'foo-002.jpeg
', etc. Images will be rescaled to fit the new WxH values. If you want to extract just a limited number of frames, you can use the above command in combination with the -vframes or -t option, or in combination with -ss to start extracting from a certain point in time. For creating a video from many images:ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
The syntax
foo-%03d.jpeg
specifies to use a decimal number composed of three digits padded with zeroes to express the sequence number. It is the same syntax supported by the C printf function, but only formats accepting a normal integer are suitable.
This is an excerpt from the documentation, for more info check on the documentation page of ffmpeg.
这篇关于ffmpeg图像到视频脚本任何人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!