简体   繁体   English

FFMPEG 命令在 PowerShell 中有效,但在批处理文件中无效

[英]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.

相关问题 命令在命令行上有效,但在批处理文件中失败 - Command works on command line, but fails in batch file 命令在命令提示符中有效,但在批处理文件中无效 - Command works in Command Prompt but not in a batch file 通过批处理文件启动 powershell 命令 - Starting a powershell command via a batch file Powershell中的批处理文件命令在其他命令提示符下执行 - batch file commands in powershell execute in a different command prompt 替换PowerShell文件中的字符串,然后通过批处理+命令行参数调用它 - Replacing strings in a PowerShell file and then calling it via batch + command line arguments Powershell' 不是内部或外部命令,也不是可运行的程序或批处理文件 - Powershell' is not recognized as an internal or external command, operable program or batch file 使用Powershell的Invoke-Command调用带参数的批处理文件 - Using Powershell's Invoke-Command to call a batch file with arguments 批处理文件未运行,命令从 CMD 工作。 知识产权变更 - Batch File not running, command works from CMD. IP Change 脚本批处理不适用于.bat文件,但如果在命令提示符下编写,则可以使用 - Script batch does not work in a .bat file, but works if written in a command prompt Windows Server 2008命令适用于CMD,但不适用于批处理文件 - Windows Server 2008 command works in CMD but not in batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM