Receive commands sent through a libzmq client, and forward them to filters in the filtergraph.
zmq
and azmq
work as a pass-through filters. zmq
must be inserted between two video filters, azmq
between two
audio filters.
To enable these filters you need to install the libzmq library and
headers and configure FFmpeg with --enable-libzmq
.
For more information about libzmq see: http://www.zeromq.org/
The zmq
and azmq
filters work as a libzmq server, which
receives messages sent through a network interface defined by the
bind_address option.
The received message must be in the form:
TARGET COMMAND [ARG]
TARGET specifies the target of the command, usually the name of the filter class or a specific filter instance name.
COMMAND specifies the name of the command for the target filter.
ARG is optional and specifies the optional argument list for the given COMMAND.
Upon reception, the message is processed and the corresponding command is injected into the filtergraph. Depending on the result, the filter will send a reply to the client, adopting the format:
ERROR_CODE ERROR_REASON MESSAGE
MESSAGE is optional.
Examples
Look at tools/zmqsend for an example of a zmq client which can be used to send commands processed by these filters.
Consider the following filtergraph generated by ffplay
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=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