diff --git a/.README.md b/.README.md index 63ed85b..0d32141 100644 --- a/.README.md +++ b/.README.md @@ -483,6 +483,7 @@ Command|Description ---|--- `ffmpeg_mux_audio `|Mux external audio into one container with video (replaces original audio). Run inside dir with original video. names should be the same for each video. `ffmpeg_mux_cover `|Mux image into files of specified format. +`ffmpeg_music_artist `|Change audio artist metadata. ## File. diff --git a/.config/bash/module/ffmpeg.sh b/.config/bash/module/ffmpeg.sh index c61fe04..6354098 100644 --- a/.config/bash/module/ffmpeg.sh +++ b/.config/bash/module/ffmpeg.sh @@ -19,15 +19,39 @@ ffmpeg_mux_cover() return fi + local format="${1}" + local cover="${2}" + 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 + for file in *.${format}; do + ffmpeg -i "${file}" -i "${cover}" -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}" } +# Change audio artist metadata. +# Usage: ffmpeg_music_artist +ffmpeg_music_artist() +{ + if [[ "${1}" = "" ]]; then + echo "Usage: ffmpeg_music_artist " + return + fi + + local format="${1}" + local artist="${2}" + + mkdir out + + for file in *.${format}; do + ffmpeg -i "${file}" -c copy -metadata "ARTIST=${artist}" -metadata "album_artist=${artist}" ./out/"${file}" || return 1 + done + + mv out/* . && rm -d out/ +} + _ffprobe_fps() { local fps=$(ffprobe -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate "${1}")