Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable sequence for VISCA UDP #177

Open
neonconsultingllc opened this issue Oct 13, 2023 · 1 comment
Open

Add option to disable sequence for VISCA UDP #177

neonconsultingllc opened this issue Oct 13, 2023 · 1 comment

Comments

@neonconsultingllc
Copy link

Some PTZ cameras seem to not support UDP packets that contain the sequence part of visca.
One example is the AKVANS AV-E20-NDI.
I also have some LinkPi devices which can forward udp packets to a serial (visca) port, which does not work correctly when sequence part of packet is used.

For testing, I created a quick python script which removes anything before x81, then forwards on to the device.

import socket
import codecs
UDP_IP = "192.168.1.49"
UDP_PORT = 5000
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP,UDP_PORT))
CAM_IP = "192.168.1.45"
CAM_PORT = 1259
cam_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
    data, addr = sock.recvfrom(2048)

    d=codecs.getencoder('hex')(data)
    s = None
    x = list()
    for i in range(0,d[1]):
        if hex(data[i]) == '0x81':
            s = i
        if s is not None:
           x.append(data[i])
    send = bytearray(x)
    print("%s -> %s" % ( data,send))
    cam_sock.sendto(send,(CAM_IP,CAM_PORT))

Quick example of output:

b'\x01\x00\x00\t\x00\x00\x00E\x81\x01\x06\x01\n\x08\x02\x02\xff' -> bytearray(b'\x81\x01\x06\x01\n\x08\x02\x02\xff')
b'\x01\x00\x00\t\x00\x00\x00F\x81\x01\x06\x01\x0b\t\x02\x02\xff' -> bytearray(b'\x81\x01\x06\x01\x0b\t\x02\x02\xff')
b'\x01\x00\x00\t\x00\x00\x00G\x81\x01\x06\x01\x00\x00\x03\x03\xff' -> bytearray(b'\x81\x01\x06\x01\x00\x00\x03\x03\xff')
b'\x01\x00\x00\t\x00\x00\x00H\x81\x01\x06\x01\x01\x01\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\x01\x01\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00I\x81\x01\x06\x01\x02\x02\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\x02\x02\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00J\x81\x01\x06\x01\x04\x03\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\x04\x03\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00K\x81\x01\x06\x01\x05\x04\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\x05\x04\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00L\x81\x01\x06\x01\x06\x05\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\x06\x05\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00M\x81\x01\x06\x01\x07\x06\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\x07\x06\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00N\x81\x01\x06\x01\x08\x07\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\x08\x07\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00O\x81\x01\x06\x01\n\x08\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\n\x08\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00P\x81\x01\x06\x01\x0b\t\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\x0b\t\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00Q\x81\x01\x06\x01\x0c\n\x01\x01\xff' -> bytearray(b'\x81\x01\x06\x01\x0c\n\x01\x01\xff')
b'\x01\x00\x00\t\x00\x00\x00R\x81\x01\x06\x01\x00\x00\x03\x03\xff' -> bytearray(b'\x81\x01\x06\x01\x00\x00\x03\x03\xff')
b'\x01\x00\x00\x05\x00\x00\x00S\x81\x01\x06\x04\xff' -> bytearray(b'\x81\x01\x06\x04\xff')

It would be great to have an option to "Disable sequence" when configuring a camera to use VISCA UDP, which drops anything before x81

@normen
Copy link

normen commented Nov 22, 2023

Can confirm, given the bugs in the serial port implementation and some of my cameras having some specialties in the VISCA implementation anyway I created a bridge app so I can massage the data. The easiest way in your case I suppose would ba making a super small app that just opens a TCP server and connects that to the camera UDP, which is basically what I am doing. The TCP-Visca that OBS-PTZ outputs is basically what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants