ffmpeg img to video = Could find no file with path

2019-02-25 18:36发布

问题:

i try to convert img to mp4 with ffmpeg. i try to do it like this:

ffmpeg -framerate 25 -f image2 -start_number 1 -i '/tmp/stream/_%09d.jpg' -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4

and get an error:

[image2 @ 0xe74800] Could find no file with path '/tmp/stream/_%09d.jpg' and index in the range 1-5
/tmp/stream/_%09d.jpg: No such file or directory

The jpg file-name format is:

/tmp/stream/2017_11_20_08_48_30_picture_000000001.jpg
/tmp/stream/2017_11_20_08_48_35_picture_000000002.jpg
/tmp/stream/2017_11_20_08_48_40_picture_000000003.jpg
***
/tmp/stream/2017_11_20_08_56_30_picture_000000999.jpg

anyone can help, where is mistake?... Thanks!

回答1:

To match all jpg files in /tmp/stream use:

ffmpeg -pattern_type glob -i '*.jpg'

For more specificity use additional glob patterns. For example, if you only want images from 2017-11-08 to 2017-11-10:

ffmpeg -pattern_type glob -i '/tmp/stream/2017_11_{08,09,10}*.jpg'

For more info on glob patterns see man 7 glob.



回答2:

_%09d.jpg matches names of the form _000000001.jpg, _000000002.jpg

Use -pattern_type glob -i '/tmp/stream/*_%09d.jpg'