fix capture timing and gif size cap

- capture declares -framerate 999 to accept all frames without dropping
- after capture stops, measure actual delivery rate from frame count / elapsed time
- re-encode intermediate file with correct fps via stream copy (no quality loss)
- same fix applied to pause_capture segments
- gif: remove 15% size tolerance - never exceed target size
This commit is contained in:
2026-05-30 01:14:51 +03:00
parent 67c2a84178
commit 5d312b6b00
3 changed files with 90 additions and 17 deletions
+1 -10
View File
@@ -397,16 +397,7 @@ fn encode_gif(ffmpeg: &Path, req: &TranscodeRequest) -> Result<()> {
return Ok(());
}
// Only adjust DOWN when file is too big
// Accept within 15% over target
if ratio >= 0.85 {
tracing::info!(
"gif encode done on attempt {}: {} bytes (target {} - close enough)",
attempt + 1, actual, target
);
return Ok(());
}
// Only adjust DOWN when file is too big - never exceed target
// File is too big - scale down based on budget priority
match req.gif_budget_mode {
GifBudgetMode::Resolution => {