# mux audio into containers. file names in sound and current dirrectories must match. tmp usage for anime downloads. # usage: ffmpeg_mux_audio <SOUND> <OUTPUT DIR> ffmpeg_mux_audio() { if [[ "$1" = "" ]]; then echo "usage: ffmpeg_mux_audio <SOUND> <OUTPUT DIR>" return fi for file in *; do ffmpeg -i "$file" -i "$1"/"$file" -c copy -map 0:v:0 -map 1:a:0 -shortest "$2"/"$file"; done } # Mux cover into music file. # Usage: ffmpeg_mux_cover <FORMAT> <COVER> ffmpeg_mux_cover() { if [[ "${1}" = "" ]]; then echo "Usage: ffmpeg_mux_cover <FORMAT> <COVER>" return fi mkdir out for file in *.${1}; do ffmpeg -i "${file}" -i "${2}" -map 0:a -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 mv out/* . && rm -d out/ && rm "${2}" }