I am adding a FFREPORT command on the front of an already working ffmpeg command in python 2.7 on OSX, this is to redirect the report log file, but am getting an error and can't figure out how to fix it.
Here is the command:
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)
This is giving me the error:
raise child_exception
OSError: [Errno 2] No such file or directory
UPDATE:
I have now changed it to incorperate the answer below, but am getting another issue. I need the path of the logfile as a variable, so am trying:
ffreportCommand = 'FFREPORT=level=48:file=' + self.logFilePath
self.process1 = Popen(shlex.split(command), shell=False, env=dict(ffreportCommand))
But am getting the below error:
self.process1 = Popen(shlex.split(command), shell=False, env=dict(ffreportCommand))
ValueError: dictionary update sequence element #0 has length 1; 2 is required
UPDATE: Fixed with:
ffreportCommand = "level=48:file=" + self.logFilePath
self.process1 = Popen(shlex.split(command), shell=False, env=dict(FFREPORT='%s' % ffreportCommand))