[FFmpeg-devel] [PATCH] ffmpeg: fix overriding packet duration warning

Muhammad Faiz mfcc64 at gmail.com
Sun Nov 15 10:04:42 CET 2015


no warning when packet duration is valid

patch attached
-------------- next part --------------
From 789e9f0e93a246fd820401e6c298835bf40dc0c3 Mon Sep 17 00:00:00 2001
From: Muhammad Faiz <mfcc64 at gmail.com>
Date: Sun, 15 Nov 2015 15:25:43 +0700
Subject: [PATCH] ffmpeg: fix overriding packet duration warning

no warning when packet duration is valid
---
 ffmpeg.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 3341777..5b9e38e 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -673,10 +673,11 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
         }
 
         if (ost->frame_rate.num && ost->is_cfr) {
-            if (pkt->duration > 0)
+            int64_t new_duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
+                                                ost->st->time_base);
+            if (pkt->duration > 0 && pkt->duration != new_duration)
                 av_log(NULL, AV_LOG_WARNING, "Overriding packet duration by frame rate, this should not happen\n");
-            pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
-                                         ost->st->time_base);
+            pkt->duration = new_duration;
         }
     }
 
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list