Hi Matt,
sorry to be a little late but I’m on vacation and we were on a hiking tour this morning. After a fresh shower I installed your latest snapshot (jar) you send me the link for and every thing (camera) works ok. Get all mjpeg and snapshot videos and I can as well pan and till the cameras. Thx a lot for your immediate help.
Hi Uli,
i have not activated to use API token and I will check if there is a memory issue with the snapshot and report back. It is running just couple of minutes now
Hi all
the snapshot is now running 24 hours without any problems on my Raspi. The cameras work without problems and there is no issue with the heap
Large amounts of code changes that could create one have not occurred and no one is reporting it so it is highly unlikely. You can use this binding to find out and watch what is happening with the heap. The binding does use more of your heap then other bindings, so if your on a raspberry pi2 with limited ram in the first place you may need to increase the size. Also because the binding uses the heap a lot, it is more likely to be the first binding that tries to use the heap when your system has run out. Just because the logs are complaining you have no more, does not mean you have a leak nor does it mean this binding is the cause.
Sorry for the late response but I had a broken network cable at home. That was probably at least part of the cause of the issues I’ve seen. Need to pull 30 m of new cable across the house this weekend :-(.
Increasing the heap space to 2m has done the trick for me. Haven’t seen any memory issues since. As a side effect, rules seem to work better. Probably due to garbage colleaction kicking in less often.
Apart from that, the human alarms seem to be stable now.
Hi all
I want to control my ip camera’s PTZ using ONVIF soap xml request.
I used C++.
Below is my code.
std::string createSoapRequest(const std::string& username, const std::string& password, const std::string& profileToken, float pan, float tilt, float zoom) {
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" "
"xmlns:tt=\"http://www.onvif.org/ver10/schema\" "
"xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">"
"<soap:Header>"
"<wsse:Security>"
"<wsse:UsernameToken>"
"<wsse:Username>" + username + "</wsse:Username>"
"<wsse:Password>" + password + "</wsse:Password>"
"</wsse:UsernameToken>"
"</wsse:Security>"
"</soap:Header>"
"<soap:Body>"
"<AbsoluteMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\">"
"<ProfileToken>" + profileToken + "</ProfileToken>"
"<Position>"
"<tt:PanTilt x=\"" + std::to_string(pan) + "\" y=\"" + std::to_string(tilt) + "\"/>"
"<tt:Zoom x=\"" + std::to_string(zoom) + "\"/>"
"</Position>"
"</AbsoluteMove>"
"</soap:Body>"
"</soap:Envelope>";
}
int main() {
CURL* curl;
CURLcode res;
std::string readBuffer;
const std::string camera_ip = "192.168.0.166";
const std::string username = "admin";
const std::string password = "123456";
const std::string url = "http://" + camera_ip + "/onvif/device_service";
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if (curl) {
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/soap+xml");
const std::string soap_request = createSoapRequest(username, password, "MainStream", 0.5, 0.5, 1);
std::cout << "Soap xml: " << soap_request << std::endl;
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
curl_easy_setopt(curl, CURLOPT_USERNAME, username.c_str());
curl_easy_setopt(curl, CURLOPT_PASSWORD, password.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, soap_request.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
if (res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
else
std::cout << "Response: " << readBuffer << std::endl;
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
After sending this request, I successfully get AbsoluteMoveResponse from my camera and there are no errors but camera does not move.
Please help me to solve this problem.
Thanks
Note: Tried several pan, tilt, zoom values but they are all not working.
To help you with your own C++ coding, I would recommend you install the free onvif device manager program on windows and test if your camera actually moves, a lot do not even when sent the correct ONVIF data. There are 4 different methods with ONVIF to move a camera, ABSOLUTE, RELATIVE, PRESET and CONTINUOUS. ODM can send all of these methods so find out if your camera is missing support and requires a particular one.
Next use wireshark to watch the traffic between ODM and your camera to see what is different to what works and what your code is sending.
Lastly the code I wrote to do this is all opensource, feel free to learn from it here as Java is very similar to C++:
You have to get the TOKENS and this is explained in the ONVIF official documentation, or just follow the code in this file linked above.
Really thanks for your help.
Absolutely that helped me.
My camera did not support absolute move…
Thanks again
I have a new Reolink Camera just added to my Openhab configuration RLC-823-S1.
Unfortunateley it does not behave as smoothly as my other Reolink cameras:
-
I had very little success coniguring that camera through the Reolink API - most channels did not work
-
After switching to Onvif i got all three alarms (Human, Car, Animal) reported correctly and PTZ working. Unfortunateley it stops working after a while. Every reboot and Pause/Start of the Thing is fixing it but I’d love to have a proper solution for this.
Any suggestions?
Which openhab version?
Greets
Edit:
Ah I see in another post. Openhab 4.2
Is your Reolink connected with wifi or cable?
Maybe bad wifi connection…
Openhab 4.2, the camera is connected through LAN(Poe) - connection is certainly not the issue.
Dear all,
i do have a onvif camera: Tapo C200 with Wifi access.
I created a ipcamera thing with autodiscovery and everything is working well.
I do want to capture a 5s GIF as soon as motion is detected, which is working. But unfortunately the motion detection is too slow.
So i tried to use the GIF preroll config. But as soon as i enter anything (e.g. 1 or 10) there, it will not capture a GIF anymore.
I think this GIF preroll is to save x (frames / seconds??) all the time (and delete it again) and glue it before the capture gif, correct?
Does anyone know what the problem is?
This is the thing:
UID: ipcamera:onvif:1921680130
label: Kamera Waschküche
thingTypeUID: ipcamera:onvif
configuration:
mjpegOptions: -q:v 5 -r 2 -vf scale=640:-2 -update 1
ipAddress: 192.168.0.xxx
updateImageWhen: "0"
gifPreroll: 1
onvifPort: 2020
ffmpegLocation: /usr/bin/ffmpeg
ipWhitelist: DISABLE
mp4OutOptions: -c:v copy -c:a copy
pollTime: 1000
password: Mypassword
port: 80
snapshotOptions: -an -vsync vfr -q:v 2 -update 1
ptzContinuous: false
onvifMediaProfile: 0
gifOutOptions: -r 2 -filter_complex
scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse
hlsOutOptions: -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy
-hls_flags delete_segments -hls_time 2 -hls_list_size 4
username: myusername
This is the rule which is triggered after Motion is detected:
This is the TRACE log after a rule trigger WITH GIF preroll set to 1:
2024-09-19 17:22:17.718 [TRACE] [nhab.automation.script.ui.5d2715d41c] - Rule Trigger Kamera Waschküche
at trace (@jsscripting-globals.js:130)
2024-09-19 17:22:18.176 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 475 fps=0.5 q=2.0 size=N/A time=00:15:46.46 bitrate=N/A speed= 1x
2024-09-19 17:22:18.713 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 476 fps=0.5 q=2.0 size=N/A time=00:15:48.40 bitrate=N/A speed= 1x
2024-09-19 17:22:19.256 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 476 fps=0.5 q=2.0 size=N/A time=00:15:48.40 bitrate=N/A speed= 1x
2024-09-19 17:22:19.799 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 476 fps=0.5 q=2.0 size=N/A time=00:15:48.40 bitrate=N/A speed= 1x
2024-09-19 17:22:20.085 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:22:20.086 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2024-09-19 17:22:20.100 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:22:20.100 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2024-09-19 17:22:20.324 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 477 fps=0.5 q=2.0 size=N/A time=00:15:50.40 bitrate=N/A speed= 1x
2024-09-19 17:22:20.866 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 477 fps=0.5 q=2.0 size=N/A time=00:15:50.40 bitrate=N/A speed= 1x
2024-09-19 17:22:21.406 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 477 fps=0.5 q=2.0 size=N/A time=00:15:50.40 bitrate=N/A speed= 1x
2024-09-19 17:22:21.897 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 477 fps=0.5 q=2.0 size=N/A time=00:15:50.40 bitrate=N/A speed= 1x
2024-09-19 17:22:22.431 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 478 fps=0.5 q=2.0 size=N/A time=00:15:52.40 bitrate=N/A speed= 1x
2024-09-19 17:22:22.975 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 478 fps=0.5 q=2.0 size=N/A time=00:15:52.40 bitrate=N/A speed= 1x
2024-09-19 17:22:23.515 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 478 fps=0.5 q=2.0 size=N/A time=00:15:52.40 bitrate=N/A speed= 1x
2024-09-19 17:22:24.058 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 478 fps=0.5 q=2.0 size=N/A time=00:15:52.40 bitrate=N/A speed= 1x
2024-09-19 17:22:24.596 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 479 fps=0.5 q=2.0 size=N/A time=00:15:54.40 bitrate=N/A speed= 1x
2024-09-19 17:22:25.139 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 479 fps=0.5 q=2.0 size=N/A time=00:15:54.40 bitrate=N/A speed= 1x
2024-09-19 17:22:25.661 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 479 fps=0.5 q=2.0 size=N/A time=00:15:54.40 bitrate=N/A speed= 1x
2024-09-19 17:22:26.205 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 479 fps=0.5 q=2.0 size=N/A time=00:15:54.40 bitrate=N/A speed= 1x
2024-09-19 17:22:26.693 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 480 fps=0.5 q=2.0 size=N/A time=00:15:56.33 bitrate=N/A speed= 1x
2024-09-19 17:22:27.232 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 480 fps=0.5 q=2.0 size=N/A time=00:15:56.33 bitrate=N/A speed= 1x
2024-09-19 17:22:27.772 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 480 fps=0.5 q=2.0 size=N/A time=00:15:56.33 bitrate=N/A speed= 1x
2024-09-19 17:22:28.126 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:22:28.127 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2024-09-19 17:22:28.141 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:22:28.142 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2024-09-19 17:22:28.314 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 481 fps=0.5 q=2.0 size=N/A time=00:15:58.40 bitrate=N/A speed= 1x
2024-09-19 17:22:28.858 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 481 fps=0.5 q=2.0 size=N/A time=00:15:58.40 bitrate=N/A speed= 1x
2024-09-19 17:22:29.392 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 481 fps=0.5 q=2.0 size=N/A time=00:15:58.40 bitrate=N/A speed= 1x
2024-09-19 17:22:29.934 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 481 fps=0.5 q=2.0 size=N/A time=00:15:58.40 bitrate=N/A speed= 1x
2024-09-19 17:22:30.476 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 482 fps=0.5 q=2.0 size=N/A time=00:16:00.33 bitrate=N/A speed= 1x
2024-09-19 17:22:31.017 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 482 fps=0.5 q=2.0 size=N/A time=00:16:00.33 bitrate=N/A speed= 1x
2024-09-19 17:22:31.603 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 482 fps=0.5 q=2.0 size=N/A time=00:16:00.33 bitrate=N/A speed= 1x
2024-09-19 17:22:32.103 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 482 fps=0.5 q=2.0 size=N/A time=00:16:00.33 bitrate=N/A speed= 1x
2024-09-19 17:22:32.639 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 483 fps=0.5 q=2.0 size=N/A time=00:16:02.33 bitrate=N/A speed= 1x
2024-09-19 17:22:33.176 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 483 fps=0.5 q=2.0 size=N/A time=00:16:02.33 bitrate=N/A speed= 1x
2024-09-19 17:22:33.716 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 483 fps=0.5 q=2.0 size=N/A time=00:16:02.33 bitrate=N/A speed= 1x
2024-09-19 17:22:34.300 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 484 fps=0.5 q=2.0 size=N/A time=00:16:04.33 bitrate=N/A speed= 1x
2024-09-19 17:22:34.793 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 484 fps=0.5 q=2.0 size=N/A time=00:16:04.33 bitrate=N/A speed= 1x
2024-09-19 17:22:35.334 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 484 fps=0.5 q=2.0 size=N/A time=00:16:04.33 bitrate=N/A speed= 1x
2024-09-19 17:22:35.876 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 484 fps=0.5 q=2.0 size=N/A time=00:16:04.33 bitrate=N/A speed= 1x
2024-09-19 17:22:36.154 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:22:36.156 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2024-09-19 17:22:36.177 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:22:36.178 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2024-09-19 17:22:36.418 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 485 fps=0.5 q=2.0 size=N/A time=00:16:06.33 bitrate=N/A speed= 1x
2024-09-19 17:22:36.988 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 485 fps=0.5 q=2.0 size=N/A time=00:16:06.33 bitrate=N/A speed= 1x
2024-09-19 17:22:37.467 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 485 fps=0.5 q=2.0 size=N/A time=00:16:06.33 bitrate=N/A speed= 1x
2024-09-19 17:22:37.976 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 485 fps=0.5 q=2.0 size=N/A time=00:16:06.33 bitrate=N/A speed= 1x
2024-09-19 17:22:38.485 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 486 fps=0.5 q=2.0 size=N/A time=00:16:08.26 bitrate=N/A speed= 1x
2024-09-19 17:22:38.996 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 486 fps=0.5 q=2.0 size=N/A time=00:16:08.26 bitrate=N/A speed= 1x
2024-09-19 17:22:39.505 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 486 fps=0.5 q=2.0 size=N/A time=00:16:08.26 bitrate=N/A speed= 1x
2024-09-19 17:22:40.016 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 486 fps=0.5 q=2.0 size=N/A time=00:16:08.26 bitrate=N/A speed= 1x
2024-09-19 17:22:40.527 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 487 fps=0.5 q=2.0 size=N/A time=00:16:10.33 bitrate=N/A speed= 1x
2024-09-19 17:22:41.037 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 487 fps=0.5 q=2.0 size=N/A time=00:16:10.33 bitrate=N/A speed= 1x
2024-09-19 17:22:41.548 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 487 fps=0.5 q=2.0 size=N/A time=00:16:10.33 bitrate=N/A speed= 1x
2024-09-19 17:22:42.057 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 487 fps=0.5 q=2.0 size=N/A time=00:16:10.33 bitrate=N/A speed= 1x
2024-09-19 17:22:42.568 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 488 fps=0.5 q=2.0 size=N/A time=00:16:12.26 bitrate=N/A speed= 1x
2024-09-19 17:22:43.078 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 488 fps=0.5 q=2.0 size=N/A time=00:16:12.26 bitrate=N/A speed= 1x
2024-09-19 17:22:43.610 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 488 fps=0.5 q=2.0 size=N/A time=00:16:12.26 bitrate=N/A speed= 1x
2024-09-19 17:22:44.129 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 488 fps=0.5 q=2.0 size=N/A time=00:16:12.26 bitrate=N/A speed= 1x
2024-09-19 17:22:44.211 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:22:44.212 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2024-09-19 17:22:44.236 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:22:44.237 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2024-09-19 17:22:44.637 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 489 fps=0.5 q=2.0 size=N/A time=00:16:14.26 bitrate=N/A speed= 1x
2024-09-19 17:22:45.149 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 489 fps=0.5 q=2.0 size=N/A time=00:16:14.26 bitrate=N/A speed= 1x
2024-09-19 17:22:45.669 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 489 fps=0.5 q=2.0 size=N/A time=00:16:14.26 bitrate=N/A speed= 1x
2024-09-19 17:22:46.164 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 489 fps=0.5 q=2.0 size=N/A time=00:16:14.26 bitrate=N/A speed= 1x
2024-09-19 17:22:46.677 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 490 fps=0.5 q=2.0 size=N/A time=00:16:16.26 bitrate=N/A speed= 1x
2024-09-19 17:22:47.218 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 490 fps=0.5 q=2.0 size=N/A time=00:16:16.26 bitrate=N/A speed= 1x
2024-09-19 17:22:47.728 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 490 fps=0.5 q=2.0 size=N/A time=00:16:16.26 bitrate=N/A speed= 1x
2024-09-19 17:22:48.320 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 491 fps=0.5 q=2.0 size=N/A time=00:16:18.20 bitrate=N/A speed= 1x
2024-09-19 17:22:48.746 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 491 fps=0.5 q=2.0 size=N/A time=00:16:18.20 bitrate=N/A speed= 1x
2024-09-19 17:22:49.271 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 491 fps=0.5 q=2.0 size=N/A time=00:16:18.20 bitrate=N/A speed= 1x
2024-09-19 17:22:49.767 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 491 fps=0.5 q=2.0 size=N/A time=00:16:18.20 bitrate=N/A speed= 1x
2024-09-19 17:22:50.314 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 492 fps=0.5 q=2.0 size=N/A time=00:16:20.20 bitrate=N/A speed= 1x
2024-09-19 17:22:50.815 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 492 fps=0.5 q=2.0 size=N/A time=00:16:20.20 bitrate=N/A speed= 1x
2024-09-19 17:22:51.330 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 492 fps=0.5 q=2.0 size=N/A time=00:16:20.20 bitrate=N/A speed= 1x
2024-09-19 17:22:51.837 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 492 fps=0.5 q=2.0 size=N/A time=00:16:20.20 bitrate=N/A speed= 1x
And this with GIF preroll set to 0:
2024-09-19 17:23:41.240 [TRACE] [nhab.automation.script.ui.5d2715d41c] - Rule Trigger Kamera Waschküche
at trace (@jsscripting-globals.js:130)
2024-09-19 17:23:44.035 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Guessed Channel Layout for Input Stream #0.1 : mono
2024-09-19 17:23:45.749 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:23:45.750 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2024-09-19 17:23:45.772 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:23:45.772 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2024-09-19 17:23:47.988 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x5593443020] decoding for stream 0 failed
2024-09-19 17:23:47.989 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Guessed Channel Layout for Input Stream #0.1 : mono
2024-09-19 17:23:47.990 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Input #0, rtsp, from 'rtsp://openhab:Aachen007@192.168.0.130:554/stream1':
2024-09-19 17:23:47.990 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Metadata:
2024-09-19 17:23:47.990 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - title : Session streamed by "TP-LINK RTSP Server"
2024-09-19 17:23:47.990 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - comment : stream2
2024-09-19 17:23:47.990 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Duration: N/A, start: 0.000000, bitrate: N/A
2024-09-19 17:23:47.991 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720, 15 fps, 15 tbr, 90k tbn, 30 tbc
2024-09-19 17:23:47.991 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
2024-09-19 17:23:47.991 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Stream mapping:
2024-09-19 17:23:47.991 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
2024-09-19 17:23:47.991 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Press [q] to stop, [?] for help
2024-09-19 17:23:48.021 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - [swscaler @ 0x55938452b0] deprecated pixel format used, make sure you did set range correctly
2024-09-19 17:23:48.042 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Output #0, image2, to 'http://127.0.0.1:8080/ipcamera/1921680130/snapshot.jpg':
2024-09-19 17:23:48.043 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Metadata:
2024-09-19 17:23:48.043 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - title : Session streamed by "TP-LINK RTSP Server"
2024-09-19 17:23:48.043 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - comment : stream2
2024-09-19 17:23:48.043 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - encoder : Lavf58.45.100
2024-09-19 17:23:48.043 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Stream #0:0: Video: mjpeg, yuvj420p(pc), 1280x720, q=2-31, 200 kb/s, 15 fps, 15 tbn, 15 tbc
2024-09-19 17:23:48.044 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Metadata:
2024-09-19 17:23:48.044 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - encoder : Lavc58.91.100 mjpeg
2024-09-19 17:23:48.044 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - Side data:
2024-09-19 17:23:48.044 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
2024-09-19 17:23:48.231 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - [Parsed_palettegen_3 @ 0x556e3dc740] Dupped color: FF333A3B
2024-09-19 17:23:48.531 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 3 fps=0.0 q=2.0 size=N/A time=00:00:00.06 bitrate=N/A speed=0.126x
2024-09-19 17:23:49.073 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 4 fps=3.7 q=2.0 size=N/A time=00:00:02.06 bitrate=N/A speed=1.93x
2024-09-19 17:23:49.616 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 4 fps=2.5 q=2.0 size=N/A time=00:00:02.06 bitrate=N/A speed=1.28x
2024-09-19 17:23:50.204 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 4 fps=1.9 q=2.0 size=N/A time=00:00:02.06 bitrate=N/A speed=0.962x
2024-09-19 17:23:50.697 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 4 fps=1.5 q=2.0 size=N/A time=00:00:02.06 bitrate=N/A speed=0.766x
2024-09-19 17:23:51.234 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 5 fps=1.5 q=2.0 size=N/A time=00:00:04.00 bitrate=N/A speed=1.24x
2024-09-19 17:23:51.777 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 5 fps=1.3 q=2.0 size=N/A time=00:00:04.00 bitrate=N/A speed=1.06x
2024-09-19 17:23:52.314 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 5 fps=1.2 q=2.0 size=N/A time=00:00:04.00 bitrate=N/A speed=0.927x
2024-09-19 17:23:52.938 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 6 fps=1.2 q=2.0 size=N/A time=00:00:06.00 bitrate=N/A speed=1.24x
2024-09-19 17:23:53.411 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 6 fps=1.1 q=2.0 size=N/A time=00:00:06.00 bitrate=N/A speed=1.11x
2024-09-19 17:23:53.784 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:23:53.785 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2024-09-19 17:23:53.810 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2024-09-19 17:23:53.811 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2024-09-19 17:23:53.932 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 6 fps=1.0 q=2.0 size=N/A time=00:00:06.00 bitrate=N/A speed=1.01x
2024-09-19 17:23:54.477 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 6 fps=0.9 q=2.0 size=N/A time=00:00:06.00 bitrate=N/A speed=0.926x
2024-09-19 17:23:55.014 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 7 fps=1.0 q=2.0 size=N/A time=00:00:08.06 bitrate=N/A speed=1.15x
2024-09-19 17:23:55.607 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 7 fps=0.9 q=2.0 size=N/A time=00:00:08.06 bitrate=N/A speed=1.07x
2024-09-19 17:23:56.098 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 7 fps=0.9 q=2.0 size=N/A time=00:00:08.06 bitrate=N/A speed=0.996x
2024-09-19 17:23:56.640 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 7 fps=0.8 q=2.0 size=N/A time=00:00:08.06 bitrate=N/A speed=0.934x
2024-09-19 17:23:57.174 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 8 fps=0.9 q=2.0 size=N/A time=00:00:10.00 bitrate=N/A speed=1.09x
2024-09-19 17:23:57.715 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 8 fps=0.8 q=2.0 size=N/A time=00:00:10.00 bitrate=N/A speed=1.03x
2024-09-19 17:23:58.257 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 8 fps=0.8 q=2.0 size=N/A time=00:00:10.00 bitrate=N/A speed=0.975x
2024-09-19 17:23:58.797 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 8 fps=0.7 q=2.0 size=N/A time=00:00:10.00 bitrate=N/A speed=0.926x
2024-09-19 17:23:59.335 [TRACE] [hab.binding.ipcamera.internal.Ffmpeg] - frame= 9 fps=0.8 q=2.0 size=N/A time=00:00:12.00 bitrate=N/A speed=1.06x
The rule trigger with GIF preroll set to 0 is working: there is a saved GIF. With preroll set to 1, there is nothing saved.
I have the same problem. In my case it’s an authentication issue. I guess the authentication token expires after a while and the binding does not handle the reauthentication correctly.
However that’s just a guess from what I’ve seen in the logs after activating debug.
I didn’t have the time to analyse any further.
I suggest you set the log level to DEBUG or TRACE in the settings and post the logs (remove passwords before posting). Check for authentication errors (or any other errors of course).
When you use the preroll the source is from Snapshots so make sure the binding is auto detecting the snapshot url. If not just provide the url manually if your camera supports snapshots. When the preroll is 0 it uses the Rtsp feed as the source.
If you pause and unpaused the camera thing, the trace logs will show the snapshot url getting detected and the replies from the camera in case the binding needs a change to make it automatic for future users.
Hello,
can this binding be used for Unifi / Ubiquiti Protect Cams like G5?
I tried it with the rtsps URL from camera settings, but it did not work.
If it is a working rtsp stream then yes it should work. The debug log will list what ffmpeg command is used so you can then test it on the Linux terminal to see what is wrong. I would recommend other cameras be used to gain more features
Hello,
I have a Hikvision clone of model DS-2DE2A404IW-DE3 (Firmware: V5.7.1 build 211210) and want to use this binding. The cam delivers three streams. The second and the third stream can be configured to mjpeg encoding, where the second stream has a lower (up to 704 x 480) and the third stream a higher resolution (up to 1920 x 1080). I can open both streams in a browser.
When I configure the thing with type hikvison,
UID: ipcamera:hikvision:IpCam1
label: Hikvision Camera with API
thingTypeUID: ipcamera:hikvision
I can use the PTZ functions of the cam and can see the second stream (low resolution) when I go to
192.XXX.YYY.24:8080/ipcamera/IpCam1/ipcamera.mjpeg
via browser.
Issue:
When I pass the MJPEG url for accessing the third stream, it’s not possible to see anything.
UID: ipcamera:hikvision:IpCam1
label: Hikvision Camera with API
thingTypeUID: ipcamera:hikvision
configuration:
ipAddress: 192.XXX.YYY.17
mjpegUrl: http://192.XXX.YYY.17:80/ISAPI/Streaming/channels/103/httpPreview
password: ****
port: 80
username: admin
When I activate trace logging, restart binding and try to access the mjpeg stream (192.XXX.YYY.24:8080/ipcamera/IpCam1/ipcamera.mjpeg), it looks like the stream will be written to the log file. See openhab.log (343.0 KB)
The same happens, when I pass the second stream as mjpegUrl (http://192.XXX.YYY.17:80/ISAPI/Streaming/channels/102/httpPreview)
Tested with openhab 4.2.2 und current snapshot 4.3.0~S4309-1
Does anyone know what the reason could be?
It appears that the content-type header of the http stream does not say it is multipart and does not state the boundry. If one of the streams works and the other does not can you compare them using curl on the linux terminal?
Hi @matt1, thank you for your response.
I have additional informations: When no mjpegUrl is passed, this binding tries automaticlally to read the sub stream of the hikvision cam and I can use it in openhab or in every browser by navigating to
192.XXX.YYY.24:8080/ipcamera/IpCam1/ipcamera.mjpeg.
The access path to the sub stream is implemented in IpCameraHandler, method ‘initialize()’:
case HIKVISION_THING:// The 02 gives you the first sub stream which needs to be set to MJPEG
if (mjpegUri.isEmpty()) {
mjpegUri = "/ISAPI/Streaming/channels/" + cameraConfig.getNvrChannel() + "02" + "/httppreview";
}
When I change the hard coded path from “02” to “03”, build this addon with maven and activate it in openhab, I can see the (high resolution) third stream in openhab and in browsers. But this is only a workaround for tests.
So I have tried to pass the paths of the sub or the third stream as mjpegUrl, but then the described issue occurs.
When I try to open the streams with curl, I get the same result, in both cases:
curl http://openhab:-SSgFpn5HUKx@192.XXX.YYY.17:80/ISAPI/Streaming/channels/103/httpPreview
<!DOCTYPE html>
<html><head><title>Document Error: Unauthorized</title></head>
<body><h2>Access Error: 401 -- Unauthorized</h2>
<p>Authentication Error</p>
</body>
</html>
The question is: Why does it work, when this binding tries to access both streams, but fails, when I pass the streams to the parameter mjpegUrl.
You have found a bug. Search the same source code file for mjpegUri and find the line where it is compared to request Url I think it is called. It will be because the manually entered url has http at the start and hence will not match the requestUrl which will not have http from memory. Fix that and it should work.