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. # Define context names and status.
local from="${target##*.}" local from="${target##*.}"
local to="${format}" local to="${format}"
local status="[${count}/${total}] ${target} -> ${target%.*}.${to}"
local output="${target#../}" local output="${target#../}"
output="${output%.*}"
output="${output}.${to}"
local status="[${count}/${total}] ${target} -> ${output}"
# Show status. # Show status.
echo -e "${status}" echo -e "${status}"
@ -48,27 +50,21 @@ transcode()
# Send convert. # Send convert.
case "${from}-${to}" in case "${from}-${to}" in
"gz-xz"|"tgz-txz") "gz-xz"|"tgz-txz")
output="${output%gz}xz"
_transcode_gz-xz "${target}" "${output}" _transcode_gz-xz "${target}" "${output}"
;; ;;
"xz-gz"|"txz-tgz") "xz-gz"|"txz-tgz")
output="${output%xz}gz"
_transcode_xz-gz "${target}" "${output}" _transcode_xz-gz "${target}" "${output}"
;; ;;
"-mp3") "-mp3")
output="${output%.*}.mp3"
_transcode_mp3 "${target}" "${output}" _transcode_mp3 "${target}" "${output}"
;; ;;
"-flac") "-flac")
output="${output%.*}.flac"
_transcode_flac "${target}" "${output}" _transcode_flac "${target}" "${output}"
;; ;;
"-mka") "-mka")
output="${output%.*}.mka"
_transcode_mka "${target}" "${output}" _transcode_mka "${target}" "${output}"
;; ;;
"-mkv") "-mkv")
output="${output%.*}.mkv"
_transcode_mkv "${target}" "${output}" _transcode_mkv "${target}" "${output}"
;; ;;
*) *)
@ -121,7 +117,7 @@ _transcode_mkv()
local braudio=$(_ffprobe_ba "${1}") local braudio=$(_ffprobe_ba "${1}")
[[ ${braudio} -gt 128 ]] && braudio=128 [[ ${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() _ffprobe_fps()