Le sextidi 6 floréal, an CCXXIV, Derek Buitenhuis a écrit :
> Removing this causes failures when concatdec is used to concat two H.264
> streams from an MP4 source, when remuxed, IIRC.
> 
> Example: https://trac.ffmpeg.org/raw-attachment/ticket/3108/examplefiles.zip
> 
> ./ffmpeg -f concat -i tickets/3108/concatfile.txt -codec copy out.mp4

This one seems to work, but remuxing to Matroska shows problem, even with
H.264 encoded from testsrc.

I fixed it by clearing the extradata at the place where the bistream filter
is inserted, since the bsf API does not do it. See the attached patch, to be
applied on top of the small revert.

Andrey, is it similar to what you proposed?

Note to self or others: TODO: add FATE tests, including the stitchable case.

Regards,

-- 
  Nicolas George
From fbccc4c2a1fa4830d0b8846404baaeadf6a2da98 Mon Sep 17 00:00:00 2001
From: Nicolas George <geo...@nsup.org>
Date: Mon, 25 Apr 2016 13:46:10 +0200
Subject: [PATCH] lavf/concatdec: clear extradata when inserting
 h264_mp4toannexb bsf.

Fix remuxing H.264-in-MP4 to Matroska, possibly others.

Signed-off-by: Nicolas George <geo...@nsup.org>
---
 libavformat/concatdec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index b2bab55..b3a430e 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -214,6 +214,12 @@ static int detect_stream_specific(AVFormatContext *avf, int idx)
         if (!cs->avctx)
             return AVERROR(ENOMEM);
 
+        /* This really should be part of the bsf work.
+           Note: input bitstream filtering will not work with bsf that
+           create extradata from the first packet. */
+        av_freep(&st->codecpar->extradata);
+        st->codecpar->extradata_size = 0;
+
         ret = avcodec_parameters_to_context(cs->avctx, st->codecpar);
         if (ret < 0) {
             avcodec_free_context(&cs->avctx);
-- 
2.8.0.rc3

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to