Input parameters to FFMPEG

2019-01-20 19:32发布

问题:

I am trying to make an FFMPEG script that relied on a glob input pattern from Linux to Windows. Unfortunately that is not supported so I am looking for an alternative. I do not want to have to rename or copy the files every time I run the script because the files are used elsewhere and I cannot rename them and I would like to avoid duplication or unnecessary temporary files.

Are globs numerically sequential named images my only option here? Ideally I would like to input a list of image paths to FFMPEG as a substitute for ffmpeg -i *.jpg

回答1:

The workarounds are to prepare a text file with the names and use the concat demuxer.

Or you can use image2pipe

cat *.jpg | ffmpeg -f image2pipe -framerate 25 -i - out.mp4


回答2:

The best solution I could find (that's Windows compatible) was to generate a line separated list of files in a text file and pass that through to FFMPEG. For example, to generate a stabilized MP4 from a bunch of JPEGs:

ffmpeg -f concat -safe 0 -i ./files.txt -vf deshake=rx=64:ry=64 ./stabilized.mp4

Where files.txt is a list of the files in the following format. The safe option toggles the ability to have absolute/relative file paths.

# this is a comment
file 'C:/path/to/file1.jpg'
file 'C:/path/to/file2.jpg'
file 'C:/path/to/file3.jpg'