pygame.error: Unrecognized music format -- Fedora Linux

Create issue
Issue #85 resolved
bolan created an issue

Hi, when I run the game on Linux, it crashes because of pygame.error: Unrecognized music format

Game version: hg clone

Operating system: Linux-Fedora 18

Arch: AMD64

Python verson: 2.7.3

pygame version: 1.9.1

Console information(if it is hard to read, please check here:

$ python Loading options! Loaded saved options! /home/bo/lost-sky-project/Story of a Lost Sky/lostsky/core/ FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. if emit_target_node: /home/bo/lost-sky-project/Story of a Lost Sky/lostsky/core/ FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. if receive_sources_node: Saving Options! Saved Options! Traceback (most recent call last): File "", line 9, in <module> lostsky.bootstrap() File "/home/bo/lost-sky-project/Story of a Lost Sky/lostsky/", line 99, in bootstrap engine.title_screen() File "/home/bo/lost-sky-project/Story of a Lost Sky/lostsky/core/", line 1879, in title_screen self.all_events_master['Prologue'].execute() File "/home/bo/lost-sky-project/Story of a Lost Sky/lostsky/worldmap/", line 350, in execute File "/home/bo/lost-sky-project/Story of a Lost Sky/lostsky/battle/", line 2025, in turn_loop self.prestart() File "/home/bo/lost-sky-project/Story of a Lost Sky/lostsky/battle/", line 1183, in prestart self.pre_map_MAE.execute() File "/home/bo/lost-sky-project/Story of a Lost Sky/lostsky/missions/", line 127, in execute self.play_music('event01') File "/home/bo/lost-sky-project/Story of a Lost Sky/lostsky/battle/", line 211, in play_music File "/home/bo/lost-sky-project/Story of a Lost Sky/lostsky/core/", line 313, in play_music'music', self.music_catalog[song_name][0])) pygame.error: Unrecognized music format

Thanks for your great work.

Sincerely, Bo

Comments (20)

  1. Rune Devros repo owner


    I have not been able to reproduce this error in Ubuntu Linux (13.04), Python 2.7.3, and Pygame 1.9.1. The game launches and gets into the first scene with music. Are you familiar with there being anything something that Fedora does differently?

    A general search on Stack Overflow, Pygame's mailing list, and just googling for it doesn't turn up much of anything as far as what solutions we can apply.

    Thanks for the bug report. -rune

  2. bolan reporter

    Yes, after clicking the New Game on the main menu, it crashed.

    If I remember correctly, some Fedora software packages does not support MP3 very well, although the non-free decoder has been installed. I see some of your music is MP3 and some is OGG, so which music does it play when we click the New Game button?

  3. Rune Devros repo owner


    The first file played is an Mp3, so I think we could be on the right track there.

    I'd like to confirm that as an issue, so I've attached a couple of test scripts that I was wondering if you could run. One loads an ogg-vorbis file and the other loads an mp3. Both should just display a yellow window that may be exited by pressing any key.

    Can you report if either one crashes?



  4. bolan reporter

    Hi rune,

    The mp3 crashes.

    Actually, I have tried to install smpeg, recompile the SDL_mixer with --enable-music-mp3 --enable-music-ogg, and then, recompile the pygame. The problem still exists.

    $ python
    Traceback (most recent call last):
      File "", line 23, in <module>
      File "", line 11, in main'mp3_file.mp3')
    pygame.error: Unrecognized music format
    $ python
  5. Rune Devros repo owner

    Is what you tried the same as what was done here? This seems to suggest a few solutions to getting playback working on Fedora, but that sounds similar to what you tried.

    Ultimately, though, we're at a point where I think this is beyond my skills to fix. The only reason we need to use mp3 files is because Pygame has a problem that we found in 2009 that hasn't been fixed yet which keeps ogg-vorbis files from looping without major degradation in sound quality and it doesn't affect mp3 files.

    Sorry I couldn't be of any further assistance.

  6. bolan reporter

    I think I did something wrong in the SDL_mixer compiling. Now I just compiled it again, and it works. Thank you for your good work.

  7. Rune Devros repo owner


    I was wondering if you could provide a set of commands used to do the SDL_mixer compiling that you finally got to work? I'd like to have it documented somewhere if this problem comes up in the future.

    Thanks! -rune

  8. bolan reporter


    Delete the Fedora's pygame, SDL_mixer by using "yum remove".

    Download both SDL_mixer and smpeg from here:

    Download pygame from its official website.

    cd /your-path/smpeg
    ./configure --prefix=/usr LDFLAGS='-L/usr/lib64 -lX11'
    make install

    (Assuming that your system is x86_64)


    (probably need)

    cd /your-path/SDL_mixer
    ./configure --prefix=/usr --enable-music-mp3
    make install
    cd /your-path/pygame
    python install
  9. Rémi Verschelde

    This issue is still valid, and the workaround is not really great, you can't expect all Linux users to rebuild SDL_mixer with MP3 support when their distro does not provide it.

    MP3 is a patent encumbered technology, therefore most distributions provide it in separate repos from their core stuff. At Mageia (the distribution for which I would like to package Story of a Lost Sky), we have the MP3 stuff in a repository called "tainted" (understand it as: installing stuff from it might be illegal in the US where they have patents on MP3).

    SDL_mixer is built against free software components such as OGG but not against patent encumbered stuff like MP3.

    The best workaround on your side would be to just convert all your music to OGG, it would work just fine. I tested it here, converting all files in ./music to ogg with ffmpeg, and adapting the corresponding filenames in data/XML/music.xml

    Do you think that's something that you could do or is there a specific reason for using MP3 instead of OGG?

    Anyway, congrats for the 1.0 release, I'll try to get it packaged for Mageia and included in our upcoming Mageia 5 (with OGG music).

  10. Yohann Ferreira

    Hey there,

    please, convert the files to the Ogg vorbis format. I couldn't agree more with Akien here as the mp3 format is preventing the integration of a really great game on certain linux distribution.

    Thanks again for all the work done. :D

    Best regards,

  11. Rune Devros repo owner


    Could you please upload somewhere the Ogg files that you used and can you verify that the sound quality does not degrade on looping?

    We ran into a problem where Ogg vorbis files would degrade significantly on a second loop that I'm not certain has ever been resolved which forced us into MP3.!searchin/pygame-mirror-on-google-groups/ogg$20vorbis/pygame-mirror-on-google-groups/RqsAt2UgQ90/ZQaNYhKuJ9UJ

    I'll have a look to see if new versions of Pygame have fixed this soon.

  12. Rémi Verschelde

    Sure, here they are:

    I used the following command to convert them:

    for file in *.mp3; do
        file=$(echo $file | sed 's/.mp3//')
        ffmpeg -i $file.mp3 -codec:a libvorbis -qscale:a 6 $file.ogg

    The quality level (-qscale:a) can be tuned between 0 and 10, and I've found that 6 produced files with approximately the same size and bitrate as the MP3 files. To really make sure the Ogg quality fits the original MP3s though, a per-MP3 approach might be worth looking into, since you seem to have files with various bitrates (from ~150 to 320 kbps IIRC).

    I'll admit that I did not playtest enough yet to notice if there were issues with looping, I'll try it now.

  13. Rémi Verschelde

    I've been playing Lost Sky with the OGG music yesterday for a good while, and did not notice any issue with looping. I probably did not hear all tracks though, but those used in the main menu, intro, in game menu and first battles.

  14. Yohann Ferreira

    Thanks guys :)

    @featheredmelody To be clearer with everyone and especially packagers, would you mind adding an updated source compressed file and some news about this bug being fixed?

    People would then know they can package the beast without licensing concerns about mp3 using an official upstream tarball / hg tag, and it would permit to remove the Fedora user notice about unrecognized format.

    I'm so happy to see some tactical J-RPG with a complete story out. :D

  15. Rune Devros repo owner

    Hi Bertram25,

    Bitbucket actually automatically generates compressed source files. They're found in the downloads page, under tags or branches. I've wrapped this and a bunch of other ones and called it v1.0.1.

  16. Log in to comment