diff options
author | Steven Liu <lq@chinaffmpeg.org> | 2017-07-05 11:20:21 +0800 |
---|---|---|
committer | Steven Liu <lq@chinaffmpeg.org> | 2017-07-05 11:20:21 +0800 |
commit | 1fe40e73a67c703f574545bcb4573e3c695b7ed6 (patch) | |
tree | 9e2024093c2a2378aae0b83e4c85b4cf801de167 /libavformat/hlsenc.c | |
parent | d01b8f8683df9d56d4f4d997de2f9c24050b96e3 (diff) | |
download | ffmpeg-1fe40e73a67c703f574545bcb4573e3c695b7ed6.tar.gz |
avformat/hlsenc: copy codec_tag when stream copy
when use fmp4 segment type in hls and use codec copy,
there have an error message.
error message:
[mp4 @ 0x25df020] Tag avc1 incompatible with output codec id '28' ([33][0][0][0])
[hls @ 0x2615c80] Some of the provided format options in '(null)' are not recognized
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
this patch can fix it.
Signed-off-by: Liu Qi <w_liuqi@kingsoft.com>
Signed-off-by: Steven Liu <lq@onvideo.cn>
Diffstat (limited to 'libavformat/hlsenc.c')
-rw-r--r-- | libavformat/hlsenc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 2fe07f0bf0..dd6a62b13c 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -566,6 +566,14 @@ static int hls_mux_init(AVFormatContext *s) if (!(st = avformat_new_stream(loc, NULL))) return AVERROR(ENOMEM); avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar); + if (!oc->oformat->codec_tag || + av_codec_get_id (oc->oformat->codec_tag, s->streams[i]->codecpar->codec_tag) == st->codecpar->codec_id || + av_codec_get_tag(oc->oformat->codec_tag, s->streams[i]->codecpar->codec_id) <= 0) { + st->codecpar->codec_tag = s->streams[i]->codecpar->codec_tag; + } else { + st->codecpar->codec_tag = 0; + } + st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; st->time_base = s->streams[i]->time_base; av_dict_copy(&st->metadata, s->streams[i]->metadata, 0); |