From 649434bd043f33370c9ab21670ef2d3ef2bde6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 18 Nov 2022 16:10:10 +0200 Subject: [PATCH] mp4mux: For video with N/1001 framerates use N as timescale See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3049 Part-of: --- mux/mp4/src/mp4mux/boxes.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mux/mp4/src/mp4mux/boxes.rs b/mux/mp4/src/mp4mux/boxes.rs index a4bc5e16..b160ce2b 100644 --- a/mux/mp4/src/mp4mux/boxes.rs +++ b/mux/mp4/src/mp4mux/boxes.rs @@ -230,9 +230,13 @@ fn stream_to_timescale(stream: &super::Stream) -> u32 { } } - (fps.numer() as u32) - .mul_div_round(100, fps.denom() as u32) - .unwrap_or(10_000) + if fps.denom() == 1001 { + fps.numer() as u32 + } else { + (fps.numer() as u32) + .mul_div_round(100, fps.denom() as u32) + .unwrap_or(10_000) + } } else if let Ok(rate) = s.get::("rate") { rate as u32 } else {