From patchwork Wed Mar 2 18:40:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 34583 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:d078:0:0:0:0 with SMTP id x24csp4904124nkx; Wed, 2 Mar 2022 10:40:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzA1mwR85dlf2w46zbRNCIp5EYBbJiCQPi4nUp3nk40+2dGQ3ri3t0d8f1UmmRdpXZ+yICU X-Received: by 2002:a17:906:9743:b0:6d8:632a:a42d with SMTP id o3-20020a170906974300b006d8632aa42dmr4477835ejy.157.1646246458168; Wed, 02 Mar 2022 10:40:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646246458; cv=none; d=google.com; s=arc-20160816; b=kOVlpwWe1G1U9gflegKU4N09/b7N7JzBJeyL0M2u5da/AhL/ly2kexA7B0kKW+k94V KzzcQ0rcrL0oOm4x4R7Ft/YmoFB1tbUlAistZgAC3x1NqFB9DVEMEDrpsKwBPs089by0 lqudhkfwohdKBjoZucQHKI1t5SknFqKnVRbS6Ur8K83YWjvOuQ5hZHifGl0BJOP5lK4j kYeGj89etGcASoNq3UCb/CpLmFeKXnd7YjHuEgNFpYDyJWweabVV/vfisv1wB+kSv7+r 9nCzbs15PqVVJCmK1Oqo3OqIAMlKgb27rd9K30e21Zlp6oUgSVWjB/k0nJeLXJ5yyaai /4vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=vEAOUYlMbK1eC0YL59450enbRHi17YW+CPikFMHOkI0=; b=uIZl+i3uft2vTcdy5j3CRiDadMbYan+VIwTINCkkWwRLcsM8k4tRWnn0zsDP2SZVF+ PUeXYZeL6do24hloV6H1/ARJQ7cf9MvAzqImAOPGwD46txND9EVR/+o/iqF7Ew6I2MfN TruF1ByN7rSUBlJTg6ZdwfsgvuNi34rG+KGsfhAhfd0LxKWoWZFn/WbKcTXArBbmQVSh f9/1oOCA9uZkIaRCm5ap52PnnafHHbJisqddKumCcQ2y7HRtM0jWwXSLG8o95a6oKedS wV9W5Is6Tw3YXMD5yRTp3GRPhpDkoHymrOfNpDVEjzUChVxRsp4JuQlvzUXz0ZnB4BFQ FHpQ== 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 i38-20020a0564020f2600b004108264e75esi11512039eda.548.2022.03.02.10.40.34; Wed, 02 Mar 2022 10:40:58 -0800 (PST) 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 1069668B34A; Wed, 2 Mar 2022 20:40:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B69AD68B318 for ; Wed, 2 Mar 2022 20:40:25 +0200 (EET) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 222IeOaa010651 for ; Wed, 2 Mar 2022 19:40:25 +0100 Received: by phare.normalesup.org (Postfix, from userid 1001) id E7099EB5BC; Wed, 2 Mar 2022 19:40:24 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Wed, 2 Mar 2022 19:40:20 +0100 Message-Id: <20220302184023.285022-2-george@nsup.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220302184023.285022-1-george@nsup.org> References: <20220302184023.285022-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Wed, 02 Mar 2022 19:40:25 +0100 (CET) Subject: [FFmpeg-devel] [PATCH 2/5] fftools: add -lavfi_dump option 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: BP4jzUSeKxqw Signed-off-by: Nicolas George --- doc/ffmpeg.texi | 4 ++++ fftools/ffmpeg.h | 1 + fftools/ffmpeg_filter.c | 14 ++++++++++++++ fftools/ffmpeg_opt.c | 3 +++ 4 files changed, 22 insertions(+) Unchanged since last summer. diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 164419cad3..1f6c416390 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1864,6 +1864,10 @@ The default is the number of available CPUs. Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or outputs. Equivalent to @option{-filter_complex}. +@anchor{lavfi_dump option} +@item -lavfi_dump (@emph{global}) +Dump the filter graphs and their negotiated formats to standard output. + @item -filter_complex_script @var{filename} (@emph{global}) This option is similar to @option{-filter_complex}, the only difference is that its argument is the name of the file from which a complex filtergraph diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index cc8f767e5d..4b81cc19fa 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -635,6 +635,7 @@ extern char *filter_nbthreads; extern int filter_complex_nbthreads; extern int vstats_version; extern int auto_conversion_filters; +extern int dump_filtergraphs; extern const AVIOInterruptCB int_cb; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index b80d7189db..33ed91bf63 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1070,6 +1070,20 @@ int configure_filtergraph(FilterGraph *fg) avfilter_graph_set_auto_convert(fg->graph, AVFILTER_AUTO_CONVERT_NONE); if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0) goto fail; + if (dump_filtergraphs) { + char *dump = avfilter_graph_dump(fg->graph, "f=tech"); + if (!dump) + return AVERROR(ENOMEM); + if (simple) { + OutputStream *ost = fg->outputs[0]->ost; + printf("Dump of filter graph for output #%d:%d:", ost->file_index, ost->index); + } else { + printf("Dump of complex filter graph #%d:", fg->index); + } + printf("\n\n%s\n", dump); + av_free(dump); + fflush(stdout); + } fg->is_meta = graph_is_meta(fg->graph); diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index bf1bbcae4c..9b09917bb3 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -167,6 +167,7 @@ char *filter_nbthreads; int filter_complex_nbthreads = 0; int vstats_version = 2; int auto_conversion_filters = 1; +int dump_filtergraphs = 0; int64_t stats_period = 500000; @@ -3670,6 +3671,8 @@ const OptionDef options[] = { "number of threads for -filter_complex" }, { "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex }, "create a complex filtergraph", "graph_description" }, + { "lavfi_dump", OPT_BOOL | OPT_EXPERT, { &dump_filtergraphs }, + "dump filter graphs to standard output" }, { "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script }, "read complex filtergraph description from a file", "filename" }, { "auto_conversion_filters", OPT_BOOL | OPT_EXPERT, { &auto_conversion_filters },