3

I know how to change a tag value, and how to extract tag values of a file from its metadata, and yes we have great tools like id3tag, exiftool, ffmpeg and etc.

But I need to add a completely new tag, not change an existing one.

For example, consider a situation that we have a .mp3 file and it has 4 tags for its metadata:

1. Artist
2. Album
3. Genre
4. File Size

What I need, is to add a new tag (fifth tag) called Audio Bitrate. Is it possible? If yes so, how should it be done?

Thanks in advance

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Parsa Samet
  • 767
  • 1
  • 7
  • 20

1 Answers1

3

TL;DR You cannot define your own ID3Tags, you must us the ones defined in the spec. Since a tag for Audio Bitrate is not defined, you're out of luck. That is not a problem with other audio containers (ones which use a different tag/comment system).

Your major problem is that ID3 tags are a fixed specification. The best you can get is to write inside the UserDefinedText tag. Let's try this using ffmpeg, let's use the anthem of Brazil which I find quite amusing (and it is copyright free) as an example:

$ wget -O brazil.mp3 http://www.noiseaddicts.com/samples_1w72b820/4170.mp3
$ exiftool -s brazil.mp3
...
Emphasis                        : None
ID3Size                         : 4224
Title                           : 2rack28
Artist                          : 
Album                           : 
Year                            : 
Comment                         : 
Genre                           : Other
Duration                        : 0:01:10 (approx)

OK, we already have some tags in there. ffmpeg time:

$ ffmpeg -i brazil.mp3 -c:a copy -metadata Artist=Someone -metadata MyOwnTag=123 brazil-tags.mp3
$ exiftool -s brazil-tags.mp3 
ExifToolVersion                 : 10.20
...
Emphasis                        : None
ID3Size                         : 235
Title                           : 2rack28
Artist                          : Someone
UserDefinedText                 : (MyOwnTag) 123
EncoderSettings                 : Lavf57.41.100
Album                           : 
Year                            : 
Comment                         : 
Genre                           : Other
Duration                        : 0:01:11 (approx)

To make a comparison against a more flexible format (you should actually use some encoder parameters to get decent audio, but we are not interested in audio):

$ ffmpeg -i brazil.mp3 brazil.ogg
$ exiftool -s brazil.ogg
...
Vendor                          : Lavf57.41.100
Encoder                         : Lavc57.48.101 libvorbis
Title                           : 2rack28
Duration                        : 0:00:56 (approx)

And now tagging with ffmpeg:

$ ffmpeg -i brazil.ogg -c:a copy -metadata MyOwnTag=123 -metadata MyExtraThing=Yay brazil-tags.ogg
$ exiftool -s brazil-tags.ogg 
...
Vendor                          : Lavf57.41.100
Encoder                         : Lavc57.48.101 libvorbis
Title                           : 2rack28
Myowntag                        : 123
Myextrathing                    : Yay
Duration                        : 0:00:56 (approx)

And we have the tags. This is because Vorbis Comments are allowed to be anything, contrary to ID3Tags which have only a number of allowed values (tag names).

You do not need ffmpeg to use Vorbis Comments. vorbiscomment is much simpler to use, for example:

$ vorbiscomment -a -t EvenMoreStuff=Stuff brazil-tags.ogg
$ exiftool -s brazil-tags.ogg 
...
Vendor                          : Lavf57.41.100
Encoder                         : Lavc57.48.101 libvorbis
Title                           : 2rack28
Myowntag                        : 123
Myextrathing                    : Yay
Evenmorestuff                   : Stuff
Duration                        : 0:00:56 (approx)

Extra note: FLAC uses vorbis comments as well.

References:

grochmal
  • 8,489
  • 4
  • 30
  • 60