From c3c0ceae039b8c93449bebc8c4af8192ff937cba Mon Sep 17 00:00:00 2001 From: Jas Singh Date: Tue, 29 Oct 2024 19:20:49 -0700 Subject: [PATCH] Fix recording script to terminate properly. (#399) * Fix recording script * Remove static framerate flag --- services/screen_record.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/services/screen_record.sh b/services/screen_record.sh index d3aff6d..fd57163 100755 --- a/services/screen_record.sh +++ b/services/screen_record.sh @@ -26,10 +26,16 @@ startRecording() { echo "Usage: $0 start screen [screen_name]" exit 1 fi - - GPU_TYPE=$(lspci | grep -E 'VGA|3D' | grep -Ev '00:02.0|Integrated' > /dev/null && echo "" || echo "-encoder cpu") - gpu-screen-recorder -w "$target" -f 60 -a "$(pactl get-default-sink).monitor" -o "$outputPath" $GPU_TYPE & + GPU_TYPE=$(lspci | grep -E 'VGA|3D' | grep -Ev '00:02.0|Integrated' >/dev/null && echo "" || echo "-encoder cpu") + + gpu-screen-recorder \ + -w "$target" \ + -f 60 \ + -k h264 \ + -a "$(pactl get-default-sink).monitor" \ + -o "$outputPath" \ + $GPU_TYPE & echo "Recording started. Output will be saved to $outputPath" } @@ -40,8 +46,10 @@ stopRecording() { exit 1 fi - pkill -f gpu-screen-recorder + pkill -SIGINT -f gpu-screen-recorder + recentFile=$(ls -t "$outputDir"/recording_*.mp4 | head -n 1) + notify-send "Recording stopped" "Your recording has been saved." \ -i video-x-generic \ -a "Screen Recorder" \