From patchwork Sun Mar 19 18:17:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Sabatini X-Patchwork-Id: 40724 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d046:b0:cd:afd7:272c with SMTP id hv6csp1239307pzb; Sun, 19 Mar 2023 11:17:59 -0700 (PDT) X-Google-Smtp-Source: AK7set+kLY3fhJ2k4F6dpYyAnHifKGCo52DkYz1x4tNTSxTkdxesXuCv2F7TyZw1EH6CgwEyIONm X-Received: by 2002:aa7:d04f:0:b0:4ff:5faa:5581 with SMTP id n15-20020aa7d04f000000b004ff5faa5581mr9779564edo.11.1679249879725; Sun, 19 Mar 2023 11:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679249879; cv=none; d=google.com; s=arc-20160816; b=pUUzV0T3sZe7efYBfhYXqeSWvlCRIH3+2wHVzYjRi//+NmmPeeu9MHG4bycPeoXoF+ R040YlxVlTCPFpNfDBNwU9LOIpOof6XoXoPOQap2z/5NZ8I63d3yJjQuhDagaIpZPPRR YOpwSkQjSW4WtrTVYPaGxZirt8p/uXIXK0zVpziN1eup/uS3rKjuDAhEBfHRYdPdjziM PZD9N27mpjd1GzY6/67dNdxcKqEeqlXf6CcvriUDLesuEJSwIqWQ+b8zqWVDujejs+dt LBnwIo/YLobaVKGwdnY1e0hzOX7pLqXe9/pWNfcqNC5lhex3ri2E6S7wOTs+AKZ2v8FT gitQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=+esJ9Ba7D+wwu/bS2gI1AXNHrpecYpc3ngZAqOLX+44=; b=Vr+unnqyARulcOof1v19zPzR+D4EvMhd0Rhfz3ogqbKeLDoYQT2Hvq5Gl1ouEegb4R 7cHnjXQkmPgC2shx5nTOGRgtHDc8r6IDTFaeJAMHzjOVuuiRbTJdGYzq0jmKASqY4nyL 61rGuLm1EL4HKd3DPCjjEEHQDCR1ULg3Fe+IEwWrAqRbsZGpBPMx/pfow791vbrNY2JF lBk/hnjiEN2GB9ngXwdtyWlQf+ULskBoC1naPTiwSFE7ktxgbIJcw7k6Ql2MwINRACIx dzOtYVppvZ+6Yt4uF5KSurIPK7lGwjUiz/U4xtuG5m3WLc9xTDsqohfHRWBYDczpHe1b EYGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=fWe+3IZM; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v18-20020a1709064e9200b00933403c3e08si2978909eju.173.2023.03.19.11.17.58; Sun, 19 Mar 2023 11:17:59 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=fWe+3IZM; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4987B68C3BB; Sun, 19 Mar 2023 20:17:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E151A68C394 for ; Sun, 19 Mar 2023 20:17:48 +0200 (EET) Received: by mail-wm1-f50.google.com with SMTP id az3-20020a05600c600300b003ed2920d585so7883432wmb.2 for ; Sun, 19 Mar 2023 11:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679249867; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=C9Nn2e7CmNXoC4zpm9D4HTEJhYx/7DUqHjh3p2TnP8U=; b=fWe+3IZMT32cw+5YcGt7Zv+jfheqiyEey3ZbbsbwZMgCNVJkOodCE8owMFAM8MWsxa UezwuwOyKUDFCKhm/ucQ5uIjOhpUiAhh4ompHBLy/2v/3G76l8P/ABMIIAwHjc1719E5 2oU2PESriDMSWznIK0Vee8+O2p6/MOi8ZdNPUEm3D6cz5kfgbSidLbOM+s4TI36Voaol wkIkC2zKfbtEfeuNZBEvnFGjY9BXwQZk9iR9PVpz8Ej3+RBtW1XWdx8MfBuMU/UmjzlB TV+uLHbXdJCr+5hATjES69AlY5TPoUM4JBO117/stpWgJmlPiCio69mX+4O0KugvdMpz 0kng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679249867; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=C9Nn2e7CmNXoC4zpm9D4HTEJhYx/7DUqHjh3p2TnP8U=; b=ICJnC4ptA20vwqdwMU2vGKELUwVzZGwf+nN93QEnjxv97ZJLMadaZEBfKs/vzdGL7v Zu8uQzGIVArPZ04IKMm2QRYFFarGSSkYqi/l8Zt6JuHwO1rRJ/OE744vZ2R6Dlc8hgqU vjERTKHksEWJrZ3q3o23oRpXamkY1ia4lltGbNR7uW9BZI7uiV8imSs/RXEkOBLgF4tI k79drD4CYn0EA2VaKpEqdenHgrQlwsFe1MZBK8AfQPc+LLMKuog36eA8auwQvzeY/MoB ITDri/35K9pVczwdmYlw/sRP7uqSw6WH8qP9dvVLG8GEdvaqOFxj2HVfh20uRJuZWLRe zz1A== X-Gm-Message-State: AO0yUKXgA1XwH8m7zJIVPMMF8e4DUSKYGzAHDhOV5LCv3CgoXnDfTEO9 s3SfJQVAhHQsFMlsgqJLOSKS6Z3vRhM= X-Received: by 2002:a05:600c:5107:b0:3df:e1e9:201d with SMTP id o7-20020a05600c510700b003dfe1e9201dmr29383126wms.40.1679249867504; Sun, 19 Mar 2023 11:17:47 -0700 (PDT) Received: from mariano (dynamic-adsl-62-10-90-114.clienti.tiscali.it. [62.10.90.114]) by smtp.gmail.com with ESMTPSA id z24-20020a7bc7d8000000b003dec22de1b1sm8440854wmk.10.2023.03.19.11.17.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 11:17:46 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id BDA08BFB73; Sun, 19 Mar 2023 19:17:45 +0100 (CET) From: Stefano Sabatini To: FFmpeg development discussions and patches Date: Sun, 19 Mar 2023 19:17:45 +0100 Message-Id: <20230319181745.121124-1-stefasab@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PZDuLW069EQ4 Set pkt_timebase in the decoder and in the decoder frame, use it for the filterchain source, and rescale the filtered frame to the target encoder. --- doc/examples/transcode.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c index cec4ad00e8..3bc85dce85 100644 --- a/doc/examples/transcode.c +++ b/doc/examples/transcode.c @@ -103,6 +103,7 @@ static int open_input_file(const char *filename) return ret; } + codec_ctx->pkt_timebase = stream->time_base; codec_type = codec_ctx->codec_type; /* Reencode video & audio and remux subtitles etc. */ @@ -272,7 +273,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); @@ -443,6 +444,14 @@ static int encode_write_frame(unsigned int stream_index, int flush) /* encode filtered frame */ av_packet_unref(enc_pkt); + if (filt_frame) { + /* rescale frame PTS, to match the expected encoder time base */ + filt_frame->pts = av_rescale_q(filt_frame->pts, filt_frame->time_base, + stream->enc_ctx->time_base); + filt_frame->pkt_dts = av_rescale_q(filt_frame->pkt_dts, filt_frame->time_base, + stream->enc_ctx->time_base); + filt_frame->time_base = stream->enc_ctx->time_base; + } ret = avcodec_send_frame(stream->enc_ctx, filt_frame); if (ret < 0) @@ -549,7 +558,7 @@ int main(int argc, char **argv) av_packet_rescale_ts(packet, ifmt_ctx->streams[stream_index]->time_base, - stream->dec_ctx->time_base); + stream->dec_ctx->pkt_timebase); ret = avcodec_send_packet(stream->dec_ctx, packet); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Decoding failed\n"); @@ -564,6 +573,7 @@ int main(int argc, char **argv) goto end; stream->dec_frame->pts = stream->dec_frame->best_effort_timestamp; + stream->dec_frame->time_base = ifmt_ctx->streams[stream_index]->time_base; ret = filter_encode_write_frame(stream->dec_frame, stream_index); if (ret < 0) goto end; From patchwork Sun Mar 19 18:17:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Sabatini X-Patchwork-Id: 40725 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d046:b0:cd:afd7:272c with SMTP id hv6csp1239362pzb; Sun, 19 Mar 2023 11:18:09 -0700 (PDT) X-Google-Smtp-Source: AK7set+ZeJg3w2X2ryWl57KUYSDT74ChEcaWBTuyUYOInvitBkttvbnp4IeTqiqh4D8uM5TA8xzr X-Received: by 2002:a17:906:2518:b0:933:1702:a12b with SMTP id i24-20020a170906251800b009331702a12bmr7157980ejb.17.1679249889483; Sun, 19 Mar 2023 11:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679249889; cv=none; d=google.com; s=arc-20160816; b=acz/wk4VKo9LTHHPe4K0oXVi33IVZbZwY8q3/b34WOHCfVXbOQCnkB1IIJo8sVX7yq r7cnSfSoiQD0hT46CcSk/KKBzBBa4juk9vNjPrB+FLRWtV5moUlvLgCFKsvfyYL7PChk Lht65ufHDaE04WRCZOMkjICi3DWnB2APOF5SwOrkfa1RPUe74VaHzm3Ls0v5ULU87OP2 iACs1FZESC9jpsat9AHkARSCq7BIKd7M8qDHoR52EK0giei9G46/F6iA9CKKpTkQuVyN Hf02u7nvU/0f+8RF+sjCR6NsHgHqEEZJSNQeL3oYmzBgjEvPzwAGSG544n3pJxvEhiRQ +62Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=1yJcsdzypmPKYngp/WfMOYXXJBZorvcqwjAy940JfPA=; b=T2d9jMINF0rD0N56NPvzJ41mWQpJ5hoqZYY7kjeeOlcAVY6SV45npV38y3tVgrp4Eb GLugpnGVz8Wl1AEbkijswi3Kd1og0SqMsWw3FyH5WtN84c6SzKRaA3taTf5KBWGdON4a ioaHicsbf9pqPQ8oNJgB7VgtgjxxxC4UfkLbfsvcbc7lyaA8vC+D9IKxV52kGU5di4/Y rC2DfGWuemlkWa0qRMTaqHerN31a6xM0zBdTs1UfTEQMOa0bq6tmQ8k+IXQuheW7q1rl mKehTya4YyyjfnXROGBYpqJvAPdoBzyZejnueqTFHUkQ8jwKA5b/awjY6P1d5NpqEGHm NzIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=hjmZxg3U; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u3-20020aa7d983000000b004fc69ce4d82si7920636eds.120.2023.03.19.11.18.08; Sun, 19 Mar 2023 11:18:09 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=hjmZxg3U; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8079568C3C5; Sun, 19 Mar 2023 20:18:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6087F68C3C0 for ; Sun, 19 Mar 2023 20:17:56 +0200 (EET) Received: by mail-wm1-f42.google.com with SMTP id p13-20020a05600c358d00b003ed346d4522so6219175wmq.2 for ; Sun, 19 Mar 2023 11:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679249875; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4VRl5VpF4NJdH0OWE/NyNXKohcMg6+uskyX1LR74vUU=; b=hjmZxg3UYNaAgGxTW/I9z6JFOPDAJYtXxev/HhiIYaexs5CIZxY46VwHxuiQRWgDRU dvCNzmxCVk+yAc1UaahvQeiZjJT6MrwcsApL9xfBG1ZzkC0mwEsX5NMLDuDXKFF9tUY8 fSzu998pMiBUjazxBYoPnh+x/mB4/tzvHCKfKLPjFi84odHlgfRJSNuTD1BOcUMVEwlg PdjlZ1Eu+3adeHql9PsSDtnXxREx2QUxdtUsoGccj0oPWZ3DeqVJjNpBDGsLczIyfcNa Xp4gzdVpwnxTJOz0YTEX66q6/xAAFJ6H6LqI1pr8tKFZA81T2IG/Qkwk2gynBDOcwFW1 JEnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679249875; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4VRl5VpF4NJdH0OWE/NyNXKohcMg6+uskyX1LR74vUU=; b=iPJAJEn+4nQ9Sfbhwr+Ax6Pjs6RPuTn8WiuBFiXYcJToLclSemoWpSz56ucLW3Ah3F m63gtdY86STH3ZQ/i6KOAushAdKlirqnEI4RC83ukVg9lOIi8fWIeXh+Iq901faEOL8S JtUOGMr0zHm8rfsfG1MdVFzcCoWkv6W194f/KUMSyoPffnzRQ4ouIFIAp9cw3vWq86tk KvQfhwnv53eCF7MYrqD1bhHdGVRYMXFQhW+GwNq/FNRdue8WdJwiNgrW6XVvt2aFa3uw R0fLl5DFEbajJ/d8WiWDeKvl3MAuti41Y1oph6vwZu4M4wozqXHnaiZL2pciWsQDcpEM n5aA== X-Gm-Message-State: AO0yUKV+MPBPel3R+qmkpod0BttxLyCJhfa51YPIXTEF06aeQ99XMimN uTtMvljHcZdNlQnARrbVP11w6+ZN9sM= X-Received: by 2002:a7b:c8c6:0:b0:3ed:da74:ab13 with SMTP id f6-20020a7bc8c6000000b003edda74ab13mr2126069wml.9.1679249875044; Sun, 19 Mar 2023 11:17:55 -0700 (PDT) Received: from mariano (dynamic-adsl-62-10-90-114.clienti.tiscali.it. [62.10.90.114]) by smtp.gmail.com with ESMTPSA id bg7-20020a05600c3c8700b003eb2e33f327sm24585654wmb.2.2023.03.19.11.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 11:17:54 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id C1F29BFB73; Sun, 19 Mar 2023 19:17:53 +0100 (CET) From: Stefano Sabatini To: FFmpeg development discussions and patches Date: Sun, 19 Mar 2023 19:17:53 +0100 Message-Id: <20230319181753.121233-1-stefasab@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] doc/examples/transcode: introduce timestamp logging 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: iWueEsfkOERU --- doc/examples/transcode.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c index 3bc85dce85..a7398db3d9 100644 --- a/doc/examples/transcode.c +++ b/doc/examples/transcode.c @@ -37,6 +37,7 @@ #include #include #include +#include static AVFormatContext *ifmt_ctx; static AVFormatContext *ofmt_ctx; @@ -432,6 +433,28 @@ static int init_filters(void) return 0; } +static void log_packet(AVPacket *pkt, const AVFormatContext *fmt_ctx, const char *tag) +{ + AVRational *time_base = &fmt_ctx->streams[pkt->stream_index]->time_base; + + av_log(NULL, AV_LOG_INFO, + "%s [pkt] stream:%d pts_time:%s dts_time:%s\n", + tag, pkt->stream_index, + av_ts2timestr(pkt->pts, time_base), + av_ts2timestr(pkt->dts, time_base)); +} + +static void log_frame(AVFrame *frame, int stream_index, const char *tag) +{ + AVRational *time_base = &frame->time_base; + + av_log(NULL, AV_LOG_INFO, + "%s [frame] stream:%d pts_time:%s dts_time:%s\n", + tag, stream_index, + av_ts2timestr(frame->pts, time_base), + av_ts2timestr(frame->pkt_dts, time_base)); +} + static int encode_write_frame(unsigned int stream_index, int flush) { StreamContext *stream = &stream_ctx[stream_index]; @@ -440,7 +463,6 @@ static int encode_write_frame(unsigned int stream_index, int flush) AVPacket *enc_pkt = filter->enc_pkt; int ret; - av_log(NULL, AV_LOG_INFO, "Encoding frame\n"); /* encode filtered frame */ av_packet_unref(enc_pkt); @@ -451,9 +473,10 @@ static int encode_write_frame(unsigned int stream_index, int flush) filt_frame->pkt_dts = av_rescale_q(filt_frame->pkt_dts, 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 <-"); } - ret = avcodec_send_frame(stream->enc_ctx, filt_frame); + ret = avcodec_send_frame(stream->enc_ctx, filt_frame); if (ret < 0) return ret; @@ -469,8 +492,8 @@ static int encode_write_frame(unsigned int stream_index, int flush) stream->enc_ctx->time_base, ofmt_ctx->streams[stream_index]->time_base); - av_log(NULL, AV_LOG_DEBUG, "Muxing frame\n"); /* mux encoded frame */ + log_packet(enc_pkt, ofmt_ctx, "muxer <-"); ret = av_interleaved_write_frame(ofmt_ctx, enc_pkt); } @@ -482,8 +505,11 @@ static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index) FilteringContext *filter = &filter_ctx[stream_index]; int ret; - av_log(NULL, AV_LOG_INFO, "Pushing decoded frame to filters\n"); /* push the decoded frame into the filtergraph */ + if (frame) { + log_frame(frame, stream_index, "filters <-"); + } + ret = av_buffersrc_add_frame(filter->buffersrc_ctx, frame); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n"); @@ -492,7 +518,6 @@ static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index) /* pull filtered frames from the filtergraph */ while (1) { - av_log(NULL, AV_LOG_INFO, "Pulling filtered frame from filters\n"); ret = av_buffersink_get_frame(filter->buffersink_ctx, filter->filtered_frame); if (ret < 0) { /* if no more frames for output - returns AVERROR(EAGAIN) @@ -505,6 +530,8 @@ static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index) } filter->filtered_frame->pict_type = AV_PICTURE_TYPE_NONE; + + log_frame(filter->filtered_frame, stream_index, "filters ->"); ret = encode_write_frame(stream_index, 0); av_frame_unref(filter->filtered_frame); if (ret < 0) @@ -550,6 +577,7 @@ int main(int argc, char **argv) break; stream_index = packet->stream_index; av_log(NULL, AV_LOG_DEBUG, "Demuxer gave frame of stream_index %u\n", stream_index); + log_packet(packet, ifmt_ctx, "demuxer ->"); if (filter_ctx[stream_index].filter_graph) { StreamContext *stream = &stream_ctx[stream_index]; @@ -584,6 +612,7 @@ int main(int argc, char **argv) ifmt_ctx->streams[stream_index]->time_base, ofmt_ctx->streams[stream_index]->time_base); + log_packet(packet, ofmt_ctx, "muxer <-"); ret = av_interleaved_write_frame(ofmt_ctx, packet); if (ret < 0) goto end;