Use the zmq and azmq filters. Unlike the sendcmd filter, which uses pre-written commands, (a)zmq allows you arbitrarily to send filter commands.
To enable these filters you need to install the libzmq library and headers and configure ffmpeg
with --enable-libzmq
.
Only filters that support commands can be used with this filter. Refer to the output of ffmpeg -filters
to view a list of which filters support commands. Additionally, not all options for a filter are considered to be commands. Refer to the documentation of each filter for a list of supported commands.
Examples from the documentation
Consider the following filtergraph generated by ffplay. In this example the last overlay filter has an instance name. All other filters will have default instance names.
ffplay -dumpgraph 1 -f lavfi "
color=s=100x100:c=red [l];
color=s=100x100:c=blue [r];
nullsrc=s=200x100, zmq [bg];
[bg][l] overlay [bg+l];
[bg+l][r] overlay@my=x=100 "
To change the color of the left side of the video, the following command can be used:
echo Parsed_color_0 c yellow | tools/zmqsend
To change the right side:
echo Parsed_color_1 c pink | tools/zmqsend
To change the position of the right side:
echo overlay@my x 150 | tools/zmqsend