From 118f76af069d7c1a23d99b6ca7d9c3eccb942aab Mon Sep 17 00:00:00 2001
From: Karl Dietz <dekarl@mythtv.org>
Date: Sun, 27 Apr 2014 02:19:55 +0200
Subject: [PATCH 2/2] divide framerate by number of ticks (fields) per frame
Inspired by av_guess_frame_rate, see
https://www.ffmpeg.org/doxygen/trunk/group__lavf__misc.html#ga12c049178414cc221dfafd4e7f836dea
Why don't we just use that?
Fixes #12047
---
mythtv/libs/libmythtv/avformatdecoder.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
index 552d3fe..528ee83 100644
a
|
b
|
float AvFormatDecoder::normalized_fps(AVStream *stream, AVCodecContext *enc) |
1342 | 1342 | float fps, avg_fps, codec_fps, container_fps, estimated_fps; |
1343 | 1343 | avg_fps = codec_fps = container_fps = estimated_fps = 0.0f; |
1344 | 1344 | |
| 1345 | /* this is not a good source for FPS according to |
| 1346 | * https://trac.bunkus.org/wiki/FAQ:WrongFrameRateDisplayed |
| 1347 | */ |
1345 | 1348 | if (stream->avg_frame_rate.den && stream->avg_frame_rate.num) |
| 1349 | { |
1346 | 1350 | avg_fps = av_q2d(stream->avg_frame_rate); // MKV default_duration |
| 1351 | if (st->codec->ticks_per_frame > 1) |
| 1352 | { |
| 1353 | avg_fps /= st->codec->ticks_per_frame; |
| 1354 | } |
| 1355 | } |
1347 | 1356 | |
1348 | 1357 | if (enc->time_base.den && enc->time_base.num) // tbc |
1349 | 1358 | codec_fps = 1.0f / av_q2d(enc->time_base) / enc->ticks_per_frame; |