[英]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:简单地尝试在 a.bat 文件中使用 ffmpeg 从视频文件中提取帧,但它不起作用:
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无法为“.\tmp_frames\frameC:\Test”找到合适的 output 格式。\tmp_frames\frameC:\Test:参数无效
This command works fine in PowerShell by itself, but running it as a batch file yields the above error.此命令本身在 PowerShell 中运行良好,但作为批处理文件运行会产生上述错误。
Any ideas on how to fix this in the batch file?关于如何在批处理文件中解决这个问题的任何想法?
In the .bat
file, you must use the escape code for %
, which is %%
在.bat
文件中,您必须使用%
的转义码,即%%
ffmpeg -i video.mp4 -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 tmp_frames/frame%%08d.jpg
...frame%08d.jpg
: %0
will be replaced by the current batchfile name, hence '.\tmp_frames\frame C:\Test ' ...frame%08d.jpg
: %0
将被当前批处理文件名称替换,因此 '.\tmp_frames\frame C:\Test '
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.