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

disabled window creation on windows #790

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

amamic1803
Copy link

If this package is used with PyInstaller --noconsole option, console window still opens when ffmpeg gets run. I added a creation flag to the subprocess.Popen that disables that behaviour (because if the user packages their script with --noconsole option, they probably don't want to see ffmepg output either). Note that this doesn't disable ffmpeg output to console, so if the program is run with the console (or used with PyInstaller without --noconsole flag), ffmpeg output can still be seen, which is in my opinion desirable behaviour. I also added a check so that this flag gets set only under Windows OS because I think the problem is specific to it.

Resolves #686, but in a better way than I first suggested there because using shell=True can be unsafe. This solution is better for described issue.

@austinulfers
Copy link

Would like to second this addition.

@amamic1803
Copy link
Author

This project seems abandoned, no PRs are getting merged. While I will keep my fork with PR open, and you can use it by URL instead of this repository, I think you are better off just using ffmpeg directly. At least that's what I do when I need to do any work with videos. This project would be great if few things (like this PR) could be fixed, but that doesn't seem probable to happen.

@biggestsonicfan
Copy link

I understand this is an ancient PR that's unlikely to be merged, however there are some circumstances in which ffmpeg prompts for user input, such as overwriting an existing file. In that case, the script can not progress and the ffmpeg instance must be force-closed.

Just throwing an edge-case out there in case anyone wishes to take the monumental undertaking of piping it to the python console, lol.

@amamic1803
Copy link
Author

I'm not sure what you are saying, or how it relates to this PR. This PR just disables creation of new terminal window when using PyInstaller. And even then new window is not created but the output is still piped to specified location. Nothing else is changed. If some app has GUI and is packaged with PyInstalller --no-console, then obviously we don't want the terminal popping up. It is up to the dev to check what is ffmpeg output to stdout or stderr which should be piped and easily available. The dev could then potentially implement functionality to ask the user to overwrite the file or whatever.

@biggestsonicfan
Copy link

biggestsonicfan commented Jun 16, 2024

While you are correct, it relates to the PR in the fact that if drop-in-replaced with an existing ffmpeg-python implementation, you can potentially create scripts which hang indefinitely. Someone who wasn't aware that ffmpeg would be trying to ask for user input will simply have a script that will never finish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running without console window?
3 participants