[GH-ISSUE #305] Console flashing bug when compiling & executing ffmpeg operations #267

Closed
opened 2026-02-26 12:21:00 +03:00 by kerem · 7 comments
Owner

Originally created by @nednoodlehead on GitHub (Aug 27, 2022).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/305

Originally assigned to: @nednoodlehead on GitHub.

When compiling a script that includes ffmpeg (only tested while threading), each time an ffmpeg operation is called, a console window opens immediately, then closed (console flashing). This error does NOT occur when in the IDE, which makes me believe that this may be a pyinstaller problem. On the other hand, the path (aka executable) that is calling said command prompt to flash is the .exe of ffmpeg

clicking the "non-ffmpeg test" button (which is just a print statement) does not cause this console error, playing the music that is loaded will cause the console error.

The repo is here: https://github.com/nednoodlehead/ffmpegthreading

The ReadMe includes all the steps to reproduce this bug.

Originally created by @nednoodlehead on GitHub (Aug 27, 2022). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/305 Originally assigned to: @nednoodlehead on GitHub. When compiling a script that includes ffmpeg (only tested while threading), each time an ffmpeg operation is called, a console window opens immediately, then closed (console flashing). This error does NOT occur when in the IDE, which makes me believe that this may be a pyinstaller problem. On the other hand, the path (aka executable) that is calling said command prompt to flash is the .exe of ffmpeg clicking the "non-ffmpeg test" button (which is just a print statement) does not cause this console error, playing the music that is loaded will cause the console error. The repo is here: https://github.com/nednoodlehead/ffmpegthreading The ReadMe includes all the steps to reproduce this bug.
kerem 2026-02-26 12:21:00 +03:00
  • closed this issue
  • added the
    Stale
    label
Author
Owner

@brentvollebregt commented on GitHub (Aug 27, 2022):

Is pydub/ffmepg needed for the minimal reproduceable example? Is there really no way to show this issue without the library? If not, sounds like the issue is related to the library.

<!-- gh-comment-id:1229105201 --> @brentvollebregt commented on GitHub (Aug 27, 2022): Is pydub/ffmepg needed for the **minimal reproduceable example**? Is there really no way to show this issue without the library? If not, sounds like the issue is related to the library.
Author
Owner

@nednoodlehead commented on GitHub (Aug 27, 2022):

pydub is the logical interface I use to interact with ffmpeg. I mention how the compiled ffmpeg code is the problem. Whether that is because of compiling (pyinstaller) issues (works perfectly in IDE) or because ffmpeg is bugging out

<!-- gh-comment-id:1229112675 --> @nednoodlehead commented on GitHub (Aug 27, 2022): pydub is the logical interface I use to interact with ffmpeg. I mention how the compiled ffmpeg code is the problem. Whether that is because of compiling (pyinstaller) issues (works perfectly in IDE) or because ffmpeg is bugging out
Author
Owner

@brentvollebregt commented on GitHub (Aug 27, 2022):

Ok, so pydub is needed for your example - is tkinter and threading relevant to the minimal example? Or are they absolutely needed and the usage of pydub after packaging will only fail when using both tkinter and threading?

Trying to get your example as small as possible to help identify the cause.

<!-- gh-comment-id:1229139011 --> @brentvollebregt commented on GitHub (Aug 27, 2022): Ok, so `pydub` is needed for your example - is `tkinter` and `threading` relevant to the minimal example? Or are they absolutely needed and the usage of pydub after packaging will only fail when using both `tkinter` and `threading`? Trying to get your example as small as possible to help identify the cause.
Author
Owner

@nednoodlehead commented on GitHub (Aug 27, 2022):

After fidgeting with a few different variations of the script, I noticed a few things.
1). Using no tkinter GUI, combined with creating a second thread to sort of behave like the underlying tkinter thread, the bug did not occur. One thread was running, and the other called the ffmpeg operation successfully. I can't pinpoint exactly what differentiates the thread I had running versus the tkinter GUI. Perhaps the GUI is 'waiting' on an action and behaves that

2). Remaking the GUI in pyqt5 also produces the exact same bug. So it's not Tkinter specific

3). Removing threading (although 100% required on project) does indeed produce the bug

Only variable that persists is that a GUI will always produce the bug. I'm strongly assuming that it has something to do with the underlying GUI structure. Perhaps how it handles those sort of 'external' calls like that.

I added the two files (One for a GUI-less window and one for a PyQt5 window) to the repository mentioned previously

<!-- gh-comment-id:1229248702 --> @nednoodlehead commented on GitHub (Aug 27, 2022): After fidgeting with a few different variations of the script, I noticed a few things. 1). Using no tkinter GUI, combined with creating a second thread to sort of behave like the underlying tkinter thread, the bug did not occur. One thread was running, and the other called the ffmpeg operation successfully. I can't pinpoint exactly what differentiates the thread I had running versus the tkinter GUI. Perhaps the GUI is 'waiting' on an action and behaves that 2). Remaking the GUI in pyqt5 also produces the exact same bug. So it's not Tkinter specific 3). Removing threading (although 100% required on project) does indeed produce the bug Only variable that persists is that a GUI will always produce the bug. I'm strongly assuming that it has something to do with the underlying GUI structure. Perhaps how it handles those sort of 'external' calls like that. I added the two files (One for a GUI-less window and one for a PyQt5 window) to the repository mentioned previously
Author
Owner

@brentvollebregt commented on GitHub (Sep 1, 2022):

although 100% required on project

I understand this, but we are trying to figure out the specific issue, not fixing your project sorry

that a GUI will always produce the bug

Saying the issue is related to a "GUI" is very broad, thinking more toward the implementation of the GUI (mechanisms behind it) may offer some insight. Your #1 hints it may not be threading but potentially it's a different scenario.

Are you using the "Console Based" option? (not window based).

You potentially could add a global exception handler to your code (around the start) and output any errors to something like a file.

<!-- gh-comment-id:1234044016 --> @brentvollebregt commented on GitHub (Sep 1, 2022): > although 100% required on project I understand this, but we are trying to figure out the specific issue, not fixing your project sorry > that a GUI will always produce the bug Saying the issue is related to a "GUI" is very broad, thinking more toward the implementation of the GUI (mechanisms behind it) may offer some insight. Your #1 hints it may not be threading but potentially it's a different scenario. Are you using the "Console Based" option? (not window based). You potentially could add [a global exception handler](https://stackoverflow.com/a/6598286/3774244) to your code (around the start) and output any errors to something like a file.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 25, 2022):

This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.

<!-- gh-comment-id:1289873451 --> @github-actions[bot] commented on GitHub (Oct 25, 2022): This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 31, 2022):

Closing issue due to no activity in more than 60 days.

<!-- gh-comment-id:1296437531 --> @github-actions[bot] commented on GitHub (Oct 31, 2022): Closing issue due to no activity in more than 60 days.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#267
No description provided.