OH3 - RTSP camera setup

I got one of these little thingies

I have it setup through it’s own app (YooSee) and I now have a RTSP link that works in VLC.

I installed ffmpeg with apt install ffmpeg
I installed the IP Camera Binding

What IP Camera Binding Thing should I be using?

I have been experimenting with RTSP/HTTP IP Camera and seem to have the camera online, but none of the links that are generated work and there is no image in the Image item.



I think the camera may support ONVIF? But I didn’t have much luck experimenting with the ONVIF Camera Thing.

Can anyone help?

I can’t help with this specific device, but I do know that the Image Item will only be populated when the Switch Item linked to the Poll Image Channel is ON.

I had tried that.

It seems like the camera is connected, but ffmpeg isn’t doing it’s job?

Anyone else know what I should be doing differently?

The only info I know is:
RTSP link that works in VLC RTSP://admin:xxxxx@10.0.0.217:554/onvif1
username admin
password xxxxx

I am guessing to use port 554 for Port for HTTP, inferred from the working RTSP link.
I am using a random port number for Server Port. Is this right?
I am using the link that works in VLC for FFmpeg Input.
Everything else is default.

In my logs I get:

2021-06-11 17:12:06.178 [DEBUG] [era.internal.handler.IpCameraHandler] - File server for camera at 10.0.0.217 has started on port 45230 for all NIC's.
2021-06-11 17:12:10.184 [DEBUG] [era.internal.handler.IpCameraHandler] - Binding has no snapshot url. Will use your CPU and FFmpeg to create snapshots from the cameras RTSP.
2021-06-11 17:12:10.185 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport tcp -threads 1 -skip_frame nokey -hide_banner -loglevel warning -i RTSP://admin:********@10.0.0.217/onvif1 -an -vsync vfr -q:v 2 -update 1 http://127.0.0.1:2100/snapshot.jpg
2021-06-11 17:12:10.450 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - RTSP://admin:xxxxx@10.0.0.217/onvif1: Protocol not found
2021-06-11 17:12:10.451 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Did you mean file:RTSP://admin:xxxxx@10.0.0.217/onvif1?

then this repeatedly,

2021-06-11 17:12:11.200 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://10.0.0.217:554

Would really love to get this working

What happens if you enter this
-rtsp_transport udp
into the FFmpeg Input Options config?

If your camera does not have a snapshot URL then it does not matter what you set it to if the cameras stays ONLINE.

correct. Looking at your logs I can see something interesting which may be a bug. It says the port is serving on 45230 and then in the ffmpeg output it shows it will be using 2100 when these two numbers should match. Any ideas why they don’t match, steps to reproduce that?

The line that is repeating is the binding checking the camera is still online.

Fantastic! Things are now happening!

With your first suggestion, I now have some images.

The Image URL is working in my browser http://10.0.0.100:45230/ipcamera.jpg
I don’t get an image in my Image item though. Do you know why?

This widget OH3 Widget: Building a camera widget - #17 by maxmaximax works. It shows a static thumbnail, and a video in motion when clicked.

I’m seeing a few things in the logs that don’t look right.
When I click the widget and start the mjpeg stream I get:

2021-06-13 16:53:40.711 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request 	GET:/ipcamera.jpg
2021-06-13 16:53:45.234 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://10.0.0.217:554
2021-06-13 16:53:47.901 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request 	GET:/ipcamera.mjpeg
2021-06-13 16:53:47.903 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-rtsp_transport udp -hide_banner -loglevel warning -i rtsp://admin:********@10.0.0.217/onvif1 -q:v 5 -r 2 -vf scale=320:-2 -update 1 http://127.0.0.1:45230/ipcamera.jpg
2021-06-13 16:53:48.703 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hevc @ 0x8f5630] PPS id out of range: 0
2021-06-13 16:53:48.705 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] -     Last message repeated 1 times
2021-06-13 16:53:48.706 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hevc @ 0x8f5630] Error parsing NAL unit #0.
2021-06-13 16:53:48.707 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hevc @ 0x8f5630] PPS id out of range: 0
2021-06-13 16:53:48.708 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] -     Last message repeated 1 times
2021-06-13 16:53:48.709 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hevc @ 0x8f5630] Error parsing NAL unit #0.
2021-06-13 16:53:48.780 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hevc @ 0x8f5630] PPS id out of range: 0
2021-06-13 16:53:48.782 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] -     Last message repeated 1 times
2021-06-13 16:53:48.783 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hevc @ 0x8f5630] Error parsing NAL unit #0.
2021-06-13 16:53:48.862 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hevc @ 0x8f5630] PPS id out of range: 0
2021-06-13 16:53:48.864 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] -     Last message repeated 1 times
2021-06-13 16:53:48.865 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hevc @ 0x8f5630] Error parsing NAL unit #0.
2021-06-13 16:53:50.683 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Guessed Channel Layout for Input Stream #0.1 : mono
2021-06-13 16:53:50.713 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hevc @ 0x965780] Could not find ref with POC 70
2021-06-13 16:53:50.802 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [swscaler @ 0xece230] deprecated pixel format used, make sure you did set range correctly
2021-06-13 16:53:51.391 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x8f2260] max delay reached. need to consume packet
2021-06-13 16:53:51.392 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x8f2260] RTP: missed 10 packets
2021-06-13 16:53:51.416 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x8f2260] max delay reached. need to consume packet
2021-06-13 16:53:51.418 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x8f2260] RTP: missed 2 packets
2021-06-13 16:53:55.233 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://10.0.0.217:554

Then it seems to work for a while. Then I get

2021-06-13 16:55:54.784 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - More than 1000 frames duplicated

and the feed stops. When I reload the p[age I can view it again.

I’m also seeing:

2021-06-13 17:10:15.614 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [swscaler @ 0x23e7220] deprecated pixel format used, make sure you did set range correctly

sometimes

Should HLS be working with this setup?

I can use the jpg and mjpg links in UI elements, but HLS doesn’t seem to do anything.

When I try to use the HLS link in the video card, I get this in the log

2021-06-13 17:29:27.791 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request 	GET:/ipcamera.m3u8
2021-06-13 17:29:27.792 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-hide_banner -loglevel warning -rtsp_transport udp -i rtsp://admin:********@10.0.0.217/onvif1 -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4 /etc/openhab/html/camera1/ipcamera.m3u8
2021-06-13 17:29:28.172 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x232f370] CSeq 5 expected, 0 received.
2021-06-13 17:29:28.173 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x232f370] method SETUP failed: 500 Internal Server Error
2021-06-13 17:29:28.174 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - rtsp://admin:********@10.0.0.217/onvif1: Server returned 5XX Server Error reply
2021-06-13 17:29:32.305 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request 	GET:/ipcamera32.ts
2021-06-13 17:29:32.325 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request 	GET:/ipcamera33.ts
2021-06-13 17:29:32.342 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request 	GET:/ipcamera34.ts
2021-06-13 17:29:32.366 [DEBUG] [pcamera.internal.StreamServerHandler] - Stream Server recieved request 	GET:/ipcamera35.ts

Your camera did not support TCP, so if you see patchy video maybe partly missing picture or the odd green square show up, that will be normal for UDP.

Yes the binding disables that by default as it is not a good idea to do that unless you need a picture that stays on the last motion seen. Use the widgets and the snapshot or mjpeg streams to show a picture. If your only doing a single camera it is not too much of an issue.

If the output comes from FFmpeg, use google to search for the message. There are tons of information out on the problems that can crop up with ffmpeg.

My guess is the camera can not handle more than 1 or two open RTSP streams at the same time. The binding will have one open to create snapshots from. Another open if your watching a mjpeg stream, note that the ‘snapshots.mjpeg’ stream will not open a RTSP stream as it will use the source that is creating the snapshots from.

A http 500 error means the cameras server has crashed or hit an unknown error.

Also your camera is sending “hevc” also known as h265. Whilst HLS can use this, it is far more compatible to use h.264 which most cameras allow you to change between those two formats.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.