M3U8 Playlist export (UTF-8 encoded playlists)

Mp3tag doesn’t (yet?) have built-in support for playlists with files that have Unicode filenames.

Unfortunately, the ».m3u« playlist format was an »ad-hoc« creation by Nullsoft (the former Winamp people) a long time ago, and there are no official specs. Nevertheless, the general consensus nowadays seems to be that M3U only supports the Latin-1 (ISO-8859-1) character set while the (newer) ».m3u8« format supports UTF-8 encoding.

Many programs like Mp3tag will even silently try to convert UTF-encoded file paths to ISO-8859-1 (and fail), resulting in entries like:

#EXTINF:30,Alfred E. Moonbase - Test #08: HebRus / ????? / ???????
D:\Temp\Testdaten\MusicIP\Moonbase, Alfred E. - Test #08_ HebRus _ ????? _ ???????.mp3

(from my test case), which should have been:

#EXTINF:30,Alfred E. Moonbase - Test #08: HebRus / עברית / Русский
D:\Temp\Testdaten\MusicIP\Moonbase, Alfred E. - Test #08_ HebRus _ עברית _ Русский.mp3

Programs like iTunes, Winamp, foobar2000 and the like also tend to differentiate between ».m3u« and ».m3u8« playlists and simply skip any non-Latin-1 entries in ».m3u« files.

So for those of you who really need playlists that support UTF-8 (Unicode) encoding (for instance if you use Unicode filenames like above), here are two exports that do exactly that:

M3U8 Playlist, absolute file paths.mte

$loop(%_counter%)#EXTINF:%_length_seconds%,%artist% - %title%

M3U8 Playlist, relative file paths.mte

$loop(%_counter%)#EXTINF:%_length_seconds%,%artist% - %title%

These need to be copied to the folder %APPDATA%\Mp3tag\export</b> for Mp3tag to recognise. This is usually something like C:\Documents and Settings\yourusername\Application Data\Mp3tag\export</i>.

In Mp3tag, you can now sort and mark files however you wish, right-click on the selected items, select »Export…« and »M3U8 Playlist, absolute file paths« (or »M3U8 Playlist, relative file paths«). Then give the new playlist a name and save it. Presto!

The playlist will be saved as ".m3u8" format, with UTF-8 encoding.

Under File -> Options -> Export, you should probably select
[x] Write BOM
so programs like Mp3tag, Windows Editor and Winamp can easily detect the encoding.

At least on my system here, Mp3tag (v2.42c) can even read ".m3u8" files back correctly.

Hi Moonbase,

thank you for creating this very useful script. I was wondering: is there a way for you to make the script so that when I hit the playlist-creation button in mp3tag both *.m3u and *.m3u8 will get created at the same time? This would be useful for me as I sometimes use applications that only read the oldschool m3u files.

Thank you.


Unfortunately not. The above is just a kludge until we may get built-in .m3u8 support (or not).

So I have taken the above code and used it to export playlist on my Sansa running Rockbox which works well enough except that in defining the relative path the playlist end up looking like this:

#EXTINF:3258,Amber MacArthur and Leo Laporte - net@night 140: Please Rob Me
F:\MUSIC\Amber MacArthur and Leo Laporte\TWiT.TV\net@night 140 Please Rob Me.mp3

Where I need them to look like this when stored on the MicroSD card:

#EXTIN\<microSD1>3483,Amber MacArthur and Leo Laporte - net@night 140: Please Rob Me
\<microSD1>\MUSIC\Amber MacArthur and Leo Laporte\TWiT.TV\net@night 140 Please Rob Me.mp3

And like this when stored on the internal memory:

..\MUSIC\Amber MacArthur and Leo Laporte\TWiT.TV\net@night 140 Please Rob Me.mp3
..\MUSIC\Amber MacArthur and Leo Laporte\net@night\net@night 140 Please Rob Me.mp3

The last thing I am is a coder however I'm not completly lost here but could use some help in defining out the variables in the code above to create two new export scripts, one for internal and one for microsd stored music.

How would I edit the above code to write "<microSD1>" or ".." and lose the drive lettering from the relative path?

I played with this for a bit and came up with this that works for my internal memory (ugly but works):

$loop(%_counter%)#EXTINF:%_length_seconds%,%artist% - %title%

In doing that I'm not sure similar will work for my SDHC card as I don't just drop the music on it but have it placed in folders based on the years: 80s, 70s, 2k. So to write a similar rule I would have to pickup on the full path to note the /2k/ but I wouldn't want the preceding drive letter also in the playlist.

A post was merged into an existing topic: Russische Musiktitel als .m3u