diff --git a/.config/bash/module/ffmpeg.sh b/.config/bash/module/ffmpeg.sh index 85b0fa3..c61fe04 100644 --- a/.config/bash/module/ffmpeg.sh +++ b/.config/bash/module/ffmpeg.sh @@ -27,3 +27,24 @@ ffmpeg_mux_cover() 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 diff --git a/.config/bash/module/transcode.sh b/.config/bash/module/transcode.sh index f6670c8..82624bc 100644 --- a/.config/bash/module/transcode.sh +++ b/.config/bash/module/transcode.sh @@ -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}" } -_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 -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