Skip to content

WIP: fix lipSync beat transition freeze#1278

Closed
isamu wants to merge 2 commits intomainfrom
fix/lipsync-trim-to-audio-duration
Closed

WIP: fix lipSync beat transition freeze#1278
isamu wants to merge 2 commits intomainfrom
fix/lipsync-trim-to-audio-duration

Conversation

@isamu
Copy link
Copy Markdown
Contributor

@isamu isamu commented Mar 13, 2026

Summary

Fixes #1274 — lipSync beats show frozen last frame at transitions.

⚠️ WIP — not ready to merge

  • ✅ Skip tpad=stop_mode=clone for lipSync beats → eliminates frozen frame at beat boundaries
  • adjustVideoDuration (setpts stretch) breaks lip sync — needs different approach
  • ❌ Still frame at end of video not fully resolved

Changes

  • src/actions/movie.tsgetVideoPart() accepts isLipSync param, skips tpad for lipSync beats
  • src/utils/ffmpeg_utils.ts — Added getBufferDuration() and adjustVideoDuration() utilities
  • src/agents/lipsync_replicate_agent.ts — Calls adjustVideoDuration() after lipSync generation

Next steps

  1. Remove or rethink adjustVideoDuration — setpts stretching desynchronizes lip movements from audio
  2. Investigate end-of-video still frame (may be duration calculation issue in movie.ts)
  3. Consider crossfade or accept 0.1-0.3s gap per beat

Test plan

  • Build sample-lipsync2 (4-beat lipSync script) and verify beat transitions
  • Verify lip sync stays in sync with audio
  • Verify no still frame at end of video

🤖 Generated with Claude Code

isamu and others added 2 commits March 12, 2026 15:34
The lipSync model (latentsync) often outputs slightly longer video than
the input audio, causing ~0.2s of frozen frames at the end of each beat.
This is especially noticeable when multiple lipSync beats are concatenated.

Add trimVideoToBuffer() utility and use it in lipSyncReplicateAgent to
trim the output video to exactly match the audio duration.

Fixes #1274

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Skip tpad=stop_mode=clone for lipSync beats (prevents frozen last frame)
- Add adjustVideoDuration to stretch lipSync output to match audio
- Add getBufferDuration utility for probing buffer duration

Known issues:
- setpts stretch breaks lip sync (need different approach)
- Still frame at end of video not fully resolved

Closes #1274

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5dfefd64-ccb3-4a18-9a92-da15d3605d68

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/lipsync-trim-to-audio-duration
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@isamu isamu closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lipSync: last ~0.2s of each beat freezes, causing unnatural transitions

1 participant