transcode : move ffprobe funs to ffmpeg.

This commit is contained in:
Dmitry Voronin 2023-11-28 02:30:13 +03:00
parent 2c46885827
commit cc0158fed3
2 changed files with 22 additions and 20 deletions

View file

@ -27,3 +27,24 @@ ffmpeg_mux_cover()
mv out/* . && rm -d out/ && rm "${2}" mv out/* . && rm -d out/ && rm "${2}"
} }
_ffprobe_fps()
{
local fps=$(ffprobe -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate "${1}")
fps="${fps%%/*}"
echo "${fps}"
}
_ffprobe_keyint()
{
local fps=$(_ffprobe_fps "${1}")
echo $((fps*5))
}
_ffprobe_ba()
{
local ba=$(ffprobe -v error -select_streams a:0 -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1 "${1}")
echo $((ba/1024))
}
export -f _ffprobe_keyint _ffprobe_ba _ffprobe_fps

View file

@ -120,24 +120,5 @@ _transcode_mkv()
ffmpeg -i "${1}" -c:a libopus -b:a ${braudio}k -c:v libsvtav1 -crf 30 -svtav1-params "fast-decode=1:tune=0" -preset 6 -pix_fmt yuv420p10le -g ${keyint} -vf "scale=-2: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 -pix_fmt yuv420p10le -g ${keyint} -vf "scale=-2:min'(1080,ih)'" "${2}"
} }
_ffprobe_fps()
{
local fps=$(ffprobe -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate "${1}")
fps="${fps%%/*}"
echo "${fps}"
}
_ffprobe_keyint()
{
local fps=$(_ffprobe_fps "${1}")
echo $((fps*5))
}
_ffprobe_ba()
{
local ba=$(ffprobe -v error -select_streams a:0 -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1 "${1}")
echo $((ba/1024))
}
# Export. # Export.
export -f transcode _transcode_gz-xz _transcode_xz-gz _transcode_mp3 _transcode_flac _transcode_mka _transcode_mkv _ffprobe_keyint _ffprobe_ba _ffprobe_fps export -f transcode _transcode_gz-xz _transcode_xz-gz _transcode_mp3 _transcode_flac _transcode_mka _transcode_mkv