From patchwork Sun Mar 26 17:34:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Sabatini X-Patchwork-Id: 40838 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7a30:b0:df:834d:2c1a with SMTP id t48csp774988pzh; Sun, 26 Mar 2023 10:34:16 -0700 (PDT) X-Google-Smtp-Source: AKy350ba8oudl13dIL1Wsovd/sMnVuF13SnDOEscti7Rqbzwhs8+2kWmz84lLaUj1veb70M7NicB X-Received: by 2002:a17:906:cb98:b0:931:73d:4cc3 with SMTP id mf24-20020a170906cb9800b00931073d4cc3mr10212469ejb.11.1679852055732; Sun, 26 Mar 2023 10:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679852055; cv=none; d=google.com; s=arc-20160816; b=QKermnssruQ8K7cHtO6YEjuLey2612ghtEHy0T6adF5QCDTrBAhX4sVCAWNwGWDRU3 GHDQ2j/p1/WshdWvbCjuotIsa8kRAhvbb8vJrCQeIas1Oz7aK1U1+8vUweXx71VrM2jP b+9NW7Y5//bI+BUPhbcvDvYfA2jJ9PQ9BnoKacqGc/SdJR7vejz+xSjhRvoOGPZUzSmH cK6v5BUD1UTMckSYV0MQTgWuFrqD1a6z5Dve/k/+K7Cn+CYkaw4CalWoAA2LmVlXX2Nh 1iUfVJO7A1ehvV5vV67arRaos0K6jBp+3xDz7H5Gxp3oqFNeao1ioB1XzK9UlpJ+fOcw cN2g== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=WhvPUEIo3atW7tF0Uauq59o9BpW+HZji48oMvrgw+pg=; b=nQgg0pj5qEFvnoGic2pKON0MoJUt3RJx24KVFG8TfasInHmx/EIsvOaRX9fb4+1Y+x 9Z+Rpaw3ezXOKYBWjka9y2WwzJ7UQSvjotvIQByL+Upjzv7fd2Mt5yc9TGZvHw1zVXG3 nona2ocMj/veSpezWudIelUhrXZ7jUynLPfGFS913/uVstjvWGx4c2IwXypxf3GhDAn3 am0rNqrP7CpJd1JxOV53stTlKXzxfxtDpm9pxUFp0LdsplFMCp5FGLFUEFZUVSG4dgzt CmxGqATCMbSM9bkcyOwqBZR97lOuenRPdzZLXwMSzEVtShNQRc4JXJALrHN6KaNaWL84 aryQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=AtaIGPad; 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 lc22-20020a170906f91600b00924c79a4314si24852294ejb.668.2023.03.26.10.34.15; Sun, 26 Mar 2023 10:34:15 -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=AtaIGPad; 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 3DFB568C407; Sun, 26 Mar 2023 20:34:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A17C168C3FE for ; Sun, 26 Mar 2023 20:34:04 +0300 (EEST) Received: by mail-ed1-f48.google.com with SMTP id r11so26798611edd.5 for ; Sun, 26 Mar 2023 10:34:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679852043; 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=l5RhwrCoxiWQIsGVpmKE8sTfFqq29hGr5fMjn/WQbQo=; b=AtaIGPadz3SauBAMRGI/zzyHSzaBEhD92358aYQw8jKFcYL57ORH24jDzWh5mWWp4g dSY7kd61TsQxyGR5zZ/Pw73BYk7YVPg3Pa/LLBy8B4ZX4Oo+CQcZv4uAo1iUMEBJxGV8 spPJ+rCBe6tZNWQ21FbyXNLirpy2wyEqxdEWh8W2KO0K+T/4wElKiE5yY0QzqmNHWpgs Zr17dCjgHiGSo/gKkwJDaR5zMdU29Ev6ULar4P8fX/IIM6vxPe4LS6lfYxdxt030Ah4C 67OFGOkMaO5NOFBG6R52E0aehMXE2fbH1HZVh4wQYvtS4qDWDf1ZlsqwvZ7jZmkMI33V 5Tfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679852043; 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=l5RhwrCoxiWQIsGVpmKE8sTfFqq29hGr5fMjn/WQbQo=; b=sDOgTNl+IwJNvUx7NgJtXtf+r7dnI9BaNqTpXJUhPnVry031zHeCz9MygSlxnm21an F1YPysAGSkUvxMq2rBDpPN7N4CLwWDE5IH1K+6j1qVbK69gWFvulIwkE3VkvJwFwc+a2 wqwlXi4N7M96a74fzNybveIcb0/TW5O52nTfZh2IGpBFK2ym0dWOtI3e6//05yeIhS3q TkjHxjDnqo6WtwjUG8yjJ1qRNBTAmXzcfDJnlje6t8Ys72vrEtpoprsMuaLEexRwREP3 bSrpUXBJzxEfqspxVV2cfweRgbimsDixF9L0+pnTtUkJWlSDz+P6NSvUr3Zw1LcJ6n9Q 99Lg== X-Gm-Message-State: AAQBX9e1XJ5JkIU6J1/G0jHFSsI7dDvljX2CjINrYKVYNLL3iBdAHNio zXWkreRDQIDQzOzafU9/OYoF3zg1b/s= X-Received: by 2002:a17:907:d68f:b0:878:7189:a457 with SMTP id wf15-20020a170907d68f00b008787189a457mr9941636ejc.51.1679852043079; Sun, 26 Mar 2023 10:34:03 -0700 (PDT) Received: from mariano (dynamic-adsl-62-10-98-143.clienti.tiscali.it. [62.10.98.143]) by smtp.gmail.com with ESMTPSA id be1-20020a1709070a4100b009447277c2aasm668990ejc.39.2023.03.26.10.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 10:34:02 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id 45F39BFB72; Sun, 26 Mar 2023 19:34:01 +0200 (CEST) From: Stefano Sabatini To: FFmpeg development discussions and patches Date: Sun, 26 Mar 2023 19:34:00 +0200 Message-Id: <20230326173401.56228-2-stefasab@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230326173401.56228-1-stefasab@gmail.com> References: <20230326173401.56228-1-stefasab@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] doc/filters: propose solutions to avoid shell escaping 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: ijGaMzdht645 Reference drawtext textfile option and ffmpeg -filter_complext_script and -filter_script as solutils to avoid shell escaping. Address issue: http://trac.ffmpeg.org/ticket/9008 --- doc/ffmpeg.texi | 2 ++ doc/filters.texi | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 6baf51bf0a..adfc2726ff 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -769,6 +769,7 @@ syntax. See the @ref{filter_complex_option,,-filter_complex option} if you want to create filtergraphs with multiple inputs and/or outputs. +@anchor{filter_script option} @item -filter_script[:@var{stream_specifier}] @var{filename} (@emph{output,per-stream}) This option is similar to @option{-filter}, the only difference is that its argument is the name of the file from which a filtergraph description is to be @@ -1978,6 +1979,7 @@ 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{filter_complex_script option} @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/doc/filters.texi b/doc/filters.texi index b397100ff8..1c9d523340 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -282,6 +282,18 @@ previous string will finally result in: -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters" @end example +In order to avoid cumbersome escaping when using a commandline tool accepting a +filter specification as input, it is advisable to avoid direct inclusion of the +filter or options specification in the shell. + +For example, in case of the @ref{drawtext,,drawtext filter}, you might prefer to +use the @option{textfile} option in place of @option{text} to specify the text +to render. + +When using the @command{ffmpeg} tool, you might consider to use the +@ref{filter_script option,,-filter_script option,ffmpeg} or +@ref{filter_complex_script option,,-filter_complex_script option,ffmpeg}. + @chapter Timeline editing Some filters support a generic @option{enable} option. For the filters @@ -12359,11 +12371,11 @@ braces is a function name, possibly followed by arguments separated by ':'. If the arguments contain special characters or delimiters (':' or '@}'), they should be escaped. -Note that they probably must also be escaped as the value for the -@option{text} option in the filter argument string and as the filter -argument in the filtergraph description, and possibly also for the shell, -that makes up to four levels of escaping; using a text file avoids these -problems. +Note that they probably must also be escaped as the value for the @option{text} +option in the filter argument string and as the filter argument in the +filtergraph description, and possibly also for the shell, that makes up to four +levels of escaping; using a text file with the @option{textfile} option avoids +these problems. The following functions are available: