Search code examples
pythonffmpegsubprocesscall

Disable output in subprocess call ffmpeg


I am currently using the following command in python to convert my .webm file to .ogg

subprocess.call(['ffmpeg', '-i', songfile, songfile + ".ogg"])

This prints out a bunch of output which I don't require, But I cannot disable it using this command.

subprocess.call(['ffmpeg', ' -loglevel quiet','-i', songfile, songfile + ".ogg"])

I get error

Unrecognized option '-log-level quiet'.

How can I disable ffmpeg output here?


Solution

  • subprocess.call docs says

    To suppress stdout or stderr, supply a value of DEVNULL.

    so you might replace

    subprocess.call(['ffmpeg', '-i', songfile, songfile + ".ogg"])
    

    using

    subprocess.call(['ffmpeg', '-i', songfile, songfile + ".ogg"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)