'FFMPEG command works in PowerShell but not in a batch file
Simply trying to extract frames from a video file using ffmpeg in a .bat file and it doesn't work:
ffmpeg -i video.mp4 -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 tmp_frames/frame%08d.jpg
The error message:
Unable to find a suitable output format for '.\tmp_frames\frameC:\Test' .\tmp_frames\frameC:\Test: Invalid argument
This command works fine in PowerShell by itself, but running it as a batch file yields the above error.
Any ideas on how to fix this in the batch file?
Solution 1:[1]
In the .bat file, you must use the escape code for %, which is %%
ffmpeg -i video.mp4 -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 tmp_frames/frame%%08d.jpg
Solution 2:[2]
...frame%08d.jpg : %0 will be replaced by the current batchfile name, hence
'.\tmp_frames\frameC:\Test'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Klompengard |
| Solution 2 | Magoo |
