ffmpeg : add ffmpeg_music_artist.

This commit is contained in:
Dmitry Voronin 2023-11-30 02:00:14 +03:00
parent d9414baaa2
commit c965527bfd
2 changed files with 27 additions and 2 deletions

View file

@ -483,6 +483,7 @@ Command|Description
---|---
`ffmpeg_mux_audio <SOUND> <RESULT>`|Mux external audio into one container with video (replaces original audio). Run inside dir with original video. <SOUND> names should be the same for each video.
`ffmpeg_mux_cover <FORMAT> <COVER>`|Mux image into files of specified format.
`ffmpeg_music_artist <FORMAT> <ARTIST>`|Change audio artist metadata.
## File.

View file

@ -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 <FORMAT> <ARTIST>
ffmpeg_music_artist()
{
if [[ "${1}" = "" ]]; then
echo "Usage: ffmpeg_music_artist <FORMAT> <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}")