Reputation: 321
I am trying to dynamically control the size and position of a box on a rtsp stream, exposed by ffmpeg. I found a potential solution that is based on zmq. I have recompiled ffmpeg with zmq support and run the stream with the command
ffmpeg -re -rtsp_transport tcp -stimeout 1000000 -i "rtsp://<STREAM_ADDR>" -pix_fmt bgra -filter_complex zmq,drawbox=x=10:y=10:w=50:h=50:c=red -f fbdev /dev/fb0
Then I'm trying to send update with python3 script from ffmpeg repo tools (I modified it to adjust python3)
import sys, zmq, cmd
class LavfiCmd(cmd.Cmd):
prompt = 'lavfi> '
def __init__(self, bind_address):
context = zmq.Context()
self.requester = context.socket(zmq.REQ)
self.requester.connect(bind_address)
cmd.Cmd.__init__(self)
def onecmd(self, cmd):
if cmd == 'EOF':
sys.exit(0)
print('Sending command:[%s]' % cmd)
self.requester.send_string(cmd)
message = self.requester.recv()
print('Received reply:[%s]' % message)
try:
bind_address = sys.argv[1] if len(sys.argv) > 1 else "tcp://localhost:1235"
LavfiCmd(bind_address).cmdloop('FFmpeg libavfilter interactive shell')
except KeyboardInterrupt:
pass
I try to send
Parsed_drawbox_1 reinit x=40
or
Parsed_drawbox_1 x 40
But still got Received reply:[b'38 Function not implemented']
from script.
When I set verbose on ffmpeg I can see
[Parsed_zmq_0 @ 0x5594e2d3b0] Processing command #8 target:Parsed_drawbox_1 command:reinit arg:w=40
[Parsed_zmq_0 @ 0x5594e2d3b0] Sending command reply for command #8:
38 Function not implemented
Does anyone have an idea what can cause it, or how to better debug it?
Thanks
Upvotes: 2
Views: 462
Reputation: 321
Thanks to @Gyran I was able to resolve it.
My FFmpeg version was 4.2.2 so I updated it to 4.3.1.
Command should be just e.g.
Parsed_drawbox_1 x 300
Upvotes: 2