From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id E565447252 for ; Sat, 2 Sep 2023 15:20:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1AA3F68C7E7; Sat, 2 Sep 2023 18:19:49 +0300 (EEST) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2953268C7CA for ; Sat, 2 Sep 2023 18:19:45 +0300 (EEST) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-40061928e5aso460955e9.3 for ; Sat, 02 Sep 2023 08:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693667984; x=1694272784; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jirGJkjybvLnmYr4MHJHIuAzkuITBM0Dtn6pzuVhALw=; b=CEJQB0MjUno+HFPCKmWSde6TV0eQO5e4S3qGzfkj3PwROgjRiKdEKp2GhPtwmlQo3n gzi8NiWxiakb6J5zYalcGBh5KOLSc5IghMgKksuwrzp9NtmZrcuFmFUmgxFM0CgjbOq/ QXHv8OrEKzeVXoBR3RbolGlh686TE8eCJFtgPy/9OS3RLfiNBm35XB2nvutyzk9g3zHt qgrGuEurls4jcNPIP0eTyzJoXxgCTtorL18nCWeLm8KWOP9DYMZXOFm7DeXhQgH9nBmI S2Jpx+NH4nFgF7pUNZZlYWBJPNU1Y1ARnjPM0XWEvP5NyFk42wLLM/sZNOtJHeQGXiHL OpGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693667984; x=1694272784; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jirGJkjybvLnmYr4MHJHIuAzkuITBM0Dtn6pzuVhALw=; b=ZvQwJFAIKuPvVZ96RR/MAhEC3mc4qgvfoW9Vg84PLVr66/fftrjvJIJCzTPdI0WESz uw4amp6asAk99RnQ2jD4VZya9qlV/11OBQJDnXVJmQtPllcjeTbcdeUHPy9jpKI7aXR8 5P+CxYzrW6a+njqtjK3cbQPgSAt5XPfLZdsmKinc/Ym/IiNmhx/z0u/80cMTLqQ+fIkB FJDOBET66nevJeiWN68khylMmLsENYU8pTvAUehTmIAYTteEn38I2XroFf+xamKc3rPZ +goGaH6UsBRuhJkZSLwbMOWkkr+mv/7B/ZtwRk2I2btWw6jBu9wud+m4AAJcg2kj6y6E BQqg== X-Gm-Message-State: AOJu0YzAxiPPPhg6PIPG6optK2JTUkeHN/ArMC3tWGpEFWv5IaizsO1t Y6tCcyxQojhcuRppYP5qRaszVMXseFQ= X-Google-Smtp-Source: AGHT+IGe1Jc8/W9KYWXkcimRwJxkV0q13YKyxMAmfG+CBvv19+IxMP76wURkgL5o0Fc3nlmSiYcrNg== X-Received: by 2002:a05:600c:ac4:b0:3f6:58ad:ed85 with SMTP id c4-20020a05600c0ac400b003f658aded85mr3874105wmr.10.1693667984325; Sat, 02 Sep 2023 08:19:44 -0700 (PDT) Received: from mariano ([82.84.194.139]) by smtp.gmail.com with ESMTPSA id n18-20020a5d4012000000b0031c79de4d8bsm8854204wrp.106.2023.09.02.08.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 08:19:37 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id 5C672BFCEC; Sat, 2 Sep 2023 17:19:31 +0200 (CEST) From: Stefano Sabatini To: FFmpeg development discussions and patches Date: Sat, 2 Sep 2023 17:19:19 +0200 Message-Id: <20230902151921.1712373-10-stefasab@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230902151921.1712373-1-stefasab@gmail.com> References: <20230902151921.1712373-1-stefasab@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/11] doc/examples/transcode: fix timestamps scaling X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Stefano Sabatini Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Set pkt_timebase in the decoder and in the decoded frame, use it for the filterchain source, and rescale the filtered frame to the target encoder time_base. This fixes filtering in case the time base was not set in the decoder, causing the error: [in @ 0x5647fc26ec80] Invalid time base 0/1 --- doc/examples/transcode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c index b94fdbede2..524bb47f50 100644 --- a/doc/examples/transcode.c +++ b/doc/examples/transcode.c @@ -276,7 +276,7 @@ static int init_filter(FilteringContext *fctx, AVCodecContext *dec_ctx, snprintf(args, sizeof(args), "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt, - dec_ctx->time_base.num, dec_ctx->time_base.den, + dec_ctx->pkt_timebase.num, dec_ctx->pkt_timebase.den, dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den); @@ -303,6 +303,7 @@ static int init_filter(FilteringContext *fctx, AVCodecContext *dec_ctx, } } else if (dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { char buf[64]; + buffersrc = avfilter_get_by_name("abuffer"); buffersink = avfilter_get_by_name("abuffersink"); if (!buffersrc || !buffersink) { @@ -317,7 +318,7 @@ static int init_filter(FilteringContext *fctx, AVCodecContext *dec_ctx, av_channel_layout_describe(&dec_ctx->ch_layout, buf, sizeof(buf)); snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=%s", - dec_ctx->time_base.num, dec_ctx->time_base.den, dec_ctx->sample_rate, + dec_ctx->pkt_timebase.num, dec_ctx->pkt_timebase.den, dec_ctx->sample_rate, av_get_sample_fmt_name(dec_ctx->sample_fmt), buf); @@ -470,6 +471,7 @@ static int encode_write_frame(unsigned int stream_index, int flush) if (filt_frame && filt_frame->pts != AV_NOPTS_VALUE) { filt_frame->pts = av_rescale_q(filt_frame->pts, filt_frame->time_base, stream->enc_ctx->time_base); + filt_frame->time_base = stream->enc_ctx->time_base; log_frame(filt_frame, stream_index, "encoder <-"); } -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".