Feature Request: Batch Export Lyrics into Individual Files (.txt / .lrc)

So, lyrics are similar to cover image files, they're either stored as seperate files (.txt / .lrc) or embedded into the Mp3 files (in the USLT frame). Batch exporting lyrics is super useful because there're many tools that facilitate editing lyrics, and those tools can't be used unless the lyrics are exported.

Currently it's possible to batch import lyrics (from .txt or .lrc files) into the USLT frame, but the reverse is not possible. When trying to batch export lyrics using the Export feature, it is unable to do so because the Export feature simply can't produce individual files for each track.

dano wrote a program 10 years ago to workaround this problem , but it's no longer working on the latest version (tested on Mp3tag v3.14). I also feel like this should be a standard feature rather than requiring additional software to do so.

I think it would be a really useful feature to batch export lyrics into files (.txt or .lrc), just like how you can batch export the cover image into files (.jpg, .png, etc.).

Or alternatively, please consider making it possible for the Export feature to produce individual files for each track.

Here is a suggestion how to combine an export script and distribute the resulting output to several files, in this case a playlist.
The secret lies in the command shell batch file that sends text to names files:

Sorry but I can't read non-English and hence can't understand what's being said here.

What exactly should I do if I want to batch export USLT lyrics into individual .lrc files (or is it even possible)?

I'm a newbie to Mp3tag, so a more detailed guide would be greatly appreciated (the lyrics will contain Unicode characters (if that makes any difference), and it'd be best if the "eng||" language code can be removed when exporting)

OK, so perhaps this thread is better for you:

I looked at that thread, it is used to "split a playlist of 1000 songs into 100 playlists of 10 songs", which is fundamentally different from splitting a combined lyrics text file (.txt/.lrc) into their respective individual directories and filenames for each original track:

In the exported big combined lyrics file, the lyrics for each song isn't really divided, it also doesn't contain the directory or the file name of each track, so how do you split and send the individual lyrics into their respective directories and name their respective filenames of the original tracks? (that sounds way too complicated, I guess that's why dano wrote that separate program which unfortunately no longer works)

I think my feature request still makes more sense in this case:

I think it would be a really useful feature to batch export lyrics into files (.txt or .lrc), just like how you can batch export the cover image into files (.jpg, .png, etc.).
Or alternatively, please consider making it possible for the Export feature to produce individual files for each track.

Unless anyone could offer a solution that works.

I still think that the function can already be emulated, even without the detour of a batch file.
So: rename the files so that each file gets an individual folder e.g. with Converter>Tag-Filename
Format string: $num(%track%,2)\%_filename%

Now start the export lrc as suggested in

with the option "1 file per folder"
This should generate an exported lrc-file together with the audio file.
Now rename the _DIRECTORY again so that the track number level is no more part of the path - this joins all the files together in the original folder again, including the lrc-files.
Which is more or less what you were looking for, I think.

So: rename the files so that each file gets an individual folder e.g. with Converter>Tag-Filename
Format string: $num(%track%,2)\%_filename%

That didn't work unfortunately, it puts all my files into a folder called "00". (How do I do that with Convert>Filename-Filename? (because metadata may contain special characters that are not permitted for filename))

I also tried the "One file per directory" option (after manually creating individual folder for each track), but it created .lrc files all in the root directory instead of the directory where the track belongs to.

You need decent data in TRACK - honestly, you can use any field that creates a unique path to a single audio file. E.g. %_counter% may be an alternative for %track%.

Then use an absolute path like
d:\mymusic\%albumartist%\%album%\%_counter%\%_filename%
(which would have to be adapted to your environment)

But the Tools feature can. Like this:

write to file

you can use any field that creates a unique path to a single audio file

That's why I wanted to name the individual folders using the filenames of the individual tracks. (that way, the value is guaranteed to be non-empty, unique (in that folder), and permitted for directory/filename) But I don't know how.

Then use an absolute path like
d:\mymusic%albumartist%%album%%_counter%%_filename%
(which would have to be adapted to your environment)

That would require every one of my thousands tracks to follow a fixed and strict routing standard (with no exception and no flexibility. also some artists/albums names contain special characters that are invalid in directories, so the directories can't match), so it is not very realistic and certainly doesn't work for most people like me. Is it still possible to export to the tracks' original directory when using "One file per directory" (like when you batch export the cover image file)?.

We could discuss now every objection on your side, which, IMHO come from the lack of knowledge of MP3tag functions.
But I doubt that this will be of much use at the moment.

I see some kind of reluctance to accept that there are already ways to achieve the goal.
So, I think in the meantime, until the feature (for which there are already workarounds) is implemented, you are either stuck with the necessity to treat every file individually (which works already now) or wait for the implementation or become acquainted with more variables and functions in MP3tag.
Until there is some progress, I am out.

But the Tools feature can. Like this:

Thanks, so I just tried out the Tools feature, my settings are following:

Name:
Export to LRC
Path:
C:\Windows\System32\cmd.exe
Parameter:
/c echo %UNSYNCEDLYRICS% > "%_folderpath%%_filename%.lrc"

After setting this up, I hit Ctril+1, saw multiple cmd windows flash briefly, but the .lrc is not with the track.

Am I missing something?

No, but I am. :disappointed:
I believe the tool will work with many other fields, but there seems to be something special about %UNSYNCEDLYRICS%.
I suspect it has something to do with the language prefix that Mp3tag adds when saving that field.
With an English installation, "eng||" is added as a prefix whenever I save UNSYNCEDLYRICS.
At least, that is what is displayed.

The pipe (|) is a special character on the Windows command line and must be replaced or escaped.
I tried both methods without success.

And/or invisible formatting, like line feeds and carriage returns used in multi-line data, may cause problems.

Bottom line: I jumped to conclusions without testing for %UNSYNCEDLYRICS%.
The tool might be modified to work with %UNSYNCEDLYRICS%, but it will take a bigger brain than mine. :slightly_smiling_face:

Sorry about that, chief!

I see, is it possible to use some third-party command-line tool besides C:\Windows\System32\cmd.exe , and hopefully some comand-line tools out there can export the %UNSYNCEDLYRICS% frame.

Is this a viable approach?

First, try replacing the parameter in the tool with this:
/c echo $replace(%unsyncedlyrics%,|,^|) > "%_folderpath%%_filename%.lrc"
(I may have jumped the gun again. This will escape the pipe symbol.)

I do not use lyrics in my tags, so I'm unfamiliar with how they are written and how line breaks are implemented.

This new parameter works for a one line value but I don't know how to write lyrics on 1 line and include line breaks.

Maybe, but Mp3tag can use cmd.exe to do it.
@ohrenkino has taught me how.

Here is a possible workflow:

  1. use Tool to create TXT or LRC lyrics file
    Path: C:\Windows\System32\cmd.exe
    Parameter: /U /c echo $regexp($regexp(%unsyncedlyrics%,^\w+\|\|,),\r\n,##) > "%_folderpath%%_filename%.lrc"

  2. edit lyrics file (I use Notepad++)
    -replace ## with \r\n to create separate lines
    -edit as desired
    -replace \r\n with ## to merge separate lines into 1 line

  3. use "Text File - Tag" converter to import edited lyrics into UNSYNCEDLYRICS (%unsyncedlyrics%)

  4. use "Format value" action to re-instate line breaks
    Action: Format value
    Field: UNSYNCEDLYRICS
    Format string: $regexp(%unsyncedlyrics%,##,\r\n)

EDIT: modified Tool parameter by adding Unicode switch (/U) and by using $regexp instead of $replace to replace language prefix.

EDIT: the Unicode switch is not sufficient. see post further down for a work-around

Thanks for your hints, I'm actually looking for a fully automated/batch way because I have thousands of tracks to deal with (and I'm already able to export lyrics for 1 track at a time with 1 click, so your step #2 will actually make the process longer).

I'm currently using a command line tool called "kid3-cli" because it's said to be able to read/export lyrics

So when I place an audio file called "a.mp3" in the same directory as the "kid3-cli.exe", then run:

select a.mp3
get USLT:‘a.lrc’

I can get exported lyrics in the "a.lrc" file (ANSI encoding).
How do I convert the above two lines of command into the "Parameter" field of Mp3tag Tools, so that I can export multiple tracks at once?
(I already set the "Path" to that of "kid3-cli.exe")

That is a question for the people who support Kid3 Tag Editor because it concerns their command line usage.
But I took a few hours and came up with this:

-c select "%_path%" -c "get USLT:''%_filename%.lrc''"

An LRC file will be created beside each selected file.
The single quotes are doubled because they are special characters in Mp3tag and must be escaped to be used literally.

The single quotes are doubled because they are special characters in Mp3tag and must be escaped to be used literally.

Wow I didn't know that, no wonder why my params weren't working, you were super helpful!

I tested your param code and it outputs lrc file for each track, that's awesome! but somehow many Unicode characters (e.g. Korean characters) in lyrics became "?"s (question marks) after the exporting, and EOL characters went from CRLF to CRCRLF, which caused a blank line between each original line.

Could you think of any workaround for these issues?

I hope you've read the documentation for Kid3 Tag Editor.
I glanced at it briefly and found a command that sounds as if it should enable Unicode text to be retrieved.
However, I couldn't use it to retrieve Unicode text.
It is either broken, or doesn't do what I expected, or I haven't figured out how to use it correctly.
Maybe you'll have better luck.

Meanwhile, my original suggestion (using cmd.exe without kid3-cli) can be modified to give Unicode text by adding the Unicode switch (/U).
And that method does not produce extra blank lines.
I've also generalized the parameter so that the tool can be used for tag formats that do not use the language prefix (eg. Vorbis Comments in FLAC files).

Parameter: /U /c echo $regexp($regexp(%unsyncedlyrics%,^\w+\|\|,),\r\n,##) > "%_folderpath%%_filename%.lrc"