Problem
Currently, BitBonsai applies uniform encoding quality (CRF) across entire videos. This is inefficient because different scenes have vastly different encoding complexity:
- Simple scenes (static content, low detail): Need fewer bits — current approach wastes bits here
- Complex scenes (high motion, grain, high detail): Need more bits to maintain quality — current approach may under-encode here
Proposed Solution
Implement automatic scene complexity analysis before/during encoding that:
- Detect scene changes using FFmpeg's scene detection filter to build a scene complexity map
- Classify scene difficulty based on spatial/temporal complexity metrics
- Adapt CRF per-segment: Apply lower CRF (higher quality) to complex scenes, higher CRF (lower quality, more compression) to simple scenes — all while maintaining overall bitrate efficiency
- Use FFmpeg's per-title encoding pattern: Generate weighted encoding complexity analysis that informs the encoding pass
This is transparent to users — no configuration needed.
Why This Matters
- Better quality at same bitrate: Bits allocated where eyes are most sensitive
- Better compression at same quality: Simple scenes compressed aggressively without perceptual loss
- Industry-standard technique: Netflix and others use per-scene complexity analysis extensively
- Complements existing VMAF validation: After encoding, VMAF already validates quality; this makes the encoding itself smarter
Technical Approach
In FfmpegService:
- Add
analyzeSceneComplexity(inputPath) method using scene detection filter
- Build complexity profile: segments with complexity scores (0-1)
- Map complexity to CRF adjustments:
baseCRF + (1 - complexity) * crfDelta
- Use FFmpeg segment filtering or two-pass approach to apply per-segment CRF
Example complexity classification:
- Complexity 0.0-0.3: Static title screens, fade transitions — CRF +4 (aggressive compression)
- Complexity 0.3-0.7: Normal content — CRF base (no change)
- Complexity 0.7-1.0: Action sequences, grainy film, CGI — CRF -4 (protect quality)
Labels
enhancement, video-encoding
Problem
Currently, BitBonsai applies uniform encoding quality (CRF) across entire videos. This is inefficient because different scenes have vastly different encoding complexity:
Proposed Solution
Implement automatic scene complexity analysis before/during encoding that:
This is transparent to users — no configuration needed.
Why This Matters
Technical Approach
In
FfmpegService:analyzeSceneComplexity(inputPath)method using scene detection filterbaseCRF + (1 - complexity) * crfDeltaExample complexity classification:
Labels
enhancement, video-encoding