splitbrain.org

electronic brain surgery since 2001

extm3u.pl

extm3u.pl generates an extended .m3u playlist from the files in a given directory. The generated playlist can be used with XMMS, Winamp, and other MP3 players. The playlist is printed to stdout. Extended .m3u files contain additional information, such as the length of the song and data from the ID3 tag.

For the curious - it looks like this:

#EXTINF:187,Bob Marley & The Wailers - Keep On Moving
./Bob_Marley_and_The_Wailers/Trilogy_CD3/Keep_On_Moving.mp3

The first number is the length of the song in seconds, then comes the artistname and songname from the ID3-tag.

This script works with .mp3, .ogg and .flac files and requires the following Perl modules:

  • MP3::Info
  • Ogg::Vorbis::Header
  • Audio::FLAC::Header

Download:

Changes:

  • 2011-12-01 – Accept multiple directories or STDIN as input and keep files without extended info if the needed module is missing (thanks to Patrick Hemmer)
  • 2011-01-01 – Support for randomizing the playlist
  • 2010-04-08 – Added FLAC Support (thanks to James John Eaton)
  • 2004-05-30 – Added OGG Vorbis Support (thanks to David Klotz)