ffmpeg Metadata Processing notes

I find myself needing to hack ffmpeg metadata in order to post Gordon Bok’s collection of Kalmyk music.

The files ripped by ITunes contain all sorts of metadata. It can be extracted by a command like this

 ffmpeg -i audiofile.m4a -f ffmetadata audiofile.txt

and the output looks like this, including a bunch of ITunes-specific metadata items, as well as identifying metadata.

;FFMETADATA1
major_brand=M4A
minor_version=0
compatible_brands=M4A mp42isom
genre=Traditional
artist=David Aldakimow
track=1/33
comment=A set of words read by David Aldakimow
compilation=0
gapless_playback=0
title=Bitchken Nar'n Hulsen
iTunSMPB= 00000000 00000840 0000038C 0000000000392034 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Encoding Params=vers
iTunNORM= 000004D2 00000496 00002822 0000261B 00003EDB 00003EDB 0000790F 0000779A 00012953 00012953
iTunes_CDDB_1=E00EAE21+282072+33+150+6517+10314+21481+31673+36187+41725+45411+62757+65265+74788+75826+86603+88011+100139+108513+123302+134002+144814+155800+170366+188088+195103+201742+208548+218405+224654+234477+243742+251851+265693+271935+273970
iTunes_CDDB_TrackNumber=1
album=Kalmyk Disc 1
album_artist=Philadelphia Kalmyks
date=2002
encoder=Lavf61.7.100

It’s possible to update identifying metadata with a command like this.

 ffmpeg -i audiofile.m4a -metadata "genre=Folk" -metadata "date=2003" -codec copy audiofilecopy.m4a

But that strips out the ITunes-specific metadata, yielding the following:

;FFMETADATA1
major_brand=M4A
minor_version=512
compatible_brands=M4A isomiso2
title=Bitchken Nar'n Hulsen
artist=David Aldakimow
album_artist=Philadelphia Kalmyks
album=Kalmyk Disc 1
date=2003
track=1/33
comment=A set of words read by David Aldakimow
genre=Folk
gapless_playback=0
compilation=0
encoder=Lavf61.7.100

However, translating the file to mp3 with a command like updates and preserves the metadata.

ffmpeg -i audiofile.m4a -metadata "genre=Folk" -metadata "date=2003"  audiofile.mp3

Notice that outputting the file to the same .m4a format does not preserve the metadata. Also, -movflags use_metadata_flags doesn’t work.

Leave a Comment