From patchwork Mon Mar 15 12:06:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donough Liu X-Patchwork-Id: 26398 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 EDC0C449A01 for ; Mon, 15 Mar 2021 15:03:58 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BBBCE68ABEE; Mon, 15 Mar 2021 15:03:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9163D68A7D8 for ; Mon, 15 Mar 2021 15:03:51 +0200 (EET) Received: by mail-pf1-f181.google.com with SMTP id t85so6514437pfc.13 for ; Mon, 15 Mar 2021 06:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Eq/SrP+uKTJG6QctbJQfny3+NXK2BpPBDRcGjqMy6a4=; b=KINRBTIQdtqCQexVUFwR/5ootUQ52IKhmmUIhMmdUi1+QXCweNrSua19pZoWJA4hx9 X64JX4mAXPwvjVyY2xYfIWW+VIJjyfCCgCbDKWefviAvBK+B5JhQRt6dRBBg123Cp3ei HWQaz+ZRd3pRQgITLCBqApruLjLn3nzLgXXlMUmINi70/MLbDNnHFoJ7pVS0H+cJpjG9 YtKM/uKaXRKj5Rs/XDb/gnAtsPp8Uht7Xlk1J/sxaJaOxpIqelGDHSYtWVHrkdD0wIq6 NzFkfm74Gchaqd14RoZ3u097/iDVA+JhoWNd+IfYJVMwNwQF0o4o7v7EjL3KIqzSOBNk IjRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Eq/SrP+uKTJG6QctbJQfny3+NXK2BpPBDRcGjqMy6a4=; b=pMhFI6P+pjuuAPovzqvFPiOAQfSuZY/YYs35gFfw6vdTUBtTS2tpIlmQSo1UKplJPV vtIyyq6lQV9+clwPKeO872DqWGh97f3zLvSkPTfR885koDzsWxa0UUOhCBuPWdHERnxi ZLeWj4tLkpHuJ2bfz+ATUEtEDxFgxq22mB4ahwmxi8ISr9DYq/mo3+y4Pi3Cy2MY5okN QIAjQdT9b8IeRKty6XxHoenCC+zzeASoctGq8rt/UGTrjlNKdeGPHq4yfbqTLkW2Ive9 g31FtTeBkd2+CV/o5Gei4PUfnFPOncuWEEMVyRTtKKVlTRjLNRLhu6UZF3QN3e0LQ0KB a0pA== X-Gm-Message-State: AOAM532LD79du85ToFiHU7pbK318UPIzHxJ0i1HYhUabNkdovfNj/KaO hVIwpXHF2V+dr1mX8Nnl8jBnxB0RUA== X-Google-Smtp-Source: ABdhPJzlCpm6cZ2pxWkhhq4Ii4CM2OK5cXy13x4GFOU9po/wOC0N/NpxtS60m38j1bmGHjaRNQDmgw== X-Received: by 2002:a17:902:8303:b029:e6:4ef3:4f17 with SMTP id bd3-20020a1709028303b02900e64ef34f17mr11082393plb.22.1615809975918; Mon, 15 Mar 2021 05:06:15 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.240]) by smtp.gmail.com with ESMTPSA id k11sm7532637pjs.1.2021.03.15.05.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 05:06:15 -0700 (PDT) From: Donough Liu To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Mar 2021 12:06:09 +0000 Message-Id: <20210315120609.469718-1-donoughliu@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] Fix wrong time_base bug 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: Donough Liu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Set time_base to inv of frame rate is only valid when input video have fixed frame rate. Signed-off-by: Donough Liu --- doc/examples/transcoding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c index 5aff08c135..49ae32c719 100644 --- a/doc/examples/transcoding.c +++ b/doc/examples/transcoding.c @@ -170,7 +170,7 @@ static int open_output_file(const char *filename) else enc_ctx->pix_fmt = dec_ctx->pix_fmt; /* video time_base can be set to whatever is handy and supported by encoder */ - enc_ctx->time_base = av_inv_q(dec_ctx->framerate); + enc_ctx->time_base = av_inv_q(av_mul_q(dec_ctx->framerate, (AVRational){dec_ctx->ticks_per_frame, 1})); } else { enc_ctx->sample_rate = dec_ctx->sample_rate; enc_ctx->channel_layout = dec_ctx->channel_layout;