ffmpeg: Preserve audio file metadata

I had a bunch of .opus music files obtained with yt-dlp, painstakingly filled with meta data: Title, artist, lyrics, cover image.

The speaker I wanted to play them on does not have support for the opus codec, so I had to convert the files to .mp3:

mkdir mp3
for i in *.opus; do ffmpeg -i "$i" "mp3/$i.mp3"; done

Unfortunately the meta data were not automatically copied to the mp3 files.

Fortunately is is possible to instruct ffmpeg to copy all of them:

ffmpeg -i in.opus -map_metadata 0:s:a:0 out.mp3

Source: Preserve metadata when converting .opus audio with embedded covers

Written by Christian Weiske.

Comments? Please send an e-mail.