From patchwork Sun Oct 21 16:15:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Izen X-Patchwork-Id: 10739 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 626DD449007 for ; Sun, 21 Oct 2018 19:15:08 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BB90468A832; Sun, 21 Oct 2018 19:14:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2741568A676 for ; Sun, 21 Oct 2018 19:14:43 +0300 (EEST) Received: by mail-yw1-f67.google.com with SMTP id y76-v6so15089554ywd.2 for ; Sun, 21 Oct 2018 09:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=Xkco4o9DsQ+suODQwyxzX02E2ziHQA3ouykhoPU1JqQ=; b=VyIgbvXFMcE3W7w4AiMEe76GOtqR5nrqLbPnB9HnksfuCzqZtu6VtDm2BvAjaGczR7 CKJPTbymBh3UoWtWgzaxOigdBnGYofQFE6QGxLXszHwsJpXTwmdLJxSvPR0hX78wHYRb IJ+2Oa6iMgw6J2qcsCFC7xQBBYu0HcGRKJdX5nMYeopo6zzqpco+6/7usL6F6fH19hwY pC8+RFBXcRTRXF0qOmhatzMtj7BIpyKFNsOmOzLJq73j0ahTZcM6oc3hoWNb+FBpACZq AJelu7TGAAKyAhjmmeG39R70oCMxBiWjGFvXSKHAhapu/zKseT5D6hxJJ5gmN/lOmoxG bbPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=Xkco4o9DsQ+suODQwyxzX02E2ziHQA3ouykhoPU1JqQ=; b=Nm8OlVmDXl5o6bPeB2f4NWL5kCrIptwV/Vf+WkqyB2xSFRFg3CNPqJGKUZUGl3uqiS j/6nakI0XXC4URGmbt+tcmIcx10U7GfLzkbtw+Q4emXUMvmyvJ+yRRIq0945dJyYipcu MeDYd6t/adfRdnDhvkZSQe1ksk7m6y5hJqoUAOUh4jEXnwvgG9xJUpckjp3xMy+0wKGt 2+69DJT/ZdDG8Y0KEHthyOa8cl6KRmrdWjbbqvnQK3FM88prTbFkkVwNwFRvO9A0O6ub 1844oIcUB9SPAECJOHLqGy75vH5L05eN4GDGf9Nr+00oubsneL1Dym2PJ90pqQdhPyzE NogA== X-Gm-Message-State: ABuFfoj4TZsqwNVE8e+Wfj25+0hkwnZmlGjOwVzMPbSS9wJYX6dPd7rz 1XVfcL81ZuNGJ/esPlqa2ntb46GI X-Google-Smtp-Source: ACcGV63SMW0U+LDDxavcvecbHQ2T5j6mpwY20XaVtFINsIZdDe5H5NFcHcLJEfTn+qfOkb+7qWfguA== X-Received: by 2002:a81:6055:: with SMTP id u82-v6mr237354ywb.510.1540138509131; Sun, 21 Oct 2018 09:15:09 -0700 (PDT) Received: from [192.168.1.35] (64-233-244-163.static.clv.wideopenwest.com. [64.233.244.163]) by smtp.gmail.com with ESMTPSA id b70-v6sm9074103ywe.85.2018.10.21.09.15.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Oct 2018 09:15:08 -0700 (PDT) To: ffmpeg-devel@ffmpeg.org References: <20181019025821.23120-1-leo.izen@gmail.com> <195eb348-174c-a1b2-8054-d59bf8a3babd@gmail.com> <55c1c681-d8df-376c-7c37-60ad0c9dfdee@gmail.com> <20181020224715.GD3743@michaelspb> <20181021112328.GA17360@sunshine.barsnick.net> From: Leo Izen Message-ID: <5423b3af-6c2a-79c2-e2de-a2b29e759ff1@gmail.com> Date: Sun, 21 Oct 2018 12:15:07 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181021112328.GA17360@sunshine.barsnick.net> Content-Language: en-PH Subject: Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg.c: allow forcing input framerate on streamcopy 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On 10/21/18 7:23 AM, Moritz Barsnick wrote: > On Sat, Oct 20, 2018 at 22:42:55 -0400, Leo Izen wrote: >> On 10/20/18 6:47 PM, Michael Niedermayer wrote: >>> This will not apply as it has too many newlines >> What do you mean by "this will not apply"? Do you mean attempting to >> apply the patch fails? What do newline characters have anything to do >> with it? > You patch is corrupted by newlines introduced by your email client. You > may need to attach the patch as a file attachment, or use "git > send-email". > > Moritz I've attached it. Leo Izen From 98db6af55d170671ec3e34df747a8536ec66c39f Mon Sep 17 00:00:00 2001 From: Leo Izen Date: Fri, 19 Oct 2018 19:26:41 -0400 Subject: [PATCH] fftools/ffmpeg.c: allow forcing input framerate on streamcopy --- fftools/ffmpeg.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index da4259a9a8..6e81716795 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2045,12 +2045,14 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p if (ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) ost->sync_opts++; - if (pkt->pts != AV_NOPTS_VALUE) + if (ist->framerate.num) + opkt.pts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->mux_timebase) - ost_tb_start_time; + else if (pkt->pts != AV_NOPTS_VALUE) opkt.pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->mux_timebase) - ost_tb_start_time; else opkt.pts = AV_NOPTS_VALUE; - if (pkt->dts == AV_NOPTS_VALUE) + if (pkt->dts == AV_NOPTS_VALUE || ist->framerate.num) opkt.dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->mux_timebase); else opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->mux_timebase); @@ -2602,7 +2604,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo avpkt = *pkt; } - if (pkt && pkt->dts != AV_NOPTS_VALUE) { + if (pkt && pkt->dts != AV_NOPTS_VALUE && !ist->framerate.num) { ist->next_dts = ist->dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_VIDEO || !ist->decoding_needed) ist->next_pts = ist->pts = ist->dts; @@ -3158,8 +3160,15 @@ static int init_output_stream_streamcopy(OutputStream *ost) else sar = par_src->sample_aspect_ratio; ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar; - ost->st->avg_frame_rate = ist->st->avg_frame_rate; - ost->st->r_frame_rate = ist->st->r_frame_rate; + + if (ist->framerate.num) { + ost->st->avg_frame_rate = ist->framerate; + ost->st->r_frame_rate = ist->framerate; + } else { + ost->st->avg_frame_rate = ist->st->avg_frame_rate; + ost->st->r_frame_rate = ist->st->r_frame_rate; + } + break; } -- 2.19.1