0

Hi i am currently having this python code :

import subprocess
import shlex

cmd = "ffmpeg -v error -i 3.mp4 -f null - 2>error.log"
new_cmd = shlex.split(cmd)
subprocess_cmd = subprocess.list2cmdline(new_cmd)
print(subprocess_cmd)
subprocess.call(new_cmd)

The issue is when i run the code i get the following error:

[NULL @ 0x555594682920] Unable to find a suitable output format for '2>error.log' 2>error.log: Invalid argument

Can anyone please help with this!

1 Answers1

0

Might help someone!

So I tried to solve the above issue using:

import subprocess
import shlex

logFile = "error.log"
video = "corrupted_video.mp4"

cmd = "ffmpeg -v error -i" + video + "-f null"
new_cmd = shlex.split(cmd)
output = subprocess.run(new_cmd, capture_output=True)
with open(logFile, 'w+') as output:
    output.write(str(output))

I dont know this is the best approach but this worked for me right now!