Opened 19 months ago

Last modified 19 months ago

#9944 new enhancement

Small update to sendcmd syntax

Reported by: Jozef Chutka Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: sendcmd
Cc: Jozef Chutka Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I would like to propose a backward compatible improvement to sendcmd syntax.

Currently as stated in doc:

COMMAND_FLAG  ::= "enter" | "leave"
COMMAND_FLAGS ::= COMMAND_FLAG [(+|"|")COMMAND_FLAG]
COMMAND       ::= ["[" COMMAND_FLAGS "]"] TARGET COMMAND [ARG]
COMMANDS      ::= COMMAND [,COMMANDS]
INTERVAL      ::= START[-END] COMMANDS
INTERVALS     ::= INTERVAL[;INTERVALS]

Proposed (change on line 3)

COMMAND_FLAG  ::= "enter" | "leave"
COMMAND_FLAGS ::= COMMAND_FLAG [(+|"|")COMMAND_FLAG]
COMMAND       ::= ["[" COMMAND_FLAGS "]"] TARGET[(+|"|")TARGET] COMMAND [ARG]
COMMANDS      ::= COMMAND [,COMMANDS]
INTERVAL      ::= START[-END] COMMANDS
INTERVALS     ::= INTERVAL[;INTERVALS]

With the modification in place, multiple TARGETs that requires the same value can be merged together. This will be useful for filters like colorlevels where it can reduce the amount of code/data needed.

sendcmd=c='0 [expr] colorlevels rimin XYZ,[expr] colorlevels gimin XYZ,[expr] colorlevels bimin XYZ'

into:

sendcmd=c='0 [expr] colorlevels rimin+gimin+bimin XYZ'
sendcmd=c='0 [expr] colorlevels rimin|gimin|bimin XYZ'

Please also consider updating naming convention in the doc:

COMMAND       ::= ["[" COMMAND_FLAGS "]"] TARGET COMMAND [ARG]

As keyword COMMAND is used twice for two different things, I propose the following change:

COMMAND       ::= ["[" COMMAND_FLAGS "]"] TARGET VALUE [ARG]

Change History (3)

comment:1 by Michael Koch, 19 months ago

This is a good idea for sendcmd.

But for colorlevels I'd also like to propose two new options "imin" and "imax" which set all three color channels simultaneously.

Example:
colorlevels=rimin=0.1:gimin=0.1:bimin=0.1:rimax=0.3:gimax=0.3:bimax=0.3
could be simplified as:
colorlevels=imin=0.1:imax=0.3

comment:2 by Jozef Chutka, 19 months ago

Thanks for the quick response Michael. I would love to use imin, imax, omin, omax on colorlevels, however this doesnt seem to work in ffmpeg version N-108353-g7cd252ee41-20220925

ffmpeg -i img.jpg -vf "colorlevels=imin=0.5" -y imin.jpg

[Parsed_colorlevels_0 @ 0000023283b4ecc0] Option 'imin' not found
[AVFilterGraph @ 0000023283b4df40] Error initializing filter 'colorlevels' with args 'imin=0.5'
Error reinitializing filters!
Failed to inject frame into filter network: Option not found
Error while processing the decoded data for stream #0:0
Conversion failed!

As being slightly unrelated, do you want me to create a separate ticket?

comment:3 by Michael Koch, 19 months ago

That was a suggestion for new options, which don't yet exist.

Note: See TracTickets for help on using tickets.