From 79bcd5857665beb27c6375059fea25c8bcacb9e6 Mon Sep 17 00:00:00 2001 From: mariocynicys Date: Wed, 8 Sep 2021 22:30:04 +0200 Subject: [PATCH] fix: Fix framerate detection for mixed-framerate content (#93) It seems that r_frame_rate may involve some calculation when the video has more than one frame rate (mixed frame rates). FFmpeg will try to find the least common multiple of all the different frame rates in the video, which is not the value we want. To avoid this, we can use avg_frame_rate instead. See https://ffmpeg.org/faq.html#AVStream_002er_005fframe_005frate-is-wrong_002c-it-is-much-larger-than-the-frame-rate_002e Fixes #90 --- streamer/autodetect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamer/autodetect.py b/streamer/autodetect.py index 70cc7c0..0c32233 100644 --- a/streamer/autodetect.py +++ b/streamer/autodetect.py @@ -104,7 +104,7 @@ def get_interlaced(input: Input) -> bool: def get_frame_rate(input: Input) -> Optional[float]: """Returns the autodetected frame rate of the input.""" - frame_rate_string = _probe(input, 'stream=r_frame_rate') + frame_rate_string = _probe(input, 'stream=avg_frame_rate') if frame_rate_string is None: return None