Ipcamera binding ffmpeg problems

Hi,

my openhab is running in a docker container and I already installed the ffmpeg. I have a VIVOTEK IP8364C camera which support HTTP and RTSP streaming. The jpeg link from ip camera binding is working, but the video stream does not…
Maybe someone can help me to find the error. Here are some screenshots from my camera, binding conf and log:

Camera:

Binding:

The stream URL (rtsp://root:*****@192.168.178.126/live.sdp) is working (tested in VLC).

The generated image URL (http://192.168.178.10:8090/ipcamera.jpg) is working in the browser.
The video URL (http://192.168.178.10:8090/ipcamera.mjpeg) not!

log:


13:54:04.140 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:generic:Kamera_1' changed from UNINITIALIZED (DISABLED) to INITIALIZING
13:54:04.165 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:generic:Kamera_1' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR): A non valid URL has been given to the b                                                                                                                  inding, check they work in a browser.
13:54:07.181 [DEBUG] [mera.internal.handler.IpCameraHandler] - File server for camera at 192.168.178.126 has started on port 8003 for all NIC's.
13:54:11.205 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:11.207 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:generic:Kamera_1' changed from OFFLINE (CONFIGURATION_ERROR): A non valid URL has been given to the binding, check th                                                                                                                  ey work in a browser. to ONLINE
13:54:11.220 [DEBUG] [.ipcamera.internal.MyNettyAuthHandler] - Setting up the camera to use Basic Auth and resending last request with correct auth.
13:54:11.271 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:11.838 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:12.215 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:19.843 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:20.218 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:26.729 [DEBUG] [ipcamera.internal.StreamServerHandler] - Stream Server recieved request   GET:/ipcamera.mjpeg
13:54:27.246 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80rtsp://root:*****@192.168.178.126:554/live.sdp
13:54:27.848 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:28.220 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:35.845 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:36.222 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:38.000 [DEBUG] [ipcamera.internal.StreamServerHandler] - Stream Server recieved request   GET:/ipcamera.jpg
13:54:38.013 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:38.248 [DEBUG] [ipcamera.internal.StreamServerHandler] - Stream Server recieved request   GET:/favicon.ico
13:54:43.847 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:44.227 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:51.848 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:52.225 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:54:59.850 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:00.225 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:07.852 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:08.226 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:15.853 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:16.227 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:23.852 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:24.229 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:26.727 [DEBUG] [ipcamera.internal.StreamServerHandler] - Stream server is going to close an idle channel.
13:55:26.734 [DEBUG] [mera.internal.handler.IpCameraHandler] - All ipcamera.mjpeg streams have stopped.
13:55:26.743 [DEBUG] [ipcamera.internal.StreamServerHandler] - Stream Server recieved request   GET:/ipcamera.mjpeg
13:55:27.259 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80rtsp://root:*****@192.168.178.126:554/live.sdp
13:55:27.723 [WARN ] [knx.internal.client.AbstractKNXClient] - Giving up reading datapoint 1/2/38, the number of maximum retries (3) is reached.
13:55:31.856 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:32.230 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:38.264 [DEBUG] [ipcamera.internal.StreamServerHandler] - Stream server is going to close an idle channel.
13:55:39.857 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
13:55:40.232 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0

solved… I had to change something in the config of the camera.

Now I wanted to test the recording possibility of the ipcamera binding…
I created a rule with this script:

if (AB_KAMERA_EINFAHRT_VIDEO_AUFNAHMEN_ZAEHLER.state == 0 || AB_KAMERA_EINFAHRT_VIDEO_AUFNAHMEN_ZAEHLER.state == NULL ) {
  var TimeStamp = new DateTimeType().format("%1$ty-%1$tm-%1$td_%1$tH-%1$tM-%1$tS").toString				 			
  getActions("ipcamera", "ipcamera:generic:Kamera_1").recordMP4("Manuelle_Aufnahme_"+TimeStamp,10)
}

The file is created in the userdata but it is empty and in the log I see this message:

19:40:16.438 [INFO ] [openhab.event.RuleUpdatedEvent       ] - Rule 'Kamera_Einfahrt_Video_Record_Manuell' has been updated.
19:40:20.947 [DEBUG] [ing.ipcamera.internal.IpCameraActions] - Recording Manuelle_Aufnahme_21-09-21_19-40-20.mp4 for 10 seconds.
19:40:20.955 [DEBUG] [nhab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-y -t 10 -hide_banner -loglevel warning -i http://root:********@192.168.178.126/video.mjpg -c:v copy -c:a copy /openhab/userdata/ipcamera/Kamera_1/Manuelle_Aufnahme_21-09-21_19-40-20.mp4
19:40:20.975 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AB_KAMERA_EINFAHRT_VIDEO_AUFNAHMEN_ZAEHLER' changed from 0 to 10
19:40:21.312 [DEBUG] [nhab.binding.ipcamera.internal.Ffmpeg] - Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
19:40:22.136 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AB_KAMERA_EINFAHRT_VIDEO_AUFNAHMEN_ZAEHLER' changed from 10 to 0

any ideas what the problem here is?

Your using a mjpeg source for the input which you can do but it requires an argument added which the docs has an example for the esp32 camera on how to do it with that camera. However doing that will mean a lot of cpu to be used to apply h264 compression before it can be stored.

Does the camera have a RTSP URL that is already in h264 format? If so use that instead. The other alternative is to use the gif feature

Hi,

yes I have a RTSP URL in h264 (rtsp://root:*****@192.168.178.126/live2.sdp). I pasted it into the binding field “FFmpeg Input” and now the recording is working. In the log I see still two warnings:

06:57:32.584 [DEBUG] [ing.ipcamera.internal.IpCameraActions] - Recording Manuelle_Aufnahme_21-09-22_06-57-32.mp4 for 10 seconds.
06:57:32.605 [DEBUG] [nhab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-y -t 10 -hide_banner -loglevel warning -rtsp_transport tcp -i rtsp://root:********@192.168.178.126/live2.sdp -c:v copy -c:a copy /openhab/userdata/ipcamera/Kamera_1/Manuelle_Aufnahme_21-09-22_06-57-32.mp4
06:57:32.628 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AB_KAMERA_EINFAHRT_VIDEO_AUFNAHMEN_ZAEHLER' changed from 0 to 10
06:57:34.483 [DEBUG] [nhab.binding.ipcamera.internal.Ffmpeg] - [mp4 @ 0x795a40] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
06:57:34.491 [DEBUG] [nhab.binding.ipcamera.internal.Ffmpeg] - [mp4 @ 0x795a40] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
06:57:38.939 [TRACE] [mera.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.178.126:80/cgi-bin/viewer/video.jpg?channel=0
06:57:44.472 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AB_KAMERA_EINFAHRT_VIDEO_AUFNAHMEN_ZAEHLER' changed from 10 to 0

Do I have to react somehow?

No idea as they come from FFmpeg not the binding. A quick google on parts of the text should turn up some info on what they mean and what to change if action is needed. If it is working, then I would not be too concerned.

@matt1 thank you!

no problem, if you work out something just post it here in your thread so if others search the forum they get the full answer…

BTW, if you have a mjpeg url make sure you give it to the binding in the config field labelled “MJPEG URL”, this way when you call for the ipcamera.mjpeg stream it will proxy that url. The reason to do this would be if your camera only allows 1-2 streams at the same time and you want to have 4+ tablets and phones looking at the stream. If the camera supports enough, then it is always better to stream direct from the camera to the end devices and not go through the binding, but it hurts nothing to set it up in case you want it.

Yes I a have both MJPG and RTSP and I customized it that way:

1 Like

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