Skip to content

Commit

Permalink
fix: Fix framerate detection for mixed-framerate content (#93)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mariocynicys authored Sep 8, 2021
1 parent d8a8d2d commit 79bcd58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion streamer/autodetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 79bcd58

Please sign in to comment.