ffmpeg错误:选择了模式类型'glob',但此libavformat构建不支持globbing

cyb*_*101 25 ffmpeg video-processing

我正在尝试将作为单独帧的".jpg"文件组转换为1个单个mpeg视频".mp4"

我使用的示例参数:

frame duration  = 2 secs
frame rate      = 30  fps
encoder         = libx264 (mpeg)
input pattern   = "*.jpg"
output pattern  = video.mp4
Run Code Online (Sandbox Code Playgroud)

根据(https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images)上的ffmpeg wiki说明,我发出了以下命令:

ffmpeg -framerate 1/2 -pattern_type glob -i "*.jpg" -c:v libx264 -r 30 -pix_fmt yuv420p video.mp4
Run Code Online (Sandbox Code Playgroud)

但是我收到了这个错误:

[image2 @ 049ab120] Pattern type 'glob' was selected but globbing is not 
supported by this libavformat build *.jpg: Function not implemented
Run Code Online (Sandbox Code Playgroud)

这可能意味着我的构建/版本的API模式匹配命令已更改.顺便说一下,我的windows 32bit ffmpeg下载build(ffmpeg-20150702-git-03b2b40-win32-static).

如何使用ffmpeg使用模式匹配选择一组文件?

aer*_*tal 28

-pattern_type glob 需要glob.h.

glob在POSIX标准中定义,默认情况下在Windows不可用.

使用顺序文件命名创建/重命名文件,image###.jpg然后使用序列通配符,如-i image%03d.jpg输入.

  • `ffmpeg -帧速率 15 -pattern_type 序列 -start_number 00001 -i C:\Users\u\Videos\LRT_%05d.jpg -s:v 1920x1080 -c:v libx264 -crf 17 -pix_fmt yuv420p C:\Users\u\视频\my-timelapse_1.mp4` (3认同)

HCL*_*ess 11

你可以用Python编写一个脚本,它支持Windows中的glob模块:

import subprocess
import glob
import os

filenames = glob.glob('*.png')
path = os.path.abspath("").replace("\\", "/")
print(path)
duration = 0.05

with open("ffmpeg_input.txt", "wb") as outfile:
    for filename in filenames:
        outfile.write(f"file '{path}/{filename}'\n".encode())
        outfile.write(f"duration {duration}\n".encode())

command_line = f"ffmpeg -r 60 -f concat -safe 0 -i ffmpeg_input.txt -c:v libx265 -pix_fmt yuv420p {path}\\out.mp4"
print(command_line)

pipe = subprocess.Popen(command_line, shell=True, stdout=subprocess.PIPE).stdout
output = pipe.read().decode()
pipe.close()
Run Code Online (Sandbox Code Playgroud)