BreeeZe/rpos

Using ONVIF with virtual video

Opened this issue · 1 comments

Hello,
I tested this project with a raspberry pi 3 and a raspicam v1 and it worked great. Right now I trying to use RPOS to stream via ONVIF a virtual video created with V4L2 Loopback.

With Python + OpenCV + V4L2 I dump the MJPEG video to /dev/video1 and with RPOS using the usbcam config.
rpos USBCAM config:
{
"NetworkAdapters" : ["awdl0","eth0", "wlan0", "en0"],
"IpAddress" : "192.168.0.10",
"ServicePort" : 8081,
"Username" : "admin",
"Password" : "admin",
"CameraType" : "usbcam",
"CameraDevice" : "/dev/video1",
"RTSPAddress" : "", "//":"Normally left blank. Used to set RTSP Server Address",
"RTSPPort" : 8554,
"RTSPName" : "h264",
"MulticastEnabled" : false, "MulticastEnabledComment" : "## Multicast is not supported for USB ca$
"RTSPMulticastName" : "h264m",
"MulticastAddress" : "224.0.0.1",
"MulticastPort" : "10001",
"RTSPServer" : 3, "RtspServerComment" : "## Select RTSP Server > 1:RPOS RTSP Server 2:V4L2 RTSP Se$
"PTZDriver" : "none", "PTZDriverComment": "## valid values are none,tenx,pelcod,visca and pan-tilt$
"PTZOutput" : "none", "PTZOutputComment": "## values are none (eg Tenx), serial and tcp",
"PTZSerialPort" : "/dev/ttyUSB0",
"PTZSerialPortSettings" : { "baudRate":2400, "dataBits":8, "parity":"none", "stopBits":1 },
"PTZOutputURL": "127.0.0.1:9999",
"PTZCameraAddress": 1,
"DeviceInformation" : {
"Manufacturer" : "Raspberry Pi",
"Model" : "2 B",
"HardwareId" : ""
},
"logLevel" : 3, "logLevelComment": "## LogLevels are > 1:Error 2:Warning 3:Info 4:Debug",
"logSoapCalls" : false
}

  • When I run node rpos.js I get no errors and the following output:
    print_onvif_

  • Then I tried to get the stream via ONVIF with iSpy software, but the stream is blank.
    image

Troubleshooting:

  • running the comand ffmpeg -f v4l2 -list_formats all -i /dev/video1 to check if the MJPEG stream is ok I get the following output:
    ffmpeg version 4.1.6-1~deb10u1+rpt1 Copyright (c) 2000-2020 the FFmpeg developers
    built with gcc 8 (Raspbian 8.3.0-6+rpi1)
    ...
    libavutil 56. 22.100 / 56. 22.100
    libavcodec 58. 35.100 / 58. 35.100
    libavformat 58. 20.100 / 58. 20.100
    libavdevice 58. 5.100 / 58. 5.100
    libavfilter 7. 40.101 / 7. 40.101
    libavresample 4. 0. 0 / 4. 0. 0
    libswscale 5. 3.100 / 5. 3.100
    libswresample 3. 3.100 / 3. 3.100
    libpostproc 55. 3.100 / 55. 3.100
    [video4linux2,v4l2 @ 0x1f601c0] Compressed: mjpeg : Motion-JPEG : 160x120
    /dev/video1: Immediate exit requested

So the MJPEG stream seems Ok. I also ran ffplay /dev/video1 and the stream is OK.

Any ideas why this is not working? The virtual video resolution is 160x120 (it is a thermal cam via SPI video), that might be a problem?

Update:
I used the v4l2tools to encode the MJPEG video from /dev/video1 to h264 and output it to /dev/video2 with the command:
sudo ./v4l2tools/v4l2compress_omx /dev/video1 /dev/video2 and usind ffplay /dev/video2 i get the following stream with some green stripe:
image

When I tried to use rpos to stream with rstp option 3 from /dev/video2 I got nothing in the onvif device manager.

Any ideas or suggestions to get this stream working with onvif device manager?