dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit a81223056dadaf7342e5cfe6a31883a55d436db6
parent ff4452b56930c8cdc2c02422e65a149c016f53df
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Tue,  4 Aug 2020 22:52:36 +0200

ffmpres: preset to optimise video in some way

Former-commit-id: cb850a35f4e353432dd870cde9dab39661ebaeb2
Diffstat:
Mscripts/ffmpres | 17++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/scripts/ffmpres b/scripts/ffmpres @@ -85,7 +85,7 @@ process_audio() { } process_video() { - select to_fmt in "MP4" "MP3" "GIF" "NO AUDIO" "CONCAT" "CLIP" "VOLUME" "FAST" "SLOW" "SCREENSHOT"; do + select to_fmt in "MP4" "MP3" "GIF" "NO AUDIO" "CONCAT" "CLIP" "VOLUME" "FAST" "SLOW" "SCREENSHOT" "OPTIMISE"; do case "$to_fmt" in "MP4") ffmpeg -i "$1" -vcodec copy -qscale 0 -c:s mov_text "${1%%.*}.mp4" @@ -149,6 +149,21 @@ process_video() { read -rp "Timestamp to extract: " ts ffmpeg -ss "$ts" -i "$1" -frames:v 1 -q:v 2 "$1.jpg" break;; + "OPTIMISE") + codec="$(ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$1")" + read -rp "Enter output filename: " outfile + if [ "$codec" = "h264" ]; then + read -rp "Use h265? [Y/n] " -n 1 conf + echo + if [ "$conf" = "Y" ] || [ "$conf" = "y" ]; then + read -rp "CRF value (24..30, lower == higher bitrate): " crf + ffmpeg -i "$1" -vcodec libx265 -crf "$crf" "${outfile:-optimised-$1}" + return + fi + fi + read -rp "CRF value (18..24, lower == higher bitrate): " crf + ffmpeg -i "$1" -vcodec libx264 -crf "$crf" "${outfile:-optimised-$1}" + break;; *) ;; esac