对不连续编号的文件使用ffmpeg [英] Using ffmpeg with not consecutive numbered files

查看:115
本文介绍了对不连续编号的文件使用ffmpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ffmpeg从一组png图像开始制作视频.但是,我的图像编号如下:

I am using ffmpeg to produce a video starting from a set of png images. However, the images I have are numbered like this:

image_D5_C0_F4.png
image_D10_C0_F4.png
image_D15_C0_F4.png
image_D20_C0_F4.png

,依此类推.基本上,所有内容都保持不变,但是内部部分发生了变化.我的ffmpeg命令如下:

and so on. Basically, everything remains the same, but the inner part changes. My ffmpeg command looks like this:

ffmpeg -framerate 8 -start_number 5 -i img/image_%02d_C0_F4.png -c:v libx264 -r 30 -s 1200x900 -pix_fmt yuv420p out.mp4

,但显然不起作用.我查看了手册,找到了一个选项,可以让我指定一个起始数字(在这种情况下为5)和一个标准的增量(再次为5),以便捕获5,10,15,20等.

but obviously it does not work. I looked into the manual to find an option that allow me to specify a starting number (5 in this case) and a standard increment (again, 5), so to catch 5,10,15,20 etc.

关于如何解决此问题的任何想法?我知道我可以使用脚本来重命名所有文件来处理所有事情,但是我想首先检查ffmpeg是否具有所需的选项.

Any idea on how to solve this? I know I can handle everything with a script to rename all the files, but I wanted to check whether ffmpeg has the needed option in the first place.

谢谢

推荐答案

您可以使用glob模式类型:

You can use the glob pattern type:

ffmpeg -framerate 8 -pattern_type glob -i "*.png" -c:v libx264 -r 30 \
-vf "scale=1200:-2,format=yuv420p" -movflags +faststart out.mp4

注意:

  • 比例视频滤镜 -s功能更广泛.您只需选择一个尺寸值,它将自动计算另一个尺寸值.

  • The scale video filter is more versatile than -s. You only have to pick one dimensional value and it will automatically calculate the other.

-movflags + faststart 会将moov原子从文件的结尾重新定位到文件的开头.如果客户端将通过逐步下载(例如在浏览器中)观看视频,这将很有用.

-movflags +faststart will relocate the moov atom from the end to the beginning of the file once encoding has completed. This is useful if clients will view the video via progressive download such as in a browser.

我不确定glob模式是否适用于Windows,或者至少适用于 Zeranoe的FFmpeg构建(我需要测试).

I'm not sure if the glob pattern works with Windows, or at least with Zeranoe's FFmpeg Builds (I need to test that).

另请参阅:

这篇关于对不连续编号的文件使用ffmpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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