ffmpeg 在转换期间不复制 FRONT_COVER 图像元数据

ffmpeg 在转换期间不复制 FRONT_COVER 图像元数据

当进行 mp3 → mp3(或 flac → mp3)转换时,-map_metadata可用于将元数据从输入文件复制到输出文件:

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

但是,当我使用它时,我注意到它没有正确复制所有元数据。使用工具eyeD3,我检查输入和输出文件看到:

$ 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
--------------------------------------------------------------------------------

具体来说,它没有FRONT_COVER正确复制图像 - 不知何故它在途中被丢弃。

如何确保FRONT_COVER Image在转换过程中被复制?

答案1

封面被视为具有特殊配置的视频流。使用-vn将禁用其处理。

使用 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}"

相关内容