kkroening / ffmpeg-python

Python bindings for FFmpeg - with complex filtering support
Apache License 2.0
10.08k stars 893 forks source link

Avoid console windows for ffprobe.exe and ffmpeg.exe #518

Open padmalcom opened 3 years ago

padmalcom commented 3 years ago

Hi, thank you for your fantastic library! I'm starting my application using pythonw to avoid a console window. When I call ffmpeg to play an mp3-stream a console window for ffprobe.exe is opened as well as a window for ffmpeg.exe. Is there a way to avoid these two console windows?

This is my code: process = ffmpeg.input(source).filter('volume', self._volume).output('pipe:', format='f32le', acodec='pcm_f32le', ac=channels, ar=samplerate, loglevel='quiet').run_async(pipe_stdout=True)

I expected to be loglevel='quiet' to be the solution, but it isn't :-)

Thanks for your help

padmalcom commented 3 years ago

Found out in run.py we can enhance the run_async method by:

startupinfo = None
if os.name == 'nt':
    startupinfo = subprocess.STARTUPINFO()
    startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(command, startupinfo=startupinfo)

Source: https://stackoverflow.com/questions/1016384/cross-platform-subprocess-with-hidden-window