Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux script to transfer (ID3) tags from FLAC to MP3

For my media server, I am looking for ways to transfer tags from my FLAC files to MP3.

In a bash script, I can extract tags using metaflac to local vars, but when tagging mp3 with id3v2, I seem to lose national characters (guess it must be unicode?)

Also I need to be able to set replay gain tags, and album art (all present in the FLAC's).

I am looking for a scripted solution to run unattended.

like image 555
TheRoadrunner Avatar asked Dec 03 '22 00:12

TheRoadrunner


1 Answers

If you are interested in a Python solution, the mutagen library looks really good.

It could be as easy as:

from mutagen.flac import FLAC
from mutagen.easyid3 import EasyID3

flacfile = FLAC("flacfile.flac")
mp3file = EasyID3("mp3file.mp3")

for tag in flacfile:
    if tag in EasyID3.valid_keys.keys():
        mp3file[tag] = flacfile[tag]

mp3file.save()

I found this solution for copying mp3 id3 tags into FLAC files.

like image 129
Victor Roetman Avatar answered Dec 18 '22 13:12

Victor Roetman