Home > front end >  FFMPEG command works in PowerShell but not in a batch file
FFMPEG command works in PowerShell but not in a batch file

Time:04-27

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/framed.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?

CodePudding user response:

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%d.jpg

CodePudding user response:

...framed.jpg : %0 will be replaced by the current batchfile name, hence '.\tmp_frames\frameC:\Test'

  • Related