2

So, I tried a few lines of code in a Windows batch file to extract frames from MP4-files.

ffmpeg -i "filename.mp4" "frames/out-%%06d.jpg" works on just one file.

ffmpeg -i "*.mp4" "frames/out-%%06d.jpg"does not work at all.

How do I get it to play nice with multiple inputfiles?

Phish
  • 43
  • 1
  • 10
  • 1
    Something like [`for`](http://ss64.com/nt/for.html)`%%I in ("*.mp4") do ffmpeg -i "%%~I" "frames\%%~nI-%%06d.jpg"`? – aschipfl Dec 10 '18 at 08:39
  • It runs, yay! Thanks. Will see if it continues with the second file, but looks good. – Phish Dec 10 '18 at 08:43
  • Similar to [How do you convert an entire directory with ffmpeg?](https://stackoverflow.com/a/24273691/1109017) – llogan Dec 10 '18 at 18:22

1 Answers1

0

Here is a possible solution:

for %%A in ("*.mp4") do ffmpeg -i "%%A" "frames\%%~nA_out-%%06d.jpg"

Note: Your example was not good as it will continuously replace file out-%%06d.jpg!

%%~nA is the filename of the mp4 file is being processed.

Type for /? in a fresh cmd for more information.

double-beep
  • 5,031
  • 17
  • 33
  • 41