【发布时间】:2015-03-17 13:54:36
【问题描述】:
我在 OSX 上的 python 2.7 中已经工作的 ffmpeg 命令的前面添加了一个 FFREPORT 命令,这是为了重定向报告日志文件,但出现错误并且无法弄清楚如何修复它。
命令如下:
command = 'FFREPORT="level=48:file=/Users/myself/Desktop/TESTFFMPEGOUTPUT.txt" /Users/myself/Desktop/Python/ffmpeg/ffmpeg -i /Volumes/GRAID/TestInput.mov /Volumes/GRAID/TestOutput.mov'
self.process1 = Popen(shlex.split(command), shell=False)
这给了我错误:
raise child_exception
OSError: [Errno 2] No such file or directory
更新:
我现在已将其更改为包含以下答案,但又遇到了另一个问题。我需要将日志文件的路径作为变量,所以我正在尝试:
ffreportCommand = 'FFREPORT=level=48:file=' + self.logFilePath
self.process1 = Popen(shlex.split(command), shell=False, env=dict(ffreportCommand))
但出现以下错误:
self.process1 = Popen(shlex.split(command), shell=False, env=dict(ffreportCommand))
ValueError: dictionary update sequence element #0 has length 1; 2 is required
更新: 修正:
ffreportCommand = "level=48:file=" + self.logFilePath
self.process1 = Popen(shlex.split(command), shell=False, env=dict(FFREPORT='%s' % ffreportCommand))
【问题讨论】:
标签: python macos ffmpeg popen shlex