0

When doing an mp3 → mp3 (or flac → mp3) conversion, -map_metadata can be used to copy metadata from the input file to the output file:

ffmpeg -hide_banner -loglevel warning -nostats -i "${source}" -map_metadata 0 -vn -ar 44100 -b:a 256k -f mp3 "${target}"

However, when I use this, I notice that it doesn't copy all the metadata correctly. Using the tool eyeD3, I inspecting the input and output files see this:

$ eyeD3 input.mp3 
input.mp3  [ 4.15 MB ]
--------------------------------------------------------------------------------
Time: 01:46 MPEG1, Layer III    [ 320 kb/s @ 44100 Hz - Stereo ]
--------------------------------------------------------------------------------
ID3 v2.3:
title: Track title
artist: Artist Name
album: Album Name
album artist: Various Artists
composer: Composer Name
recording date: 2019
eyed3.id3:WARNING: Non standard genre name: Soundtracks
track: 17/37        genre: Soundtracks (id None)
disc: 1/1
FRONT_COVER Image: [Size: 86555 bytes] [Type: image/jpeg]
Description: 

PRIV: [Data: 42 bytes]
Owner Id: Google/StoreId
PRIV: [Data: 40 bytes]
Owner Id: Google/StoreLabelCode
--------------------------------------------------------------------------------
$ eyeD3 path/to/output.mp3 
/tmp/test.mp3                                                       [ 3.26 MB ]
--------------------------------------------------------------------------------
Time: 01:46 MPEG1, Layer III    [ 256 kb/s @ 44100 Hz - Stereo ]
--------------------------------------------------------------------------------
ID3 v2.4:
title: Track title
artist: Artist Name
album: Album Name
album artist: Various Artists
composer: Composer Name
recording date: 2019
eyed3.id3:WARNING: Non standard genre name: Soundtracks
track: 17/37        genre: Soundtracks (id None)
disc: 1/1
PRIV: [Data: 40 bytes]
Owner Id: Google/StoreLabelCode
PRIV: [Data: 42 bytes]
Owner Id: Google/StoreId
--------------------------------------------------------------------------------

Specifically, it's not copying the FRONT_COVER image correctly - somehow it's being dropped along the way.

How can I ensure that the FRONT_COVER Image is copied during the conversion process?

1 Answer 1

1

The front cover is treated as a video stream with a special disposition. Use of -vn will disable its processing.

Use ffmpeg -hide_banner -loglevel warning -nostats -i "${source}" -map_metadata 0 -c:v copy -disposition:v:0 attached_pic -ar 44100 -b:a 256k -f mp3 "${target}"

1
  • Oh, that's weird - I didn't know that! That seems to work as intended: I've marked it as the accepted answer. Thanks! Aug 18, 2020 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.