Skip to content

subprocess.Popen spawns visible console windows on Windows when called from a bundled Python app #319

Description

@bohning

⚠️ Please read this carefully and edit the example responses! If you do not fill out this information, your bug report may be closed without comment.

Checklist (please tick all boxes)

  • I am using the latest version of ffmpeg-normalize (run pip3 install --upgrade ffmpeg-normalize)
  • I am using the latest stable version of ffmpeg or a recent build from Git master

Actual behavior
When ffmpeg-normalize is used from a PyInstaller-bundled application on Windows, each normalization run spawns a visible terminal/console window for the ffmpeg subprocess. This makes the application hardly usable when multiple normalizations run concurrently.

ffmpeg-normalize calls subprocess.Popen without passing creationflags=subprocess.CREATE_NO_WINDOW. On Windows, this causes a console window to appear for each subprocess even when the calling application is a windowed (--windowed) PyInstaller bundle with no console of its own.

python
import sys
import subprocess

kwargs = {}
if sys.platform == "win32":
    kwargs["creationflags"] = subprocess.CREATE_NO_WINDOW

subprocess.Popen([...], **kwargs)

Or more robustly, default to CREATE_NO_WINDOW and let callers opt out, since a library spawning visible console windows in a GUI application is never the desired behaviour.

Environment (please complete the following information):

  • [Windows] Your operating system
  • [3.14.3] Your Python version / distribution (python3 --version or python --version)
  • [8.1.2] Your ffmpeg version (ffmpeg -version)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions