Delay between the audio and the video
I’m having an issue with Recordly when recording videos using both the camera and microphone.
The recording starts normally, but the audio gradually becomes out of sync with the video. After some time, there is a noticeable delay between the audio and the video, which makes the final recording difficult to use.
I’m currently using Recordly 3.4 Beta, which is the latest version I have installed.
Could you please let me know if this is a known issue with this version and if there is anything I can do to fix it?
If necessary, I can also provide additional information about my Mac, macOS version, recording settings, or a sample recording showing the synchronization issue. MacOS Tahoe 26.6.1 - Air M5 Thank you for your help.
I'm seeing the exact same symptom described above, and dug into this pretty deeply on my end. Sharing the diagnostic details here since I think they might help even though I couldn't pin down the root cause myself.
Setup: Screen + system audio + mic recorded as one MP4, webcam recorded separately as a second MP4 (standard Recordly recording flow), macOS.
Symptom: Sync is perfect at the start and drifts progressively worse toward the end. By the final seconds there's a multi-second offset between the webcam video and the audio/screen track.
What I ruled out:
-
Not file corruption. I initially suspected a missing moov atom on one file, but that turned out to be a stray file from an earlier, unrelated recording attempt sitting in the same folder. The actual webcam file for this recording opens cleanly with ffprobe/ffmpeg, no errors.
-
Not dropped or duplicated frames. Ran the file through ffmpeg -vf mpdecimate,showinfo (frame-by-frame pixel comparison) and got 0 drops. The image content itself is intact.
-
Not a simple linear clock-rate mismatch. Total duration difference between the screen recording and webcam recording is small (screen: 994.398333s, webcam: 994.254792s, about 0.14s over a ~16.5 min recording), so a straightforward stretch factor should have fixed it if this were constant drift. It didn't. Tried:
- ffmpeg setpts with the exact duration ratio
- ffmpeg -fflags +genpts to force timestamp regeneration
- A full CFR re-encode at the measured effective framerate (23.9268 fps), both with and without B-frames
All of these produced files with verifiably different content (different file size, different hash, different duration/frame count each time), but running the same gap-detection script against frame pts_time values showed the exact same recurring pattern every time: a roughly 1 second jump approximately every 24 frames, consistently across the entire ~994s duration, not concentrated at the start or end.
Where I'm stuck: That recurring pattern shows up identically regardless of how the file is re-encoded or re-timestamped, which doesn't match either "some frames are missing" (ruled out by mpdecimate) or "constant clock drift" (ruled out by the failed linear corrections). I wasn't able to determine whether this is a real artifact in how Recordly writes frame timestamps into the (likely fragmented) MP4 container, or a measurement quirk in how ffprobe reports PTS for this specific encoding. Happy to share the raw file if anyone wants to look at the actual box-level timestamp data.
Ended up having to re-record rather than recover this one. Really like Recordly otherwise, but as it stands this makes any recording with a separate webcam file unreliable for me. Hoping this level of detail helps narrow down where in the pipeline this originates. Thanks for the work on this project.
I hit the same progressive desync on an M4 MacBook Air (macOS 26.5.2, Recordly 1.4.0, native ScreenCaptureKit backend) and dug into the raw files. I think this is the root cause, and it lines up with the measurements above: the video and webcam tracks are the right length, but the microphone audio track is shorter, and it is shorter because dropped buffers were packed together rather than replaced with silence.
Two recordings, window capture of a 5K display, built-in mic, system audio off:
| Recording | Video | Mic audio | Missing |
|---|---|---|---|
| 51 s | 51.10 s | 36.63 s | 14.5 s (28%) |
| 108 s | 107.85 s | 89.68 s | 18.2 s (17%) |
In both files the audio track is one unbroken run of 1024-sample AAC packets (packet count × 1024 / 48000 equals the last timestamp exactly), with normal speech level right up to the final packet, and the webcam file spans the full duration. So the mic ran the whole time; a quarter of its buffers never reached the file and the survivors were written edge to edge. That is why sync is perfect at the start and drifts steadily: every later sample is shifted earlier by the cumulative lost time, the last words play back seconds early, and the tail is silent. It also explains why re-timestamping the video (tried above) can't fix it, since the video isn't the track that's wrong.
Where it happens, in electron/native/ScreenCaptureKitRecorder.swift:
appendAudioSampleBufferreturns silently wheneverinput.isReadyForMoreMediaDatais false, so any mic buffer arriving while the AVAssetWriter is applying back-pressure (video encoder lagging on a large capture) is discarded.- Audio and video callbacks share one serial
sampleHandlerQueue, so heavy per-frame video work (the window-cropCIContextrender) delays audio delivery too. - Nothing inserts silence for the missing time, so the AAC track compacts.
It is not chip-specific; #148 looks like an earlier sighting of the same thing on macOS 15, and the comment on #782 measured the same compaction after pause/resume.
I have a fix ready and will open a PR shortly: deliver audio on its own queue and hop onto the recorder queue, fill any timestamp gap with zeroed LPCM before appending the next buffer, and report drop counts as AUDIO_GAPS on stderr at finalization. With that helper the same setup produces audio and video lengths matching within 10 ms (54.01 s / 54.01 s and 54.41 s / 54.40 s).
Quick way to check whether your recording has this: ffprobe -show_entries stream=codec_type,duration recording-<ts>.mp4 — if the audio stream is shorter than the video stream, it's this bug.
There is a second, independent cause of A/V desync on the macOS ScreenCaptureKit backend that is worth separating from the audio-compaction one above, because the symptom and the fix are different.
In the audio-compaction bug the audio track is shorter than the video and the drift is progressive. In my recordings the audio track is longer than the video and the offset is constant — the whole narration trails the picture by a fixed amount from the first frame. Setup: full-display capture of a 5K display (5120×2880), mic on, system audio off, Recordly 1.4.0, macOS 26.2, M-series.
The source file is correct; the export is not
$ ffprobe -show_entries stream=codec_type,start_time,duration recording-<ts>.mp4
codec_type=video start_time=1.800000 duration=55.021667
codec_type=audio start_time=0.000000 duration=56.757333
The 1.8 s video start_time is legitimate and load-bearing. SCStream only emits frames when something changes, and didOutputSampleBuffer filters to status == .complete, so a static screen at the top of a take produces no frames while the mic is already running. adjustedPresentationTime anchors every track to the first screen sample, so that leading gap is encoded as a real offset: audio sample t and video frame t refer to the same instant, and any player honouring the edit list stays in sync.
The export then discards it. In electron/ipc/export/native-video.ts the video is rendered with
-map 0:v:0 -an -vf fps=fps=${frameRate}:start_time=0,...,setpts=PTS-STARTPTS
setpts=PTS-STARTPTS rebases the video to zero — dropping the 1.800 s. The audio is then muxed in a separate pass (buildNativeVideoAudioMuxArgs) that maps 1:a:0 straight from the source file, where audio already starts at 0, with no matching compensation. On the edited-track path the audio is additionally forced to the video's duration:
[aout]apad,atrim=duration=${duration},asetpts=PTS-STARTPTS[aout_sync]
So the picture moves 1.8 s earlier and the sound does not move at all.
Measured on the resulting export
codec_type=video start_time=0.000000 duration=55.041667
codec_type=audio start_time=0.000000 duration=55.022000
Two things to note. The exported audio is 55.02 s, exactly the video track's duration rather than the source audio's 56.76 s, so the last 1.74 s of speech is cut by the atrim. And cross-correlating the exported audio against the source audio puts the peak at lag 0.000 s — the audio is bit-for-bit where it started, confirming it is the video that was shifted, not the audio that was resampled or compacted.
Net effect: every spoken word lands ~1.8 s after the frame it belongs to, uniformly, for the whole export.
Why it isn't always noticed
The offset equals however long the screen stayed static at the start of the take. Start talking over a moving screen and it is near zero; start on a still screen, or with a countdown over an idle desktop, and it is seconds. That variability is probably why this reads as intermittent.
Suggested fix
Either preserve the offset or remove it symmetrically:
- Read the source video track's
start_timeonce, and when it is non-zero, apply the same shift to the audio input in the mux pass (-itsoffset -<start_time>on the audio input, or a matchingatrim=start=in the filtergraph) — and computeatrim=duration=from the source audio rather than the rebased video duration so the tail is not clipped. - Or drop
setpts=PTS-STARTPTSand keep both tracks on the original timeline, letting the container hold the offset as the recorder wrote it.
The first is the smaller change and keeps outputs starting at zero.
Check whether a given file has this variant
ffprobe -v error -show_entries stream=codec_type,start_time,duration -of default=nw=1 recording-<ts>.mp4
Non-zero video start_time with audio at 0 means the export will be off by that amount. As a stopgap the finished export can be repaired without re-rendering:
ffmpeg -i export.mp4 -ss <video_start_time> -i recording-<ts>.mp4 \
-map 0:v:0 -map 1:a:0 -c:v copy -c:a aac -b:a 192k out-synced.mp4
which also restores the trimmed tail. Happy to open a PR for the mux-pass fix if that direction looks right.