From patchwork Tue Nov 26 01:41:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 16414 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 D3708449611 for ; Tue, 26 Nov 2019 03:41:46 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A70B368AE90; Tue, 26 Nov 2019 03:41:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9247168ABF4 for ; Tue, 26 Nov 2019 03:41:40 +0200 (EET) Received: by mail-pl1-f195.google.com with SMTP id ay6so7389234plb.0 for ; Mon, 25 Nov 2019 17:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zS8sml281Oq55QAMgdsdPIywNVTYQJVnU5jo6GF4aaE=; b=ebs6vIodl8c7POUw88qVcslqTeWRdljIk4unhuN/uoHMcAs/bnx/s5hnZie8VLSORi o1KvcbL6r5TjbQ5Z1wub1cNLF4NvUwRvgdg0mlKFzTa/3MgXgxkG67rjUrhHmjwX+blm W4VL4M/x9wRDuxjwEs7NkmxabtR02BdnAZLj6mGjV9Wp1Br1bGNmPvf6EBubv9GEATu7 0UEnpiQwQ9zrV+vpmE54ZGVACZP1MNBvSkv8uanIanJIdxfqYBycWTy/zxekdZsYfGZ3 P1PYDHd+tE9czFuLQVdj6XQo7GXs5HmTDLZwelLIwXvI9l6F3MCgd01kVNepTkieUzlw scxQ== 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:in-reply-to :references; bh=zS8sml281Oq55QAMgdsdPIywNVTYQJVnU5jo6GF4aaE=; b=esa7op/VMk5pTzza4qbWUiciudQuwK6Be/G6gmyeoqOEOH0I+uMFbz0BT4A681w/gL pAmujno7CT21YJ97sB2bpvTH5uIOefsFtsEMfWoL0Grq8jnGwFL4SBivuElomMzbpZ1p +YKm0j5WRqgj2zhthF7G67f7CmGcSOF/Pwyr4zy+sfsDtlU/LRbD3ASitJ+ZUJnavHYf +dehkB/PkG1z+Sj8/DAeFd7vrufgzQ3oLKlnYsCh4xabaK102ThdFYUUhgBsCdd/chqW F+Y+/MxHEM2fxlLGfPag/3NCmFYGUwd0RQ9SJK9trUz5aj+xalNlfl3v0OAragZ9mCev lEFg== X-Gm-Message-State: APjAAAW1zMcl2hoHT65xV2x0tZun/m32rTsND15sifreVEEL4ic7RNVZ kSMFcui+SbwkbykE5AN6VaN66s3Q X-Google-Smtp-Source: APXvYqwSn5yCg4V+sg7DOALjMwmtRMjcbNXL0OE/bUfbm4HRxSbOvfXgPcS8kzjU+D0SBdG15oQ8yA== X-Received: by 2002:a17:902:854c:: with SMTP id d12mr27209974plo.264.1574732498299; Mon, 25 Nov 2019 17:41:38 -0800 (PST) Received: from vpn.localdomain ([47.90.99.151]) by smtp.gmail.com with ESMTPSA id m5sm588655pjl.30.2019.11.25.17.41.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Nov 2019 17:41:37 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 26 Nov 2019 09:41:30 +0800 Message-Id: <20191126014130.15052-1-lance.lmwang@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20191120145456.20251-1-lance.lmwang@gmail.com> References: <20191120145456.20251-1-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 1/2] fftools: add global option to dump filter graph to stderr 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang It's useful for debugging filter graph purposes, now only lavfi can do that. Reviewed-by: Carl Eugen Hoyos Signed-off-by: Limin Wang --- doc/ffmpeg.texi | 4 ++++ fftools/ffmpeg.h | 1 + fftools/ffmpeg_filter.c | 7 +++++++ fftools/ffmpeg_opt.c | 3 +++ 4 files changed, 15 insertions(+) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 9cccc2337d..f822a1025e 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -735,6 +735,10 @@ Technical note -- attachments are implemented as codec extradata, so this option can actually be used to extract extradata from any stream, not just attachments. +@item -dump_filtergraph (@emph{global}) +Dump filter graph to stderr. It is off by default, the option is mostly useful +for debugging filter graph purposes + @item -noautorotate Disable automatically rotating video based on file metadata. diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 7b6f802082..5b8319da07 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -607,6 +607,7 @@ extern AVIOContext *progress_avio; extern float max_error_rate; extern char *videotoolbox_pixfmt; +extern int dump_filtergraph; extern int filter_nbthreads; extern int filter_complex_nbthreads; extern int vstats_version; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 72838de1e2..edc15cff61 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1109,6 +1109,13 @@ int configure_filtergraph(FilterGraph *fg) if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0) goto fail; + if (dump_filtergraph) { + char *dump = avfilter_graph_dump(fg->graph, NULL); + fputs(dump, stderr); + fflush(stderr); + av_free(dump); + } + /* limit the lists of allowed formats to the ones selected, to * make sure they stay the same if the filtergraph is reconfigured later */ for (i = 0; i < fg->nb_outputs; i++) { diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 71063cc443..7616209a43 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -101,6 +101,7 @@ int copy_ts = 0; int start_at_zero = 0; int copy_tb = -1; int debug_ts = 0; +int dump_filtergraph = 0; int exit_on_error = 0; int abort_on_flags = 0; int print_stats = -1; @@ -3535,6 +3536,8 @@ const OptionDef options[] = { { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(dump_attachment) }, "extract an attachment into a file", "filename" }, + { "dump_filtergraph", OPT_BOOL, { &dump_filtergraph }, + "dump filter graph to stderr" }, { "stream_loop", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_INPUT | OPT_OFFSET, { .off = OFFSET(loop) }, "set number of times input stream shall be looped", "loop count" }, { "debug_ts", OPT_BOOL | OPT_EXPERT, { &debug_ts },