Ffmpeg
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
在轉換過程中被複製?
封面被視為具有特殊性狀的影片流。使用
-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}"