From patchwork Tue Aug 2 16:54:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 37088 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp3256528pzb; Tue, 2 Aug 2022 09:54:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uv32QS7iUbRl6bFoLZwK0GG8LvJ6wXNsXroUlOyb2DvL1TtrwmNZZNXXrhZnG0c2bU5e2k X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr16303827ejb.426.1659459277066; Tue, 02 Aug 2022 09:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659459277; cv=none; d=google.com; s=arc-20160816; b=kHBm1VZDMot1gxJBTVCNS/kjWTLiHN9xo8Se5QcYD75k45EPrHcPVfzCFXi6GsxVs+ 8zrJXpn+CtsQUAbJyi2scLpxISP5RjdXL8a2NzxKxNstUttzO4Lq16PPU/0yuJC23t7q Dphzz7yrPUoGP3/RnGbEA3YTrFKSVeSZ2iUQe4j6eFyIPScBSvaxIqsNdVpc2XgEMB8O tsNmi6Ul3e7URJDW1h34/3p2pNvdRTfsqiZbcPm9PERnXf6FZnnyL6XLUHz3UO2vAQb/ y2rSG2YUB8ZZ3JXV3avlNakIgUedTYlYMB+Im0Pw7IV54TZSDZUhs/DixiPg+GS6V2GA vXMw== 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=+N+QY5q1OK5SNWpW+84bftOGtyAaGP4NAYkgMmDnaB4=; b=f4m1l1rS51b7X2f0KQrjk2DFdNYDqpHzkDukHCz9A99TEwu8lFaAOzd1vC/NjHIH6l zS+cRkyo83/gZi/l1C2+SWibgFqJIwy+60IYK3ujXetaA7ijdTi7lD5fqVGMnr8MJyeP qUa+IdRYbyeWk33GuNraoiWRMv1pIBOJsLu5uqpMAQimGTnbfoEj4phVhdQpSxUgr8nQ gJNaw6PfZwgUpG5IRtw/4WFrl2C53n29DyVBS4xDOROW/5hi8ovA7vxrMSzvaB1yHW7Q wDW/T3byFI+J6hX4h1bk+sxrpIpyPAyZT305aaeto3MgvPhrBCVUSn0rIydqtZ0JiyQb 1kYg== 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 s2-20020a17090699c200b00730a07ef039si2252653ejn.423.2022.08.02.09.54.36; Tue, 02 Aug 2022 09:54:37 -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; 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 9EFE568BA44; Tue, 2 Aug 2022 19:54:33 +0300 (EEST) 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 E67FC68B9C6 for ; Tue, 2 Aug 2022 19:54:26 +0300 (EEST) 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 272GsPx7017569 for ; Tue, 2 Aug 2022 18:54:26 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id D83E0EB5BC; Tue, 2 Aug 2022 18:54:25 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 2 Aug 2022 18:54:17 +0200 Message-Id: <20220802165421.137563-3-george@nsup.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220802165421.137563-1-george@nsup.org> References: <20220802165421.137563-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]); Tue, 02 Aug 2022 18:54:26 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 3/7] 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: 6ESWPQbNrq25 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(+) Identical to the one posted months ago. diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 2fb0bc8ffa..1a342846c2 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1902,6 +1902,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 6417db03bd..d2ec8ea257 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -654,6 +654,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 f9ae76f76d..973de34b5f 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 a96bcf9b8a..6404412f5a 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -178,6 +178,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; @@ -3947,6 +3948,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 },