ffmpeg : music_cover add support for mka cover art.

This commit is contained in:
Dmitry Voronin 2023-12-03 04:02:44 +03:00
parent 127ea108e0
commit 8bd6946470

View file

@ -24,9 +24,18 @@ ffmpeg_mux_cover()
mkdir out mkdir out
case "${format}" in
"mka"|"mkv")
for file in *.${format}; do
ffmpeg -i "${file}" -attach "${cover}" -map 0 -c copy -metadata:s:t mimetype="image/${cover##*.}" -metadata:s:t:0 filename="cover.${cover##*.}" "./out/${file}" || return 1
done
;;
*)
for file in *.${format}; do for file in *.${format}; do
ffmpeg -i "${file}" -i "${cover}" -map 0 -map 0:-v? -map 1 -codec copy -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" -disposition:v attached_pic ./out/"${file}" || return 1 ffmpeg -i "${file}" -i "${cover}" -map 0 -map 0:-v? -map 1 -codec copy -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" -disposition:v attached_pic ./out/"${file}" || return 1
done done
;;
esac
mv out/* . mv out/* .
rm -d out/ && rm "${2}" rm -d out/ && rm "${2}"
@ -57,6 +66,7 @@ ffmpeg_music_meta()
local title="${file#*_}"; title="${title%.*}"; title="${title//_/ }" local title="${file#*_}"; title="${title%.*}"; title="${title//_/ }"
# echo "${artist}; ${album}; ${year}; ${track}; ${title}" # echo "${artist}; ${album}; ${year}; ${track}; ${title}"
# TODO: make it format-specific.
ffmpeg -i "${file}" -map 0 -c copy -metadata "artist=${artist}" -metadata "album_artist=${artist}" -metadata "album=${album}" -metadata "date=${year}" -metadata "year=${year}" -metadata "date_released=${year}" -metadata "track=${track}" -metadata "part_number=${track}" -metadata "title=${title}" ./out/"${file}" || return 1 ffmpeg -i "${file}" -map 0 -c copy -metadata "artist=${artist}" -metadata "album_artist=${artist}" -metadata "album=${album}" -metadata "date=${year}" -metadata "year=${year}" -metadata "date_released=${year}" -metadata "track=${track}" -metadata "part_number=${track}" -metadata "title=${title}" ./out/"${file}" || return 1
done done