[FFmpeg-cvslog] nutenc/write_index: warn if 2 consecutive keyframes have the same PTS and discard the 2nd

Michael Niedermayer git at videolan.org
Tue Dec 24 08:14:26 CET 2013


ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Sun Dec 22 18:47:28 2013 +0100| [848af79decd25aff03a17d5fd736181b4f2108c5] | committer: Carl Eugen Hoyos

nutenc/write_index: warn if 2 consecutive keyframes have the same PTS and discard the 2nd

This fixes an assertion failure and regression and restores previous behaviour
Fixes Ticket3197

An alternative would be to fail hard in this case and refuse to mux such data.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit de2a2caf4dedb28a959d0ff6f02751bb6c3ff033)

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

 libavformat/nutenc.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 4671152..9b1ffaf 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -584,8 +584,15 @@ static int write_index(NUTContext *nut, AVIOContext *bc) {
         int64_t last_pts= -1;
         int j, k;
         for (j=0; j<nut->sp_count; j++) {
-            int flag = (nus->keyframe_pts[j] != AV_NOPTS_VALUE) ^ (j+1 == nut->sp_count);
+            int flag;
             int n = 0;
+
+            if (j && nus->keyframe_pts[j] == nus->keyframe_pts[j-1]) {
+                av_log(nut->avf, AV_LOG_WARNING, "Multiple keyframes with same PTS\n");
+                nus->keyframe_pts[j] = AV_NOPTS_VALUE;
+            }
+
+            flag = (nus->keyframe_pts[j] != AV_NOPTS_VALUE) ^ (j+1 == nut->sp_count);
             for (; j<nut->sp_count && (nus->keyframe_pts[j] != AV_NOPTS_VALUE) == flag; j++)
                 n++;
 



More information about the ffmpeg-cvslog mailing list