Skip to content

fix(audio): stabilize video export and balance sleep narration - #3

Merged
iMyth merged 2 commits into
fix/audio-tail-cutoff-on-exportfrom
codex/stabilize-video-and-sleep-audio
Sep 22, 2026
Merged

iMyth merged 2 commits into
fix/audio-tail-cutoff-on-exportfrom
codex/stabilize-video-and-sleep-audio

Conversation

@iMyth

@iMyth iMyth commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Problem and behavior

Incomplete model-generated HTML could reach the renderer, renderer failures could lose diagnostic output, and failed audio muxing could be reported as a successful silent video. Sleep exports also used inconsistent loudness processing across audio and video, allowing TTS clip levels to vary noticeably.

This change rejects incomplete compositions and retries extraction/post-processing/validation once before reporting failure. Both rendering entry points pin HyperFrames to 0.6.25, use one worker and a shared render lock, capture both output streams to logs, and clean up process groups on timeout. Muxing errors now propagate and successful merges replace the final file only after completion. The fallback timeline uses the actual composition ID, and export progress scaling is corrected.

Sleep audio export and section-audio generation measure each clip and apply bounded fixed gains, leaving silence and unmeasurable quiet material unboosted. Audio and video sleep exports share gentle compression, softened highs, and measured two-pass mastering targeting -21 LUFS / -3 dBTP. Audio mastering runs after BGM mixing and uses a floating-point intermediate; pitch and tempo remain unchanged. Updated English and Chinese descriptions reflect the behavior.

Validation

  • cargo test --offline --lib commands::audio -- --include-ignored: 84 passed, including real FFmpeg/FFprobe integration tests.
  • Synthetic clips differing by approximately 12 dB end within 1 dB after processing; integrated loudness, peaks, quiet gaps and duration are checked.
  • MP4 integration test checks audio/video timing and unchanged compressed video packets.
  • Failure tests verify preservation of an existing output, and concurrent stdout/stderr draining under load.
  • cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check, git diff --check, and translation JSON parsing passed.

Review and rollout notes

  • Stacked on fix(audio): prevent tail truncation during video export #2 (fix/audio-tail-cutoff-on-export); merge fix(audio): prevent tail truncation during video export #2 first, then retarget this PR to main if needed. The diff contains only the follow-up work.
  • Sequential rendering and loudness measurement trade export speed for stability and more consistent levels.
  • Existing section videos receive final sleep mastering on re-export; per-clip leveling requires regenerated section audio.
  • No complete audiobook render or human listening evaluation was performed. Remote composition assets such as CDN scripts remain a network dependency.

@iMyth
iMyth merged commit e3b4306 into fix/audio-tail-cutoff-on-export Sep 22, 2026
3 checks passed
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