From 0be4648773841a8502432c70ced3e49a58045c84 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 24 Apr 2026 10:38:37 +0200 Subject: [PATCH] Better guard against scrambled frames in screenrecording on slower systems --- bin/omarchy-cmd-screenrecord | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/omarchy-cmd-screenrecord b/bin/omarchy-cmd-screenrecord index 1e45d4ab..e6538ad7 100755 --- a/bin/omarchy-cmd-screenrecord +++ b/bin/omarchy-cmd-screenrecord @@ -164,12 +164,11 @@ finalize_recording() { latest=$(cat "$RECORDING_FILE" 2>/dev/null) [[ -f $latest ]] || return - # Trim the first frame, and normalize audio to -14 LUFS if present, in a single pass - local args=(-y -ss 0.1 -i "$latest") + # Re-encode to drop scrambled encoder-warmup frames (stream copy can't — it rewinds to the keyframe) + # and normalize audio to -14 LUFS if present, in a single pass + local args=(-y -ss 0.1 -i "$latest" -c:v libx264 -preset veryfast -crf 20) if ffprobe -v error -select_streams a -show_entries stream=codec_type -of csv=p=0 "$latest" 2>/dev/null | grep -q audio; then - args+=(-af loudnorm=I=-14:TP=-1.5:LRA=11 -c:v copy) - else - args+=(-c copy) + args+=(-af loudnorm=I=-14:TP=-1.5:LRA=11) fi local processed="${latest%.mp4}-processed.mp4"