如何从使用ffmpeg的时间戳命名的帧中创建视频 [英] How to create a video from frames named using timestamp with ffmpeg
问题描述
我有一个文件夹,里面装有以以下格式命名的带有时间戳的帧
I have a folder filled with frames that have the timestamp in the name in the folowing format
im_%H_%M_%S_%MS.png
im_%H_%M_%S_%MS.png
im_08_05_09_007324.png
im_08_05_09_532857.png
im_08_05_10_059340.png
im_08_05_10_575862.png
im_08_05_11_118361.png
im_08_05_11_596814.png
im_08_05_12_148340.png
im_08_05_12_665838.png
我尝试在Windows中使用 -pattern_type glob
,但是它不起作用.
I try to use -pattern_type glob
in windows but it does not work.
ffmpeg.exe -framerate 10 -pattern_type glob -i im_*.png -c:v libx264 -r 30 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -pix_fmt yuv420p $videoName
我知道
Pattern type 'glob' was selected but globbing is not supported by this libavformat build im_*.png: Function not implemented
后来我发现这在Windows上不起作用:(这是我正在使用的.
later I found that this do not work on windows :( which is what I am using. ffmpeg Error: Pattern type 'glob' was selected but globbing is not support ed by this libavformat build
我也尝试
ffmpeg.exe -framerate 10 -pattern_type glob -i im_%02d_%02d_%02d_%06d.png -c:v libx264 -r 30 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -pix_fmt yuv420p $videoName
我知道了
im_%02d_%02d_%02d_%06d.png: No such file or directory
我的想法不多了.我拒绝相信在ffmpeg和powershell中无法做到这一点.非常感谢您的帮助!
I am running out of ideas. I refuse to believe that there is no way to do this in ffmpeg and powershell. I really appreciate any help!
推荐答案
您可以通过concat多路分配器使用解决方法
You can use a workaround, via the concat demuxer
按顺序创建文件名列表的文本文件
Create a text file with the list of filenames in order
file im_08_05_09_007324.png
file im_08_05_09_532857.png
file im_08_05_10_059340.png
file im_08_05_10_575862.png
file im_08_05_11_118361.png
然后运行
ffmpeg -f concat -r 10 -i list.txt -c:v libx264 ...
(这将产生有关无效DTS的警告,但您可以忽略它们)
(this will produce warnings about invalid DTS but you can ignore them)
这篇关于如何从使用ffmpeg的时间戳命名的帧中创建视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!