Overwriting metadata with other existing metadata

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Overwriting metadata with other existing metadata

Zoe Blade
Hi!

So I've got a lot of FLAC files, meticulously maintained using MusicBrainz's Picard.  And from those, I derive a lot of messier, not at all meticulously maintained MP3 files.  I do this using FFMPEG rather than LAME because it preserves the metadata.  FFMPEG is great for this conversion.  Specifically, I wrote some scripts that at their core use this command:

ffmpeg -i "$song" -codec:a libmp3lame -q:a 4 -c:v copy "${song%.flac}.mp3" 2> /dev/null

So far, so good.  The issue is that MP3 players, be they by Apple or Sony or anyone in between, tend to not use the metadata properly.  For example, they pay attention to the "artist" tag when they should instead look at the "album_artist" tag, to group compilations together properly.  Or, better yet, "albumartistsort", which also fixes alphabetisation when it comes to artists whose name starts with "The" and so on.

I can add to the above line something like this:

-metadata artist='Test'

This overwrites the artist tag with custom data, great.  I specifically want to overwrite it with whatever's in the source file's albumartistsort tag.

Is there a way to do this, so I can overwrite one key with the value of another?

This inelegant Bash solution seems to work:

artist=`exiftool "$song" | grep --color=never Albumartistsort | sed 's/^Albumartistsort *: //'`; ffmpeg -i "$song" -metadata artist="$artist" -codec:a libmp3lame -q:a 4 -c:v copy "${song%.flac}.mp3"

But if there's a simpler way to do it in ffmpeg, I'd love to know!

Thanks,
Zoë.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Overwriting metadata with other existing metadata

DopeLabs
players use metadata properly by using artist for artist..

i would not suggest overwriting the artist field because the value from album artist and artist may be different and you could end up with incorrectly tagged files.

to specify a compilation you would use compilation=1.. so maybe if the compilation tag has a value of 1, the player then uses a different field to group the album.

but it depends on the logic of the individual player how it handles grouping of compilations..

not all players have support for the extra fields that itunes uses to visually group tracks together. i use itunes and its nice to have these abilities, but you cant expect the same abilities in other players.

i can say with confidence that players will support the basic tags like artist, title, and album.

instead what i suggest is to simply copy over any and all metadata from the input file with -map_metadata 0

after that, its up to you to use a player that knows how to take advantage of all the metadata...


> On Sep 6, 2018, at 9:53 20AM, Zoe Blade <[hidden email]> wrote:
>
> Hi!
>
> So I've got a lot of FLAC files, meticulously maintained using MusicBrainz's Picard.  And from those, I derive a lot of messier, not at all meticulously maintained MP3 files.  I do this using FFMPEG rather than LAME because it preserves the metadata.  FFMPEG is great for this conversion.  Specifically, I wrote some scripts that at their core use this command:
>
> ffmpeg -i "$song" -codec:a libmp3lame -q:a 4 -c:v copy "${song%.flac}.mp3" 2> /dev/null
>
> So far, so good.  The issue is that MP3 players, be they by Apple or Sony or anyone in between, tend to not use the metadata properly.  For example, they pay attention to the "artist" tag when they should instead look at the "album_artist" tag, to group compilations together properly.  Or, better yet, "albumartistsort", which also fixes alphabetisation when it comes to artists whose name starts with "The" and so on.
>
> I can add to the above line something like this:
>
> -metadata artist='Test'
>
> This overwrites the artist tag with custom data, great.  I specifically want to overwrite it with whatever's in the source file's albumartistsort tag.
>
> Is there a way to do this, so I can overwrite one key with the value of another?
>
> This inelegant Bash solution seems to work:
>
> artist=`exiftool "$song" | grep --color=never Albumartistsort | sed 's/^Albumartistsort *: //'`; ffmpeg -i "$song" -metadata artist="$artist" -codec:a libmp3lame -q:a 4 -c:v copy "${song%.flac}.mp3"
>
> But if there's a simpler way to do it in ffmpeg, I'd love to know!
>
> Thanks,
> Zoë.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".