So i was making an Audio Player, it downloads audio using YT-DLP and then plays it using pygame.mixer.
the main problem, i am getting is that pygame Won't Run that Audio instead it would Just give Errors for Different Audio Formats like Wav, Ogg, and Mp3.
For Wav Format I get this Error : pygame.error: Unknown WAVE format
For MP3 I get this Error : pygame.error: mpg123_seek: Invalid RVA mode. (code 12)
For Ogg I get this Error : pygame.error: Not an Ogg Vorbis audio stream
After Wondering with these things For a While, I think there is Something Wrong with the Codecs. Attaching images of 2 Audio Files below (One which is playable with pygame, And one which Gives Errors with it)
For Reference
Here is the yt-dlp Code that i used to download the desired Audio File.
from yt_dlp import YoutubeDL
(option,C1,C2,C3)=[dict(extractaudio=True,outtmpl='src/backend/temp_audio/%(title)s.mp3'),'https://youtu.be','https://youtube.com','https://www.youtube.com',]
def download_song(link):
try:
with YoutubeDL(option) as ydl:
ydl.download([link])
except:
print("Error in Downloading : " + link )
pass
Command to install the prerequisite :
python -m pip install yt-dlp
Also for a quick Review, here is the link to the test Audio File i wanted to play .