[FFmpeg-devel] [PATCH] concatdec: Fix handling of H.264 in MP4 in case of "-auto_convert 0"
Andrey Utkin
andrey_utkin at fastmail.com
Mon Apr 25 15:07:04 CEST 2016
This is my patch which has stuck waiting for premoderation.
----- Forwarded message from Andrey Utkin <andrey.utkin at pb.com> -----
From: Andrey Utkin <andrey.utkin at pb.com>
To: ffmpeg-devel at ffmpeg.org
CC: andrey_utkin at fastmail.com, Carl Eugen Hoyos <cehoyos at ag.or.at>, Andrey Utkin <andrey.utkin at pb.com>
Date: Sun, 24 Apr 2016 16:28:38 +0300
Subject: [PATCH] concatdec: Fix handling of H.264 in MP4 in case of "-auto_convert 0"
Bug ticket: http://trac.ffmpeg.org/ticket/5461
This fix enables back the ability to concat appropriately encoded
(with "-x264opts stitchable=1") MP4 files in less time, without conversion to
mpegts and back.
---8<---
Fixes regression bug #5461.
---
libavformat/concatdec.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index e3418e1..7ae4030 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -161,7 +161,8 @@ fail:
return ret;
}
-static int copy_stream_props(AVStream *st, AVStream *source_st)
+static int copy_stream_props(ConcatContext *cat, AVStream *st,
+ AVStream *source_st)
{
int ret;
@@ -182,8 +183,8 @@ static int copy_stream_props(AVStream *st, AVStream *source_st)
}
if ((ret = avcodec_parameters_copy(st->codecpar, source_st->codecpar)) < 0)
return ret;
- /* We don't want to carry around MP4-style extradata, since we are usoign a bsf anyway. */
- if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
+ if (cat->auto_convert && st->codecpar->codec_id == AV_CODEC_ID_H264) {
+ /* We don't want to carry around MP4-style extradata, since we are using a bsf anyway. */
av_freep(&st->codecpar->extradata);
st->codecpar->extradata_size = 0;
}
@@ -242,7 +243,7 @@ static int match_streams_one_to_one(AVFormatContext *avf)
if (!(st = avformat_new_stream(avf, NULL)))
return AVERROR(ENOMEM);
}
- if ((ret = copy_stream_props(st, cat->avf->streams[i])) < 0)
+ if ((ret = copy_stream_props(cat, st, cat->avf->streams[i])) < 0)
return ret;
cat->cur_file->streams[i].out_stream_index = i;
}
@@ -262,7 +263,7 @@ static int match_streams_exact_id(AVFormatContext *avf)
av_log(avf, AV_LOG_VERBOSE,
"Match slave stream #%d with stream #%d id 0x%x\n",
i, j, st->id);
- if ((ret = copy_stream_props(avf->streams[j], st)) < 0)
+ if ((ret = copy_stream_props(cat, avf->streams[j], st)) < 0)
return ret;
cat->cur_file->streams[i].out_stream_index = j;
}
--
2.8.1
________________________________
----- End forwarded message -----
More information about the ffmpeg-devel
mailing list