Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Sep 2015
    Posts
    100

    Exporting - manipulating and reimporting extended flac tags (classical)

    Hi,

    I have a collection of flac files, some of long classical operas, which have been converted from dsf. Each track is stored as an individual flac on a Linux system.

    In some cases Musicbrainz does have tags, but these are problematic, either listing artists differently, or providing too much information for each track. For example, a Wagner opera might consist of hundreds of tracks, each listing artists in several different formats, roles, technicians, composer and conductor.

    In my present collection, I have spent quite a lot of time using qoobar, tidying this information, so as to present the performing artists by standard name only and deleting spurious information. The clean-up is still not complete, but is a lot better than what is available directly from MusicBrainz.

    My problem is that now I want to recreate the flacs from dsf at a higher bitrate, as I now have a DAC that will handle 24/176.

    Can anyone help me with steps 1 and 4 of the following (needs to be scripted due to large number of files):

    1. Go through each directory, exporting all the tags (including extended flac tags and artwork) for every existing .flac in the directory and storing.
    2. Delete the flacs
    3. Recreate flacs at the higher bitrate (files will be named identically to the way they were before).
    4. Retag the new flacs using the stored metadata from step 1.

    BR.

    --Marius--

  2. #2
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    2,398
    Quote Originally Posted by Learnincurve View Post
    Hi,

    I have a collection of flac files, some of long classical operas, which have been converted from dsf. Each track is stored as an individual flac on a Linux system.

    In some cases Musicbrainz does have tags, but these are problematic, either listing artists differently, or providing too much information for each track. For example, a Wagner opera might consist of hundreds of tracks, each listing artists in several different formats, roles, technicians, composer and conductor.

    In my present collection, I have spent quite a lot of time using qoobar, tidying this information, so as to present the performing artists by standard name only and deleting spurious information. The clean-up is still not complete, but is a lot better than what is available directly from MusicBrainz.

    My problem is that now I want to recreate the flacs from dsf at a higher bitrate, as I now have a DAC that will handle 24/176.

    Can anyone help me with steps 1 and 4 of the following (needs to be scripted due to large number of files):

    1. Go through each directory, exporting all the tags (including extended flac tags and artwork) for every existing .flac in the directory and storing.
    2. Delete the flacs
    3. Recreate flacs at the higher bitrate (files will be named identically to the way they were before).
    4. Retag the new flacs using the stored metadata from step 1.

    BR.

    --Marius--
    1. In Windows you could use mp3tag to get 1. done - it will export to a csv file on a per directory basis. You would run it from the top level of your music files.
    2. is of course easy
    3. I can't see any way that you would ever be able to do this unless the dsf files have identical names to the existing FLACs and you have a logical directory/folder structure
    4. Not sure
    Vortexbox LMS 7.9 music on QNAP TS419p via NFS iThingys/iPeng/Tablets
    Living Room - SB3 -> Onkyo TS606 - > Celestion Ditton F20s - Zone 2 -> Sony TA FE 320 -> Sennheiser RS 130 & B&W P7
    Office - RPi -> Sony TA FE320 -> Celestion F10s / SB3 -> Onkyo CRN 755 -> Wharfedale Modus Cubes
    Dining Room -> SB Boom Kitchen -> UE Radio (upgraded to SB Radio)
    Bedroom (Bedside) - SB Touch -> Topping TP21 -> AKG Headphones Bedroom (TV) - Amazon Fire TV (SB Player) -> Topping TP20 -> Wharfedale Modus Cubes

  3. #3
    Senior Member
    Join Date
    Dec 2009
    Location
    Oakville,Ontario,CA
    Posts
    171

    Metaflac

    In somehow similar scenarios I've used metaflac tool. You can export all the tags to a file
    Code:
     metaflac --export-tags-to=tagfile.txt someflac.flac
    and once you have new flac, import it back. I would name exported tag files same as flac save for extension. The automation part you would have to script it, I use Perl for that but I'm sure python or others will do as well.
    George

    Transporter->Pathos Logos->Triangle Celius
    Touch->Yamaha RX-V673 -> Paradigm Monitor 7
    2 Duets, 1 Boom RIP, 1 SB3, 1 Touch, 1 Radio, Transporter
    OnePlus3 -> Sennheiser HD 380 Pro
    2 servers -> Ubuntu Linux, NUC and Synology 1 Bay

  4. #4
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    588
    Here's a first stab at a script (bash shell). Since I don't have any DSFs, I can't really test it.
    Code:
    #!/bin/bash
    IFS=$'\n'
    ECHO="echo"
    
    OLD=oldflac
    SRC=dsf
    NEW=newflac
    
    for i in `find $OLD -name \*.flac`; do
    	NF="${i/#$OLD/$NEW}"
            ND="`dirname "$NF"`"	
          	SF="${i/#$OLD/$SRC}"
    	TF="$NF.tag"
    	PF="$NF.jpeg"
    	[ \! -d "$ND" ] && $ECHO mkdir -p "$ND"
    	$ECHO metaflac --no-utf8-convert --export-tags-to="$TF" "$i"
    	$ECHO dsf2flac -i "${SF%flac}dsf" -o "$NF"
    	$ECHO metaflac --no-utf8-convert --import-tags-from="$TF" "$NF"
    	$ECHO rm "$TF"
    	$ECHO metaflac --export-picture-to="$PF" "$i" 2>/dev/null && $ECHO metaflac --import-picture-from="$PF" "$NF" && $ECHO rm "$PF"
    done
    Note:
    - You need two folders: oldflac contains the existing flacs, dsf the source DSFs. The folder/file structure has to be exactly the same (eg oldflac/artist1/song1.flac -> dsf/artist1/song1.dsf etc.)
    - adjust the dsf2flac command with the relevant parameters
    - new flacs will be in folder newflac
    - Not really sure if it actually works, so there is a safety mechanism: As it is, the script will just output the commands, not execute them. Test it, and if you are sure the commands are correct, change the line
    Code:
    ECHO="echo"
    to
    Code:
    ECHO=""
    and test it on a small sample which has a backup
    Last edited by Roland0; 2016-11-22 at 08:07. Reason: added pictures
    [ extGUI4LMS - an alternative web interface: forum / homepage | music visualizer for squeezelite ] [ Howto: build a self-contained LMS | Howto: play Ogg Opus files ]

  5. #5
    Senior Member
    Join Date
    Dec 2009
    Location
    Oakville,Ontario,CA
    Posts
    171
    Quote Originally Posted by Roland0 View Post
    Here's a first stab at a script (bash shell). Since I don't have any DSFs, I can't really test it.
    Code:
    #!/bin/bash
    IFS=$'\n'
    ECHO="echo"
    
    OLD=oldflac
    SRC=dsf
    NEW=newflac
    
    for i in `find $OLD -name \*.flac`; do
    	NF="${i/#$OLD/$NEW}"
            ND="`dirname "$NF"`"	
          	SF="${i/#$OLD/$SRC}"
    	TF="$NF.tag"
    	[ \! -d "$ND" ] && $ECHO mkdir -p "$ND"
    	$ECHO metaflac --no-utf8-convert --export-tags-to="$TF" "$i"
    	$ECHO dsf2flac -i "${SF%flac}dsf" -o "$NF"
    	$ECHO metaflac --no-utf8-convert --import-tags-from="$TF" "$NF"
    	$ECHO rm "$TF"
    done
    and test it on a small sample which has a backup
    What a great and concise sample !

    Perhaps you could also add picture export/import, I believe OP asked for that as well.
    Code:
    metaflac --export-picture-to=
    metaflac --import-picture-from=
    There is also the problem of lyrics (if any), they export as multi lines and import does not handle them as each line should start with a tag name. I usually remove them...
    George

    Transporter->Pathos Logos->Triangle Celius
    Touch->Yamaha RX-V673 -> Paradigm Monitor 7
    2 Duets, 1 Boom RIP, 1 SB3, 1 Touch, 1 Radio, Transporter
    OnePlus3 -> Sennheiser HD 380 Pro
    2 servers -> Ubuntu Linux, NUC and Synology 1 Bay

  6. #6
    Senior Member
    Join Date
    Sep 2015
    Posts
    100
    Quote Originally Posted by matka View Post
    What a great and concise sample !

    Perhaps you could also add picture export/import, I believe OP asked for that as well.
    Code:
    metaflac --export-picture-to=
    metaflac --import-picture-from=
    There is also the problem of lyrics (if any), they export as multi lines and import does not handle them as each line should start with a tag name. I usually remove them...
    Absolutely perfect!

    Thanks all for the excellent discussion, leading to exactly what I was looking for!!

    BR.

  7. #7
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    588
    Quote Originally Posted by matka View Post
    Perhaps you could also add picture export/import, I believe OP asked for that as well.
    I've added it to the original script

    Quote Originally Posted by matka View Post
    There is also the problem of lyrics (if any), they export as multi lines and import does not handle them as each line should start with a tag name. I usually remove them...
    I may have a solution if the assumption that the LYRICS tag is always the last in the export file holds true (not 100% sure about it, obviously)
    However, unless specifically requested, I won't add it as it would make the script even more likely to break.
    [ extGUI4LMS - an alternative web interface: forum / homepage | music visualizer for squeezelite ] [ Howto: build a self-contained LMS | Howto: play Ogg Opus files ]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •