Repository navigation
fix(stt): preserve media-clock audio offsets - #1076
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthrough
ChangesAudio timestamp alignment
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Transcription extraction now preserves the audio offset when a video's audio starts later than its video, so word timings stay aligned with the media clock. Standalone audio behavior is unchanged. No merge-blocking risk was found. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
EtienneLescot
left a comment
There was a problem hiding this comment.
Reviewed: aligns the transcript with the export's raw pts; PCM identical for normal recordings. Thanks @satwiksharma01!
Summary
When video starts at 0s but its audio stream starts at 2s, native transcription extraction currently puts the first sound near 0s in the PCM sent to Whisper. Every word timestamp can then be two seconds early, affecting transcript-based cuts.
Decode through
aresample=first_pts=0to preserve the media-clock offset. Two real-FFmpeg regression tests generate tiny lossless media: delayed audio in a video retains two seconds of leading silence, while standalone audio with a nonzero container origin remains relative to its own start. The delayed-audio test fails on the original code.FFmpeg also preserves interior timestamp gaps with this setting. A separate real-binary check confirmed that a 0.5s audio gap adds 8,000 silence samples at 16 kHz. This is media-clock preservation, not an aligner accuracy or performance change. The extraction API remains unchanged.
Related issue
Refs #948
This fixes one extraction clock defect; it does not claim to complete the broader word-timing benchmark or alignment work.
Type of change
Release impact
Desktop impact
Screenshots / video
No UI changes. Behavioral tests assert actual decoded PCM timing.
Testing
Validated with pinned Node 22.22.1, npm 10.9.4 and real FFmpeg 9.0.1. AI assistance was used. Synthetic fixtures validate the source-clock behavior; no native hardware benchmark or full transcription quality result is claimed. FFmpeg's documented
first_ptsbehavior.Summary by CodeRabbit