Mapping metadata with avconv does not work

The way I understand man avconv (version 9.16-6:9.16-0ubuntu0.14.04.1), the following command should convert input.ogg to output.mp3 and carry over metadata:

avconv -i input.ogg -map_metadata 0 output.mp3

It does not, however; ogginfo clearly shows the information (artist, album, title, …) in input.ogg and id3info confirms that output.mp3 has empty (ID3) tags.

The same happens when converting ogg to flac, or (presumably) any combination of the formats.

Is my understanding of -map_metadata wrong? Is there a way to convert between formats and keep tags (without hardcoding like this)?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Following this answer on Stack Overflow, I tinkered around and found out that the correct parameter depends on the combination of input and output format/codec.

These combinations work as intended:

  • OGG → MP3: -map_metadata 0:s:0
  • FLAC → MP3: -map_metadata 0:g:0
  • FLAC → OGG: -map_metadata 0
    Using -codec libvorbis.

    In case your FLACs contains covers (as stream), add -vn to drop that stream (all video streams, really); the result is otherwise a broken file¹. See here for ways to add cover images back in later.

Since avconv is officially dead now, I’ll note that the same options seem to work with ffmpeg (at least up to 3.4.8).


  1. According to some players, anyway. easyTag would log, “Ogg bitstream contains unknown data”, and Android 12 would refuse to play the file, but VLC would see nothing wrong. So YMMV.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x