2023-05-03 07:55:12 +02:00
|
|
|
#!/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 \
|
2023-11-02 22:00:22 +01:00
|
|
|
-crf 21 \
|
2023-05-03 07:55:12 +02:00
|
|
|
-s ${_res} \
|
2023-11-01 18:08:32 +01:00
|
|
|
-pix_fmt yuv420p \
|
2023-11-02 22:00:22 +01:00
|
|
|
-preset fast \
|
2023-05-03 07:55:12 +02:00
|
|
|
-movflags faststart \
|
2023-11-02 22:00:22 +01:00
|
|
|
-threads 8 \
|
2023-05-03 07:55:12 +02:00
|
|
|
"${_outfile}"
|
|
|
|
set +x
|
|
|
|
printf '%s\n' "${_outfile}"
|