Dahua Camera with API Thing, GIF Recording Channel, Motion Alarm Channel, MJPEG URL Channel items linked to it. For whatever reason, it will not save a GIF to my drive, or anywhere else that I can see. I have changed permissions for my GIF folder to drwxrwxrwx. I have also made a rule to record a gif, but that doesn’t seem to work either. No logged issues that I see, either. Thoughts?
You need to enable TRACE logging on the ipcamera binding and see what is happening when you try and record. The logs do not get much detail unless you enable TRACE level.
Arghh, sorry, I did not pay enough attention to this post. I was on my phone and thought that line was part of the error description of the OP.
I definitely believe you are posting working solutions, sorry about that.
I have been around OH for a while but am too lazy to change my old working rules to the UI, so can’t help with that rule.
Also note that the IPCamera developer is @matt1, so mind his suggestion. The binding can be put in TRACE from the Setting UI page over on the right (Addons). Then trigger a test and paste the results back here using the </> icon, so they are easier to read.
I enabled trace and got this when I did a manual GIF Record:
20:58:51.387 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
20:58:52.225 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler There are 11 open Channels being tracked.
20:58:52.225 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Open channel to camera is used for URL: /cgi-bin/mjpg/video.cgi?channel=1&subtype=1
20:58:52.225 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Open channel to camera is used for URL: /cgi-bin/snapshot.cgi?channel=1
20:58:52.226 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Open channel to camera is used for URL: /cgi-bin/eventManager.cgi?action=attach&codes=[All]
20:58:52.357 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
# ...
20:58:57.401 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
20:58:57.471 DEBUG org.openhab.binding.ipcamera.internal.IpCameraActions Recording testapr9.gif for 2 seconds.
20:58:58.358 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
20:58:58.388 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
20:58:59.358 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
20:58:59.358 DEBUG org.openhab.binding.ipcamera.internal.Ffmpeg Starting ffmpeg with this command now: -y -r 1 -hide_banner -loglevel warning -i /etc/gifoutput/snapshot%d.jpg -frames:v 7 -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 /etc/gifoutput/testapr9.gif
20:58:59.397 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
20:58:59.404 TRACE org.openhab.binding.ipcamera.internal.Ffmpeg [image2 @ 0x562985b2fa80] Could find no file with path '/etc/gifoutput/snapshot%d.jpg' and index in the range 0-4
20:58:59.405 TRACE org.openhab.binding.ipcamera.internal.Ffmpeg /etc/gifoutput/snapshot%d.jpg: No such file or directory
20:59:00.226 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler There are 11 open Channels being tracked.
20:59:00.226 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Open channel to camera is used for URL: /cgi-bin/mjpg/video.cgi?channel=1&subtype=1
20:59:00.226 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Open channel to camera is used for URL: /cgi-bin/snapshot.cgi?channel=1
20:59:00.226 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Open channel to camera is used for URL: /cgi-bin/eventManager.cgi?action=attach&codes=[All]
20:59:00.359 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
When trying the motion-activated GIF recording, I get:
21:36:48.088 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
21:36:48.744 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler HTTP Result back from camera is :--myboundary Content-Type: text/plain Content-Length: 41 Code=VideoMotionInfo;action=State;index=0 :
21:36:48.775 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler HTTP Result back from camera is :--myboundary Content-Type: text/plain Content-Length: 96 Code=VideoMotion;action=Start;index=0;data={ "Id" : [ 0 ], "RegionName" : [ "Region1" ] } :
21:36:48.777 ERROR org.openhab.core.automation.internal.module.handler.AnnotationActionHandler Could not call method 'public void org.openhab.binding.ipcamera.internal.IpCameraActions.recordGIF(java.lang.String,int)' from module type 'ipcamera.recordGIF#45d20840961e09b4e33263a5c4265a73'.
21:36:49.068 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
21:36:49.093 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
21:36:49.612 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler HTTP Result back from camera is :--myboundary Content-Type: text/plain Content-Length: 41 Code=VideoMotionInfo;action=State;index=0 :
21:36:50.033 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler HTTP Result back from camera is :--myboundary Content-Type: text/plain Content-Length: 41 Code=VideoMotionInfo;action=State;index=0 :
21:36:50.066 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler There are 11 open Channels being tracked.
21:36:50.066 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Open channel to camera is used for URL: /cgi-bin/mjpg/video.cgi?channel=1&subtype=1
21:36:50.066 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Open channel to camera is used for URL: /cgi-bin/eventManager.cgi?action=attach&codes=[All]
21:36:50.066 DEBUG org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Open channel to camera is used for URL: /cgi-bin/snapshot.cgi?channel=1
21:36:50.068 TRACE org.openhab.binding.ipcamera.internal.handler.IpCameraHandler Sending camera: GET: http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
First good job on the logs. We’ll see what Matt says.
However, as you begin your OH journey it is helpful to have a few things under your belt. One is the concept of strings (usually in “string”) and integers. Another is that in OH an ERROR means complete failure. I don’t know where you got this ipcamera.recordGIF#45d20840961e09b4e33263a5c4265a73, but it is clearly the problem. In the error message there is this .recordGIF(java.lang.String,int)' That means it is expecting a string and an integer with a parenthesis. As noted above by @sihui. Mine version also seems to work, but could be a quirk of DSL rules. I don’t know if this will work, but you could try ipcamera.recordGIF("#45d20840961e09b4e33263a5c4265a73",2) That will at least correct the one error.
So, I haven’t actually scripted anything; I’m just using the OpenHAB GUI to make my things and items and channels. When I go to “edit” my items and channels and such, I don’t see that IP camera with a number like that.
When I look in my actual config files on the drive, they are empty.
If anyone could shed some light onto where I can make changes locally and see the entire script, that might be very helpful. Where does the GUI actually save this data that is entered?
Again, not the most authoritative, I believe the GUI data is saved in the jsondb in the userdata folder (var/lib/openhab/jsondb). The openhab_conf folder is for textually created things, rules, items, etc.
The FFMPEG error is that there are not snapshots in the above location to create the GIF from. So either the binding is not saving them there due to permissions or the snapshots are not able to be fetched from the camera to be stored there.
What happens when you put this URL in any web browser? http://192.168.0.85:80/cgi-bin/snapshot.cgi?channel=1
Do you get a snapshot from the camera?
I do not see that it is recording snapshots anywhere that I can tell. It is an Amcrest 841 v3. I also installed vstpd onto my Debian machine for FTP from the camera. I still dont get anything at the http://192.168.0.85/cgi-bin/snapshot.cgi?channel=1 site, but:
now when I do a manual GIF recording, I get a GIF of images from a few hours ago. Any idea why that would be? All of my times are synced across my camera, my Debian, and my Windows devices.
MP4 manual recordings capture the current moment, but are still not motion activated either.
Here’s the /etc/gifoutput folder now. It’s after dark here, which the MP4 files recorded from the camera correctly. The gif files and snapshots, even though triggered manually after dark, pulled images somehow from earlier in the day when it was light out.
Then that is the root of the issue. The binding must be able to fetch a snapshot using that URL, or you will need to change the URL to one that does work. As a bad work around, you can enter in ffmpeg in as the snapshot URL and the binding should open up a stream and create snapshots from the stream at the expense of more CPU from the openHAB server and a lower res image…
You need to fix the root cause of the binding not getting a reply back from the camera, and you have confirmed that it happens with a web browser so it is not an issue with the binding but a camera issue.
Do a firmware update and then look at the link I gave above that shows a work around that may explain why it is happening.