[FFmpeg-trac] #11096(undetermined:new): Chaotic escaping rules
FFmpeg
trac at avcodec.org
Thu Jul 11 15:43:22 EEST 2024
#11096: Chaotic escaping rules
-------------------------------------+-------------------------------------
Reporter: ManDay | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Component:
| undetermined
Version: git-master | Resolution:
Keywords: | Blocked By:
filter_complex expression |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Description changed by ManDay:
Old description:
> Consider a filter which draws the text "early", if the time is less than
> 5.0 seconds and "late", otherwise. The only reasonable syntax for a
> filter-chain to achieve this, with using only a single type of quotes,
> would be the following:
> {{{
> drawtext=text='%{e:if(lt(t,5),\'early\',\'late\'}'
> }}}
> At the different levels of parsing, we have
>
> ...the filter complex: `drawtext=text='...'`
> ...the `text` argument: `%{...}`
> ...the expansion: `e:....`
> ...the `expr` parser: `if(lt(t,5),'early','late')`
>
> Where the ellipses `...` are syntactically opaque to the respective
> receiver by their notion of quotes/scoping. There is logically no need
> for further escaping. In the current state of affairs, the above does not
> work and requires complicated and lengthy escaping to the point where I
> could not even figure out a working combination.
>
> **Please note**
>
> That further escaping outside of ffmpeg is not considered in the above
> description, as it seems irrelevant to the complexity in ffmpeg alone.
> If, however, we want to consider the above in an SH context, assume the
> entire argument to ffmpeg were quoted in `"`s, so that all occurences of
> `'` remain unaltered.
New description:
Consider a filter which draws the text "early", if the time is less than
5.0 seconds and "late", otherwise. The only reasonable syntax for a
filter-chain to achieve this, with using only a single type of quotes,
would be the following:
{{{
drawtext=text='%{e:if(lt(t,5),\'early\',\'late\')}'
}}}
At the different levels of parsing, we have
...the filter complex: `drawtext=text='...'`
...the `text` argument: `%{...}`
...the expansion: `e:....`
...the `expr` parser: `if(lt(t,5),'early','late')`
Where the ellipses `...` are syntactically opaque to the respective
receiver by their notion of quotes/scoping. There is logically no need for
further escaping. In the current state of affairs, the above does not work
and requires complicated and lengthy escaping to the point where I could
not even figure out a working combination.
**Please note**
That further escaping outside of ffmpeg is not considered in the above
description, as it seems irrelevant to the complexity in ffmpeg alone. If,
however, we want to consider the above in an SH context, assume the entire
argument to ffmpeg were quoted in `"`s, so that all occurences of `'`
remain unaltered.
--
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11096#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list