Search code examples
pythonffmpegffplay

No such filter '"split': ffplay with ffmpeg in Python


I am trying to visualize the YUV histograms of video overlayed with the video using ffmpeg on Python. The code that I use is the following:

subprocess.call(['ffplay','video.mp4','-vf','"split=2[a][b],[b]histogram,format=yuva444p[hh],[a][hh]overlay"'])

But when I execute the code, this error shows up:

enter image description here

It is a bit strange because if run the same line on the command window, it works with no problem.


Solution

  • Remove the double quotes around the filter - subprocess.call automatically adds quotes around arguments with special characters like [, ], =.

    The following command should work:

    subprocess.call(['ffplay','video.mp4','-vf','split=2[a][b],[b]histogram,format=yuva444p[hh],[a][hh]overlay'])
    

    For watching the actual command line, you may add -report argument, and check the log file.

    • subprocess.call(['ffplay','video.mp4','-vf','split=2[a][b],[b]histogram,format=yuva444p[hh],[a][hh]overlay', '-report'])
      Applies:
      ffplay video.mp4 -vf "split=2[a][b],[b]histogram,format=yuva444p[hh],[a][hh]overlay" -report.
      The above command is in correct syntax.

    • subprocess.call(['ffplay','video.mp4','-vf','"split=2[a][b],[b]histogram,format=yuva444p[hh],[a][hh]overlay"', '-report']
      Applies:
      ffplay video.mp4 -vf "\"split=2[a][b],[b]histogram,format=yuva444p[hh],[a][hh]overlay\"" -report
      As you can see, subprocess added extra "\ and \", and this is the cause for your error.