Why does ffmeg not write id3 tags?

3

I currently use the following command to pipe a number of .ogg files through ffmpeg

for x in *.ogg; do ffmpeg -i "$x" -ab 320k -write_id3v2 1 "`basename "$x" .ogg`.mp3"; done

It works and prints out the following info

Output #0, mp3, to '10 Ft. Ganja Plant_Bass Chalice_10_Bass Chalice.mp3':
  Metadata:
    TSSE            : Lavf57.83.100
    Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp, 320 kb/s
    Metadata:
      TITLE           : Bass Chalice
      ARTIST          : 10 Ft. Ganja Plant
      GENRE           : Reggae
      DATE            : 2005
      ALBUM           : Bass Chalice
      track           : 10
      encoder         : Lavc57.107.100 libmp3lame

But when I load the files into iTunes, the id3 tags are not there.

I tried using it with and without the -write_id3v2 1 option but it still does not work.

What am I doing wrong?

Franz Skuffka

Posted 2018-04-04T12:02:08.997

Reputation: 33

1Are they visible in other players/taggers? – Gyan – 2018-04-04T12:18:39.317

Answers

5

In your input, metadata is not stored at file/container level (Ogg metadata seems a bit of a mess) but at stream level, inside the 1st stream (as a Vorbis comment).

In your output format, MP3 metadata (ID3 tags) is never per-stream but only per-file. Even though ffmpeg shows all the metadata it has copied for the audio stream, it is unable to store any of it in an MP3 file. (Note how the one frame it does store, TSSE, is shown at file level.)

Use the -map_metadata 0:s:0 to correctly translate the Ogg/Vorbis layout to MP3. As seen in the manual page:

   -map_metadata[:metadata_spec_out] infile[:metadata_spec_in]
   (output,per-metadata)

       [...]

       For example to copy metadata from the first stream of the input file to
       global metadata of the output file:

               ffmpeg -i in.ogg -map_metadata 0:s:0 out.mp3

       To do the reverse, i.e. copy global metadata to all audio streams:

               ffmpeg -i in.mkv -map_metadata:s:a 0:g out.mkv

(Note that fields not recognized by ffmpeg will be mapped to ID3 TXXX frames, which iTunes probably won't show at all, though foobar2000 might.)

user1686

Posted 2018-04-04T12:02:08.997

Reputation: 283 655