Skip to content

Add cinematic post-processing tools and fix teeth-whitening artifact - #423

Open
gonzabotmdp wants to merge 1 commit into
TMElyralab:mainfrom
gonzabotmdp:add-cinematic-postprocessing-tools
Open

Add cinematic post-processing tools and fix teeth-whitening artifact#423
gonzabotmdp wants to merge 1 commit into
TMElyralab:mainfrom
gonzabotmdp:add-cinematic-postprocessing-tools

Conversation

@gonzabotmdp

Copy link
Copy Markdown

Summary

Adds a set of post-processing scripts for the generated talking-head videos, plus a small fix for an existing artifact.

  • scripts/cinematic_postprocess.py: applies a depth-aware background blur (circular bokeh via a disk kernel, not a plain gaussian) so the background looks like it was shot with a fast lens. The sharp/subject region follows a full-person segmentation mask (MediaPipe Selfie Segmentation) instead of only the face — this keeps hair sharp too, which a face-only mask does not. Also applies a light, generic cinematic color grade (contrast curve, saturation, vignette, subtle chromatic aberration, minimal film grain) and exports with settings recommended for Instagram (H.264 + faststart, AAC stereo 48kHz).
  • scripts/gfpgan_postprocess.py, scripts/realesrgan_only_postprocess.py, scripts/codeformer_postprocess.py: alternative face/background restoration post-processing options (GFPGAN, Real-ESRGAN, CodeFormer), useful as points of comparison for anyone deciding which restoration approach fits their use case.
  • musetalk/utils/blending.py: adds _correct_teeth_whiteness(), a small correction for an artifact where generated teeth can come out unnaturally bright/white. It only affects very bright, low-saturation pixels in the lower half of the face crop, so skin and lips (which already blend correctly) are untouched.
  • download_weights.sh: minor fix.

Test plan

  • Ran scripts/cinematic_postprocess.py end-to-end on generated MuseTalk output at 1080x1920, confirmed background blur follows the depth map, subject mask keeps hair/face fully sharp, and the exported file plays correctly with proper audio sync.
  • Ran the GFPGAN/Real-ESRGAN/CodeFormer variants for comparison on the same source video.
  • Verified the teeth-whitening correction visually on frames where the artifact was previously visible, confirming no change to skin/lip regions.

🤖 Generated with Claude Code

- musetalk/utils/blending.py: attenuate the artificial bright-white teeth
  MuseTalk sometimes generates in the mouth region, without touching skin
  or lips (which already blend well).
- scripts/cinematic_postprocess.py: depth-aware background blur (circular
  bokeh, not gaussian) with a full-subject sharp mask (MediaPipe Selfie
  Segmentation, so hair is kept sharp too, not just face skin), plus a
  light cinematic color grade and an Instagram-optimized export (AAC
  stereo 48kHz, H.264 with faststart).
- scripts/gfpgan_postprocess.py, scripts/realesrgan_only_postprocess.py,
  scripts/codeformer_postprocess.py: alternative face/background
  restoration post-processing options, useful for comparison.
- download_weights.sh: small fix.
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.

1 participant