Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add SW_HIDE to ffmpeg subprocess.Popen in windows, please #22627

Open
goodandrewsoft opened this issue Oct 7, 2019 · 2 comments
Open

Please add SW_HIDE to ffmpeg subprocess.Popen in windows, please #22627

goodandrewsoft opened this issue Oct 7, 2019 · 2 comments
Labels

Comments

@goodandrewsoft
Copy link

@goodandrewsoft goodandrewsoft commented Oct 7, 2019

If windows , please add (optionally):
pseudo code

https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/postprocessor/ffmpeg.py#L230

si = None
if (OS == 'windows'):
        SW_HIDE = 0
        STARTF_USESHOWWINDOW = 1
        si = subprocess.STARTUPINFO()
        si.dwFlags = STARTF_USESHOWWINDOW
        si.wShowWindow = SW_HIDE
        
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, startupinfo=si)

for avoid console, if script started in NOT console :)

@steam3d
Copy link

@steam3d steam3d commented Oct 19, 2019

We need this!

@goodandrewsoft
Copy link
Author

@goodandrewsoft goodandrewsoft commented Oct 20, 2019

Temporary solution:
Add before run youtube-dl

import subprocess
class ProxySubprocessPopen(subprocess.Popen):

    if (sys.platform == "win32"):
        # noinspection PyUnresolvedReferences
        def _execute_child(self, args, executable, preexec_fn, close_fds,
                           cwd, env, universal_newlines,
                           startupinfo, *kwargs):
            if startupinfo is None:
                startupinfo = subprocess.STARTUPINFO()
            startupinfo.dwFlags = 1
            startupinfo.wShowWindow = 0
            super(ProxySubprocessPopen, self)._execute_child(args, executable, preexec_fn, close_fds,
                                                             cwd, env, universal_newlines,
                                                             startupinfo, *kwargs)


subprocess.Popen = ProxySubprocessPopen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.