For example I am using ffplay and want to run this command -bufsize[:stream_specifier] integer (output,audio,video)
At the moment I have this:
subprocess.call(["ffplay", "-vn", "-nodisp","-bufsize 4096", "%s" % url])
But this says it is invalid.
As JBernardo mentioned in a comment, separate the
"-bufsize 4096"argument into two,"-bufsize", "4096". Each argument needs to be separated whensubprocess.callis used withshell=False(the default). You can also specifyshell=Trueand give the whole command as a single string, but this is not recommended due to potential security vulnerabilities.You should not need to use string formatting where you have
"%s" % url. Ifurlis a string, pass it directly, otherwise callstr(url)to get a string representation.