0

I am using Windows 10 with "ffmpeg version 4.4-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.2.0 (Rev6, Built by MSYS2 project)".

I am writing a command-line script that will create a basic slideshow MP4 video from multiple folders of dozens or hundreds of JPG and/or PNG images. The images are sourced from either digital cameras/smartphones or scanned photos (typically 600 dpi).

So far, I have been successful with this command for a small test group of 9 JPG files:

ffmpeg -framerate 1/2 -i test%%1d.jpg -filter_complex "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black,format=yuv420p" -r 30 -movflags +faststart output-1280-720.mp4

This command-line works perfectly and renders my JPGs in the correct orientation and correct aspect ratio.

Only one issue remains.... my input file selection requires a more flexible "*.JPG" wildcard syntax because I have tens of thousands of images (52K images in over 1900 folders) that have a wide variety of naming conventions that don't match a simple 1, 2, or 3 digit numeric sequence. And in some cases, the images are just randomly named and simply sorted alphabetically by their file names.

I have tried two unsuccessful options to provide “*.jpg” wildcard functionality…

Option #1 (text file of filenames):

ffmpeg -framerate 1/2 -f concat -safe 0 -i "Test-ffmpeg.Txt" -filter_complex "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black,format=yuv420p" -r 30 -movflags +faststart output.mp4

I tried creating an input file list using this syntax: -f concat -safe 0 -i "Test-ffmpeg.Txt" but when I run the command, I get a “Option framerate not found” fatal error

Can I use an input text file with this particular set of encoding and processing options?

Option #2 (Pattern_Type glob):

ffmpeg -framerate 1/2 -pattern_type glob -i "*.jpg" -filter_complex "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black,format=yuv420p" -r 30 -movflags +faststart output-1280-720.mp4

If I try using -pattern_type glob -i "*.jpg" I receive this fatal error message "Pattern type 'glob' was selected but globbing is not supported by this libavformat build. *.jpg: Function not implemented’

Is there a FFmpeg version (or license) that provides glob support on a Windows platform?. I'm certainly willing to pay for it. Or, in the absence of glob wildcard support, if there a way I can accomplish the “*.jpg” wildcard syntax?

Thank you,

Mark

1
  • Possible alternative could be using a script or tool to rename your files in a way that *.jpg works.
    – kicken
    Jul 10, 2021 at 2:42

1 Answer 1

0

With concat demuxer method, use setpts filter instead of -framerate to control timing.

Use

ffmpeg -reinit_filter 0 -f concat -safe 0 -i "Test-ffmpeg.Txt" -vf "scale=1280:720:force_original_aspect_ratio=decrease:eval=frame,pad=1280:720:-1:-1:color=black:eval=frame,settb=AVTB,setpts=2*N/TB,format=yuv420p" -r 30 -movflags +faststart output.mp4

7
  • Hi, @Gyan, thanks for the suggestion... when I run the command, I get a brief 1-image output file instead of the expected 14 images with a 2 second delay between images. Here is the command: ffmpeg -f concat -safe 0 -i "Test-ffmpeg.Txt" -vf "setpts=2*N/TB,scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black,format=yuv420p" -r 30 -movflags +faststart output-setpts.mp4
    – Sailor Guy
    Jul 10, 2021 at 15:11
  • Here is the "Test-ffmpeg.txt" input file: file 'Test1.jpg' file 'Test2.jpg' file 'Test3.jpg' file 'Test4.jpg' file 'Test5.jpg' file 'Test6.jpg' file 'Test7.jpg' file 'Test8.jpg' file 'Test9.jpg' file 'Test10.jpg' file 'Test11.jpg' file 'Test12.jpg' file 'Test13.jpg' file 'Test14.jpg'
    – Sailor Guy
    Jul 10, 2021 at 15:12
  • Can't reproduce here. Are all of your images the same resolution and format?
    – Gyan
    Jul 10, 2021 at 17:35
  • Hi, @Gyan, the images are all JPG but some of them have different resolutions because they were sourced from different digital cameras and/or digitally scanned. What’s interesting is the first option works fine for the same 9 images: fmpeg -framerate 1/2 -f concat -safe 0 -i "Test-ffmpeg.Txt" -filter_complex "scale..." but the second option with the same 9 images results in only 1 brief image: ffmpeg -f concat -safe 0 -i "Test-ffmpeg.Txt" -vf "setpts=2*N/TB,scale..." I can provide the 9 images in a Dropbox folder if you would like to see them. Any help would be appreciated!
    – Sailor Guy
    Jul 10, 2021 at 20:20
  • Try modified command.
    – Gyan
    Jul 11, 2021 at 4:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .