dotfiles/.bin/rec_scr_noaudio
2023-11-01 18:08:32 +01:00

34 lines
748 B
Bash
Executable File

#!/bin/sh
set -e
_vidfile="/home/sdk/rec-screen.mkv"
_outfile="/home/sdk/rec-encoded-$(date "+%Y%m%d_%H%M%S").mp4"
_res="1920x1080"
_fps="24"
_vid_in="-framerate ${_fps} -f x11grab -i :0.0"
_vid_proc="-c:v libx264rgb -crf 0 -qp 0 -framerate ${_fps} -sws_flags neighbor -preset ultrafast -tune zerolatency"
_ffmpeg_param="${_vid_in} ${_vid_proc} ${_mic_proc}"
printf 'Press q to stop.\n'
set -x
ffmpeg -y -loglevel error -hide_banner ${_ffmpeg_param} "${_vidfile}"
set +x
printf 'Encoding...\n'
set -x
ffmpeg -hide_banner -y \
-i "${_vidfile}" \
-c:v libx264 \
-crf 28 \
-s ${_res} \
-pix_fmt yuv420p \
-preset veryfast \
-movflags faststart \
-threads 12 \
"${_outfile}"
set +x
printf '%s\n' "${_outfile}"