Trim the first 100ms of the video to avoid the noise problem
This commit is contained in:
@@ -90,6 +90,18 @@ start_screenrecording() {
|
|||||||
toggle_screenrecording_indicator
|
toggle_screenrecording_indicator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trim_first_frame() {
|
||||||
|
local latest=$(ls -t "$OUTPUT_DIR"/screenrecording-*.mp4 2>/dev/null | head -1)
|
||||||
|
if [[ -n $latest ]]; then
|
||||||
|
local trimmed="${latest%.mp4}-trimmed.mp4"
|
||||||
|
if ffmpeg -y -ss 0.1 -i "$latest" -c copy "$trimmed" -loglevel quiet 2>/dev/null; then
|
||||||
|
mv "$trimmed" "$latest"
|
||||||
|
else
|
||||||
|
rm -f "$trimmed"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
stop_screenrecording() {
|
stop_screenrecording() {
|
||||||
pkill -SIGINT -f "^gpu-screen-recorder" # SIGINT required to save video properly
|
pkill -SIGINT -f "^gpu-screen-recorder" # SIGINT required to save video properly
|
||||||
|
|
||||||
@@ -106,6 +118,7 @@ stop_screenrecording() {
|
|||||||
notify-send "Screen recording error" "Recording process had to be force-killed. Video may be corrupted." -u critical -t 5000
|
notify-send "Screen recording error" "Recording process had to be force-killed. Video may be corrupted." -u critical -t 5000
|
||||||
else
|
else
|
||||||
cleanup_webcam
|
cleanup_webcam
|
||||||
|
trim_first_frame
|
||||||
notify-send "Screen recording saved to $OUTPUT_DIR" -t 2000
|
notify-send "Screen recording saved to $OUTPUT_DIR" -t 2000
|
||||||
fi
|
fi
|
||||||
toggle_screenrecording_indicator
|
toggle_screenrecording_indicator
|
||||||
|
|||||||
Reference in New Issue
Block a user