[FFmpeg-cvslog] avformat/demux: Use r_frame_rate in compute_frame_duration if codec_framerate is unknown

Nicolas Gaullier git at videolan.org
Thu Sep 23 16:36:32 EEST 2021


ffmpeg | branch: master | Nicolas Gaullier <nicolas.gaullier at cji.paris> | Fri Sep 10 11:34:09 2021 +0200| [daf04868d8a20d25d5fc664e26137ddfabd4d40a] | committer: James Almer

avformat/demux: Use r_frame_rate in compute_frame_duration if codec_framerate is unknown

Signed-off-by: Nicolas Gaullier <nicolas.gaullier at cji.paris>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=daf04868d8a20d25d5fc664e26137ddfabd4d40a
---

 libavformat/demux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index d7393d5b46..6a4b687bf1 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -653,7 +653,7 @@ static void compute_frame_duration(AVFormatContext *s, int *pnum, int *pden,
     *pden = 0;
     switch (st->codecpar->codec_type) {
     case AVMEDIA_TYPE_VIDEO:
-        if (st->r_frame_rate.num && !pc) {
+        if (st->r_frame_rate.num && (!pc || !codec_framerate.num)) {
             *pnum = st->r_frame_rate.den;
             *pden = st->r_frame_rate.num;
         } else if (st->time_base.num * 1000LL > st->time_base.den) {



More information about the ffmpeg-cvslog mailing list