I was working through this answer to an FFMPEG question and the command works just fine through the Windows 10 command prompt (I've only changed the input and output filenames):
ffmpeg -i test.mp4 -filter:v "select='gt(scene,0.4)',showinfo" -f null - 2> test.txt
My Python 3 script gives arguments (as a list) to the subprocess.call()
function and works fine for a number of basic FFMPEG operations, but not this one! It seems to be failing at the final null - 2> test.txt
part, with the following error messages depending on how I split the arguments:
[NULL @ 000001c7e556a3c0] [error] Unable to find a suitable output format for 'pipe:'
[error] pipe:: Invalid argument
[error] Unrecognized option '2> test.txt'.
[fatal] Error splitting the argument list: Option not found
[error] Unrecognized option '2>'.
[fatal] Error splitting the argument list: Option not found
Here's the basic list of arguments I've been trying:
args=['C:\\Program Files\\ffmpeg\\ffmpeg.exe',
'-i',
'test.mp4',
'-filter:v "select=\'gt(scene,0.4)\',showinfo"',
'-f null',
'-',
'2>',
'test.txt']
Plus various permutations combining and splitting the last few elements.
Please could somebody help me with the right syntax for running FFMPEG with these arguments through Python 3?
Many thanks - I just can't see where I'm going wrong :(