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

[touhou_bad_apple_v4.5.py] pygame.error: Unrecognized audio format #9

Closed
0n1cOn3 opened this issue Jun 10, 2021 · 9 comments
Closed

Comments

@0n1cOn3
Copy link

0n1cOn3 commented Jun 10, 2021

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
@CalvinLoke
Copy link
Owner

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.

@0n1cOn3
Copy link
Author

0n1cOn3 commented 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

@0n1cOn3
Copy link
Author

0n1cOn3 commented 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.

@CalvinLoke
Copy link
Owner

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.

@0n1cOn3
Copy link
Author

0n1cOn3 commented Jul 13, 2021

Version 4.0 spites the same error btw. 🥴🥴

@0n1cOn3 0n1cOn3 closed this as completed Apr 17, 2022
@rudy3333
Copy link

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

@0n1cOn3
Copy link
Author

0n1cOn3 commented 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

@rudy3333
Copy link

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

@0n1cOn3
Copy link
Author

0n1cOn3 commented May 13, 2023

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

Can this be avoided?

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

No branches or pull requests

3 participants