From 459dc1ae42c505e450a7007560c63ad5497e31d5 Mon Sep 17 00:00:00 2001 From: Jannik Beyerstedt Date: Mon, 20 Nov 2023 09:33:57 +0100 Subject: [PATCH] zshrc: Add shortcut to compress with ffmpeg By default, ffmpeg uses crf 23 for h.264 encoding, but for screen recordings, higher compression is usually fine too. --- templates/_zshrc.j2 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/templates/_zshrc.j2 b/templates/_zshrc.j2 index dcc0925..e866e9c 100644 --- a/templates/_zshrc.j2 +++ b/templates/_zshrc.j2 @@ -109,3 +109,30 @@ alias git-force-push='git push origin $(git rev-parse --abbrev-ref HEAD) --force # mpv alias mpv="mpv --autofit=70%" + +# stolen from: https://fem.social/@clerie/110275008064297220 +alias nmap-fast-ping='nmap -n --disable-arp-ping -sn $@' + +# ffmpeg shortcuts +ffmpeg_compress() { + if [ -n "$1" ]; then + filename=$1:r + fileext=$1:e + ffmpeg -i $1 -c:v libx264 -preset slow -crf 28 $filename-comp.mp4 + else + echo "ERROR: Please provide a file name" + fi +} +ffmpeg_reencode() { + if [ -n "$1" ]; then + filename=$1:r + fileext=$1:e + if [[ $(uname) == "Darwin" ]]; then + ffmpeg -i $1 -c:v h264_videotoolbox -b:v 6000k $filename-reenc.mp4 + else + ffmpeg -i $1 $filename-reenc.mp4 + fi + else + echo "ERROR: Please provide a file name" + fi +}