[GH-ISSUE #9] [touhou_bad_apple_v4.5.py] pygame.error: Unrecognized audio format #7

Closed
opened 2026-10-13 19:43:30 +00:00 by bsakaguchi · 9 comments
Owner

Originally created by @0n1cOn3 on GitHub (Jun 10, 2021).
Original GitHub issue: https://github.com/rkk-2s/bad-apple/issues/9

Hey :) Its been a while since my last ticket :)
I have a new one for yaa. Even when this project was a weekend project. im still amazed about your progress..

It seems to be that there is something wrong with the audio format...

see log:

python3 touhou_bad_apple_v4.5.py

Select option:

  1. Play
  2. Exit
    ==============================================================
    Your option: 1
    Please enter the video file name (file must be in root!): BadApple.mp4
    MoviePy - Writing audio in audio.mp3
    MoviePy - Done.
    Beginning ASCII generation...
    Progress: [####################### ] 99% Frame 6570 of 6571 framesASCII generation completed! ASCII generation time: 28.546977519989014Traceback (most recent call last):
    File "touhou_bad_apple_v4.5.py", line 181, in
    main()
    File "touhou_bad_apple_v4.5.py", line 170, in main
    play_audio('audio.mp3')
    File "touhou_bad_apple_v4.5.py", line 24, in play_audio
    pygame.mixer.music.load(path)
    pygame.error: Unrecognized audio format
Originally created by @0n1cOn3 on GitHub (Jun 10, 2021). Original GitHub issue: https://github.com/rkk-2s/bad-apple/issues/9 Hey :) Its been a while since my last ticket :) I have a new one for yaa. Even when this project was a weekend project. im still amazed about your progress.. It seems to be that there is something wrong with the audio format... see log: python3 touhou_bad_apple_v4.5.py ============================================================== Select option: 1) Play 2) Exit ============================================================== Your option: 1 Please enter the video file name (file must be in root!): BadApple.mp4 MoviePy - Writing audio in audio.mp3 MoviePy - Done. Beginning ASCII generation... Progress: [####################### ] 99% Frame 6570 of 6571 framesASCII generation completed! ASCII generation time: 28.546977519989014Traceback (most recent call last): File "touhou_bad_apple_v4.5.py", line 181, in <module> main() File "touhou_bad_apple_v4.5.py", line 170, in main play_audio('audio.mp3') File "touhou_bad_apple_v4.5.py", line 24, in play_audio pygame.mixer.music.load(path) pygame.error: Unrecognized audio format
Author
Owner

@rkk-2s commented on GitHub (Jun 10, 2021):

Hi there, are you running it specifically for the purpose of Bad Apple or just for a generic video? Also, it would be great if you could tell me what environment you are running this on.

<!-- gh-comment-id:858618909 --> @rkk-2s commented on GitHub (Jun 10, 2021): Hi there, are you running it specifically for the purpose of Bad Apple or just for a generic video? Also, it would be great if you could tell me what environment you are running this on.
Author
Owner

@0n1cOn3 commented on GitHub (Jun 10, 2021):

Specific for the Bad Apple video purpose.
OS: Ubuntu 20.04
Shell: zsh/bash
Python: 3.8.10
pip: 20.0.2
SDL: 2.0.14

<!-- gh-comment-id:858726185 --> @0n1cOn3 commented on GitHub (Jun 10, 2021): Specific for the Bad Apple video purpose. OS: Ubuntu 20.04 Shell: zsh/bash Python: 3.8.10 pip: 20.0.2 SDL: 2.0.14
Author
Owner

@0n1cOn3 commented on GitHub (Jun 10, 2021):

I'm not sure if I understand this correctly:

I see the variable "path_to_file" but the variable in
def play_audio
in
pygame.mixer.music.load()
is set as (path).

Could this not be a problem?

PS: Oh, thats on V3.0 🤦🏻‍♂️ But same error there.

<!-- gh-comment-id:858736113 --> @0n1cOn3 commented on GitHub (Jun 10, 2021): I'm not sure if I understand this correctly: I see the variable "path_to_file" but the variable in def play_audio in pygame.mixer.music.load() is set as (path). Could this not be a problem? PS: Oh, thats on V3.0 🤦🏻‍♂️ But same error there.
Author
Owner

@rkk-2s commented on GitHub (Jun 13, 2021):

No I don't think that is really the issue, though I have to admit when it comes to naming conventions I am terribly garbage at this. Though, if you wish just to play for Bad Apple, I would recommend that you try v4.0 instead, as it would use a pre-existing audio file instead of extracting it from the .mp4 file.

Not too sure why, but there seems to be some error when it comes to generating the audio file in Linux environments. Might be the moviepy.editor library requiring some dependencies that Linux lacks. Though I would see if I could resolve the issue on my end.

<!-- gh-comment-id:860164558 --> @rkk-2s commented on GitHub (Jun 13, 2021): No I don't think that is really the issue, though I have to admit when it comes to naming conventions I am terribly garbage at this. Though, if you wish just to play for Bad Apple, I would recommend that you try v4.0 instead, as it would use a pre-existing audio file instead of extracting it from the .mp4 file. Not too sure why, but there seems to be some error when it comes to generating the audio file in Linux environments. Might be the `moviepy.editor` library requiring some dependencies that Linux lacks. Though I would see if I could resolve the issue on my end.
Author
Owner

@0n1cOn3 commented on GitHub (Jul 13, 2021):

Version 4.0 spites the same error btw. 🥴🥴

<!-- gh-comment-id:879002918 --> @0n1cOn3 commented on GitHub (Jul 13, 2021): Version 4.0 spites the same error btw. 🥴🥴
Author
Owner

@rudy3333 commented on GitHub (Apr 17, 2022):

Pygame.mixer will not load .MP3 files, because of licensing restrictions. You need to convert them to .wav or .ogg.
Try this online tool.

<!-- gh-comment-id:1100884813 --> @rudy3333 commented on GitHub (Apr 17, 2022): Pygame.mixer will not load .MP3 files, because of licensing restrictions. You need to convert them to `.wav` or `.ogg`. Try [this](https://mp3cutterpro.com/en1/convert-mp3-to-wav) online tool.
Author
Owner

@0n1cOn3 commented on GitHub (Apr 17, 2022):

Everything is working as now.
It has just at the end a small side effect:

When the video ends, Python spits an error

As mentioned here

<!-- gh-comment-id:1100885244 --> @0n1cOn3 commented on GitHub (Apr 17, 2022): Everything is working as now. It has just at the end a small side effect: When the video ends, Python spits an error As [mentioned](https://github.com/CalvinLoke/bad-apple/issues/10) here
Author
Owner

@rudy3333 commented on GitHub (Apr 17, 2022):

I'm pretty sure that's normal, because of automatically generated array.

<!-- gh-comment-id:1100888123 --> @rudy3333 commented on GitHub (Apr 17, 2022): I'm pretty sure that's normal, because of automatically generated array.
Author
Owner

@0n1cOn3 commented on GitHub (May 13, 2023):

I'm pretty sure that's normal, because of automatically generated array.

Can this be avoided?

<!-- gh-comment-id:1546759596 --> @0n1cOn3 commented on GitHub (May 13, 2023): > I'm pretty sure that's normal, because of automatically generated array. Can this be avoided?
Sign in to join this conversation.
No labels
pull-request
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
rkk-2s/bad-apple#7
No description provided.