You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the audio-extract module in my PySide6 application and compiling it into an executable using PyInstaller. However, I noticed that a console window kept popping up when the audio-extract function was called.
After some investigation, I found that the console window was appearing due to the subprocess.run() command in the extract_audio function within the audio-extract module. This command is used to run the ffmpeg command in a subprocess, and by default, it opens a console window.
To suppress the console window, I used the subprocess.STARTUPINFO class to control the visibility of the console window. Here's the modified extract_audio function:
importsubprocessdefextract_audio(input_path: str, output_path: str="./audio.mp3", output_format: str="mp3",
start_time: str="00:00:00",
duration: float=None,
overwrite: bool=False):
# ... (rest of your code)# Create a STARTUPINFO objectstartupinfo=subprocess.STARTUPINFO()
# Set the STARTF_USESHOWWINDOW flagstartupinfo.dwFlags|=subprocess.STARTF_USESHOWWINDOW# Set wShowWindow to SW_HIDE to hide the console windowstartupinfo.wShowWindow=subprocess.SW_HIDE# Pass startupinfo to subprocess.runresult=subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=startupinfo)
# ... (rest of your code)
This modification successfully suppressed the console window when the extract_audio function was called.
I wanted to bring this to your attention as other users might encounter the same issue. Perhaps there could be a way to incorporate this solution as an option into the audio-extract module.
And thank you for the great package!
The text was updated successfully, but these errors were encountered:
I'm using the
audio-extract
module in my PySide6 application and compiling it into an executable using PyInstaller. However, I noticed that a console window kept popping up when theaudio-extract
function was called.After some investigation, I found that the console window was appearing due to the
subprocess.run()
command in theextract_audio
function within theaudio-extract
module. This command is used to run theffmpeg
command in a subprocess, and by default, it opens a console window.To suppress the console window, I used the
subprocess.STARTUPINFO
class to control the visibility of the console window. Here's the modifiedextract_audio
function:This modification successfully suppressed the console window when the extract_audio function was called.
I wanted to bring this to your attention as other users might encounter the same issue. Perhaps there could be a way to incorporate this solution as an option into the audio-extract module.
And thank you for the great package!
The text was updated successfully, but these errors were encountered: