【发布时间】:2021-01-31 08:21:14
【问题描述】:
我有一个 ffmpeg 命令,我试图在 python 中运行。在 wsl 或 bash 中调用它可以正常工作。
命令:
ffmpeg -y -i C:/Users/joel/src/tldr-dw/src/test/video_editor/input.mp4 -lavfi '[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16,scale=1920x1080' -vb 5m C:/Users/joel/src/tldr-dw/src/test/video_editor/input_output.mp4
但是,我试图让它在 python 中运行。我这样调用它:
subprocess.check_output([r'C:\Windows\SysNative\bash.exe', '-c', bash_command], shell=True)
但收到一条错误消息:
C:/Users/joel/src/tldr-dw/src/test/video_editor/input.mp4: Protocol not found Did you mean file:C:/Users/joel/src/tldr-dw/src/test/video_editor/input.mp4?
我尝试将“文件”附加到输入/输出路径,甚至切换到 Windows 行尾。当我做后者时,它似乎逃脱了斜线。我收到此错误消息:
C:Usersjoelsrctldr-dwsrctestvideo_editorinput.mp4: Protocol not found Did you mean file:C:Usersjoelsrctldr-dwsrctestvideo_editorinput.mp4?
本质上,我要做的只是从命令提示符在 ffmpeg 中运行 bash 命令。我在那里收到类似的错误消息。文件路径是怎么回事?
【问题讨论】: