transcode : make output universal.

This commit is contained in:
Dmitry Voronin 2023-11-27 20:34:37 +03:00
parent e0614f206c
commit 9cda3d222a

View file

@ -30,8 +30,10 @@ transcode()
# Define context names and status.
local from="${target##*.}"
local to="${format}"
local status="[${count}/${total}] ${target} -> ${target%.*}.${to}"
local output="${target#../}"
output="${output%.*}"
output="${output}.${to}"
local status="[${count}/${total}] ${target} -> ${output}"
# Show status.
echo -e "${status}"
@ -48,27 +50,21 @@ transcode()
# Send convert.
case "${from}-${to}" in
"gz-xz"|"tgz-txz")
output="${output%gz}xz"
_transcode_gz-xz "${target}" "${output}"
;;
"xz-gz"|"txz-tgz")
output="${output%xz}gz"
_transcode_xz-gz "${target}" "${output}"
;;
"-mp3")
output="${output%.*}.mp3"
_transcode_mp3 "${target}" "${output}"
;;
"-flac")
output="${output%.*}.flac"
_transcode_flac "${target}" "${output}"
;;
"-mka")
output="${output%.*}.mka"
_transcode_mka "${target}" "${output}"
;;
"-mkv")
output="${output%.*}.mkv"
_transcode_mkv "${target}" "${output}"
;;
*)
@ -121,7 +117,7 @@ _transcode_mkv()
local braudio=$(_ffprobe_ba "${1}")
[[ ${braudio} -gt 128 ]] && braudio=128
ffmpeg -i "${1}" -c:a libopus -b:a ${braudio}k -c:v libsvtav1 -crf 30 -svtav1-params "fast-decode=1:tune=0" -preset 6 -g ${keyint} -vf "scale=-1:min'(1080,ih)'" "${2}"
ffmpeg -i "${1}" -c:a libopus -b:a ${braudio}k -c:v libsvtav1 -crf 30 -svtav1-params "fast-decode=1:tune=0" -preset 6 -g ${keyint} -vf "scale=-2:min'(1080,ih)'" "${2}"
}
_ffprobe_fps()