0

Trying to make an exe. The project uses a lot of packages, such as pydub. I think that pydub in .exe opens the ffmpeg console.

How can I prevent PyQt5 app to show cmd windows?

Edit: Check out the video to see what I mean: https://www.youtube.com/watch?v=9M3rAhZ7f0o

This is the output of print(conversion_command)

['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/airplane landing daniel simion.mp3', '-acodec', 'pcm_s16le', '
-vn', '-f', 'wav', '-']
['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/baby music box daniel simion.mp3', '-acodec', 'pcm_s16le', '-v
n', '-f', 'wav', '-']
['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/cartoon birds 2 daniel simion.mp3', '-acodec', 'pcm_s16le', '-
vn', '-f', 'wav', '-']
['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/cartoon telephone daniel simion.mp3', '-acodec', 'pcm_s16le',
'-vn', '-f', 'wav', '-']
['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/funny voices daniel simon.mp3', '-acodec', 'pcm_s16le', '-vn',
 '-f', 'wav', '-']
['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/News Intro Maximilien 1801238420.mp3', '-acodec', 'pcm_s16le',
 '-vn', '-f', 'wav', '-']
['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/old car engine daniel simion.mp3', '-acodec', 'pcm_s16le', '-v
n', '-f', 'wav', '-']
['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/old school bell daniel_simon.mp3', '-acodec', 'pcm_s16le', '-v
n', '-f', 'wav', '-']
['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/sms alert 5 daniel simon.mp3', '-acodec', 'pcm_s16le', '-vn',
'-f', 'wav', '-']
['ffmpeg', '-y', '-f', 'mp3', '-i', 'C:/python/scripts/Papinhio player/src/diske
t_box/sound_clips/Sony Battery AM Radio Tuning 1 SailorMoonFan 222190110.mp3', '
-acodec', 'pcm_s16le', '-vn', '-f', 'wav', '-']

This output is at the start of the program.

Chris P
  • 2,059
  • 4
  • 34
  • 68
  • pydub is the one that opens the console, not Qt. So Qt cannot and should not do anything to fix an external problem. – eyllanesc Jul 18 '21 at 18:20
  • Looks like pydub is using subprocess to open ffmpeg. See [here](https://github.com/jiaaro/pydub/blob/72b474e0f2e48d37bbe9b8a36c4a055157e53c6b/pydub/audio_segment.py#L616). You need to modify it to pass a STARTUPINFO which disables the console. See [here](https://stackoverflow.com/questions/7006238/how-do-i-hide-the-console-when-i-use-os-system-or-subprocess-call). – Nick ODell Jul 18 '21 at 18:28
  • @NickODell : check out the video in the update. – Chris P Jul 18 '21 at 19:14
  • @ChrisP I watched the video. What was it supposed to convey? – Nick ODell Jul 18 '21 at 19:46
  • Nothing to tell about. I try this: `conversion_command.insert(1,"taskkill //F //IM C://mingw64//bin//"+program_name+".exe")` but i am getting a File Not Found Error. – Chris P Jul 18 '21 at 19:49

1 Answers1

0

I changed line: 740 of file C:/msys64/mingw64/lib/python3.8/subprocess.py'

I set the default value of creationflags (was zero) to be creationflags=0x08000000.

So now there is no console (shown (as I can see)).

Thanks guys a lot.

Chris P
  • 2,059
  • 4
  • 34
  • 68