Optimized screen recording.
This commit is contained in:
1 parent
dcf20842e1
commit
058753ee53
1 file changed
+7
-5
@@ -1,19 +1,21 @@
|
|||||||
#/bin/sh
|
#/bin/sh
|
||||||
|
|
||||||
|
# Adjust the GPU encoding with -c:v hevc_amf
|
||||||
|
# To see the list of available encoders: ffmpeg -encoders | grep -E "h264|hevc"
|
||||||
|
|
||||||
PIDFILE="/tmp/screen_recorder.pid"
|
PIDFILE="/tmp/screen_recorder.pid"
|
||||||
|
|
||||||
mkdir -p ~/Videos
|
mkdir -p ~/Videos
|
||||||
|
|
||||||
# if pkill -0 ffmpeg 2>/dev/null; then
|
|
||||||
|
|
||||||
if [ -f "$PIDFILE" ]; then
|
if [ -f "$PIDFILE" ]; then
|
||||||
kill -2 "$(cat "$PIDFILE")"
|
kill -2 "$(cat "$PIDFILE")"
|
||||||
rm "$PIDFILE"
|
rm "$PIDFILE"
|
||||||
else
|
else
|
||||||
ffmpeg -nostdin -hide_banner -loglevel quiet -nostats \
|
ffmpeg -nostdin -hide_banner -loglevel quiet -nostats \
|
||||||
-f x11grab -framerate 30 -i :0.0 -f pulse \
|
-f x11grab -framerate 24 -i :0.0 -f pulse \
|
||||||
-i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor \
|
-i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor \
|
||||||
-c:v libx264 -preset veryfast -crf 23 -pix_fmt yuv420p -c:a aac \
|
-c:v hevc_amf -c:v libx264 -preset ultrafast -crf 28 \
|
||||||
-b:a 192k ~/Videos/$(date +%Y%m%d_%H%M%S).mp4 &
|
-pix_fmt yuv420p -c:a aac -b:a 128k \
|
||||||
|
~/Videos/$(date +%Y%m%d_%H%M%S).mp4 &
|
||||||
echo $! > "$PIDFILE"
|
echo $! > "$PIDFILE"
|
||||||
fi
|
fi
|
||||||
Reference in new issue
Block a user