From patchwork Tue Jul 4 03:24:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 4208 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp496324vsb; Mon, 3 Jul 2017 20:25:36 -0700 (PDT) X-Received: by 10.223.177.213 with SMTP id r21mr38990701wra.119.1499138736104; Mon, 03 Jul 2017 20:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499138736; cv=none; d=google.com; s=arc-20160816; b=OMzjarJA7HEeabWiVHJUJdQwlwO7gz9UucMlAvUG5WBUoQUL7YeMMTy8mdEw4pwTIu dqqhxzzJMJcvSJqGUWrcsfzJeRn3wmWrKWoXektYH4S36ZfcqVG2VKF965CxCwLV5P66 g03zZMsw8bBvJiShDxHMzKRgYwXkKvDYB2T4+47F56MdU0md0bEFwPWjUTqZCfOpo7VN mDG4oR14KxPo1mKdH2nIDaCwcS2+81g15TqrRMc4lxTfg0k73fXwYj7C5E9kLcygjC8g FrrifS2Cpg0YuRSEUOi5N2plQP+X4GgN710ChDsmwA0dEaERmx5dfbiH1NKEuhVJ3vhb LCgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=UsjdDkyZ3LeuiIUZ+/WSgpvY6LYkYph6m/YF99F/vPE=; b=Alvobpx8GfnUa3VueT0ZaUMbEDc0MkvGZ4BHxzDF/Ei6xwdImQgF6j/sRVBRXw46oN oB3CaVFGxfV+Mj4ssjwRFN6VvqD6O3enBBsaiu5YcBdwNWa2QqMFM/wsN+3ewQfPTXe2 nadI9RrpP7/Hmq3Sp1jHt9LKhJWWlws6A0OkwxG4Rr6Ja+CRTxqUDo5s4yHWybRerhHL x5anOEgzy4l7YQHrc92tyTeAYnW90zvXRj6wMCkkXIwe+HjmHhEwzYRNdfV7EiEnhBjz tIn+tZuCVRMnAa/fVIcPDbWebd7gj054W8Dc32vhV1gEZgBfUhl62QU2VtyU9xwdNMfj DSIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y186si2764455wmd.0.2017.07.03.20.25.35; Mon, 03 Jul 2017 20:25:36 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E8CC8688361; Tue, 4 Jul 2017 06:25:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg327.qq.com (smtpbg327.qq.com [14.17.43.158]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 194B6680462 for ; Tue, 4 Jul 2017 06:25:23 +0300 (EEST) X-QQ-mid: bizesmtp4t1499138681tmjroerqw Received: from localhost (unknown [47.90.47.25]) by esmtp4.qq.com (ESMTP) with id ; Tue, 04 Jul 2017 11:24:41 +0800 (CST) X-QQ-SSF: 01100000008000F0FG51B00A0000000 X-QQ-FEAT: bUPYf1xC10A5Y5ehK4mPyxjVFcM/Q/TzGu0Cdg2xZhVumH5/gH4QnVfjpLu5b raTYhRzUpy0fM65X5/PaUMSyke2FNjldP8IMfIxPPVNrjXDKLJqyigSV3qw/3a1JvdoL2j1 x8+dgZkTeZu4wtElENjKix99Oo0OZwDQhYdayrIddb8JTxJZDHBO40gOIVdMDzvUkwqml6I nMs9I1Vua6F/+tkIGaWRn1ceTFjSEuDM3INXrSHt92WC73wQoh8cjutJcURzkgASjwW6aZv 6KM9oav6sR1PyX X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Tue, 4 Jul 2017 11:24:39 +0800 Message-Id: <20170704032439.31997-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.10.1.382.ga23ca1b.dirty X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH] avformat/hlsenc: copy codec_tag when stream copy X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu , Liu Qi MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 --- libavformat/hlsenc.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index a49b594..4c94ffd 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);