ffmpeg : music_meta use auto-detection.
This commit is contained in:
parent
6239070c6a
commit
abe6f6cf5f
|
@ -483,7 +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.
|
||||
`ffmpeg_music_meta <FORMAT>`|Detect and update music metadata.
|
||||
|
||||
## File.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ ffmpeg_mux_audio()
|
|||
{
|
||||
if [[ "$1" = "" ]]; then
|
||||
echo "usage: ffmpeg_mux_audio <SOUND> <OUTPUT DIR>"
|
||||
return
|
||||
return 2
|
||||
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
|
||||
|
@ -16,7 +16,7 @@ ffmpeg_mux_cover()
|
|||
{
|
||||
if [[ "${1}" = "" ]]; then
|
||||
echo "Usage: ffmpeg_mux_cover <FORMAT> <COVER>"
|
||||
return
|
||||
return 2
|
||||
fi
|
||||
|
||||
local format="${1}"
|
||||
|
@ -28,28 +28,36 @@ ffmpeg_mux_cover()
|
|||
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}"
|
||||
mv out/* .
|
||||
rm -d out/ && rm "${2}"
|
||||
}
|
||||
|
||||
# Change audio artist metadata.
|
||||
# Usage: ffmpeg_music_artist <FORMAT> <ARTIST>
|
||||
ffmpeg_music_artist()
|
||||
# Change music metadata.
|
||||
# Usage: ffmpeg_music_meta <FORMAT>
|
||||
ffmpeg_music_meta()
|
||||
{
|
||||
if [[ "${1}" = "" ]]; then
|
||||
echo "Usage: ffmpeg_music_artist <FORMAT> <ARTIST>"
|
||||
return
|
||||
echo "Usage: ffmpeg_mux_cover <FORMAT> <COVER>"
|
||||
return 2
|
||||
fi
|
||||
|
||||
local format="${1}"
|
||||
local artist="${2}"
|
||||
|
||||
local artist="${PWD%/*}"; artist="${artist##*/}"
|
||||
local album="${PWD##*/}"; album="${album#*_}"
|
||||
local year="${PWD##*/}"; year="${year%%_*}"
|
||||
|
||||
mkdir out
|
||||
|
||||
for file in *.${format}; do
|
||||
ffmpeg -i "${file}" -c copy -metadata "ARTIST=${artist}" -metadata "album_artist=${artist}" ./out/"${file}" || return 1
|
||||
local track="${file%%_*}"
|
||||
local title="${file#*_}"; title="${title%.*}"
|
||||
|
||||
ffmpeg -i "${file}" -c copy -metadata "artist=${artist}" -metadata "album_artist=${artist}" -metadata "album=${album}" -metadata "date=${year}" -metadata "track=${track}" -metadata "title=${title}" ./out/"${file}" || return 1
|
||||
done
|
||||
|
||||
mv out/* . && rm -d out/
|
||||
mv out/* .
|
||||
rm -d out/
|
||||
}
|
||||
|
||||
_ffprobe_fps()
|
||||
|
|
Reference in a new issue