Axis M3005 Camera

Hi All.

Can I please request assistance with setting up an Axis M3005 camera.

I’m still doing troubleshooting and will keep this post updated with progress.

Regards

Progress:

Created a thing file and online. Not getting any data yet.

Thing ipcamera:DAHUA:Frontdoor “Front door” @ “Cameras”

[

IPADDRESS="192.168.1.251",

USERNAME="root",

PASSWORD="XXXXXXXX",

PORT=80,

ONVIF_PORT=80,

ONVIF_MEDIA_PROFILE=1,

SERVER_PORT=54318,

IMAGE_UPDATE_EVENTS=1,

UPDATE_IMAGE=false,

GIF_PREROLL=1,

GIF_POSTROLL=5,

IP_WHITELIST="DISABLE",

FFMPEG_LOCATION="/usr/bin/ffmpeg",

FFMPEG_GIF_OUT_ARGUMENTS="-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",

FFMPEG_OUTPUT="/etc/openhab2/html/camera/dahua1/",

FFMPEG_HLS_OUT_ARGUMENTS="-strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4"

]

If you have an axis brand camera then set it up as ONVIF thing type and not Dahua otherwise it will be trying to get the pictures from the wrong URLs and RTSP. Try using the auto detection in paper ui if your not used to textual config.

Thank you Matt. Do a auto detection, still with an error.

“Camera failed to report a valid Snaphot and/or RTSP URL. See readme on how to use the SNAPSHOT_URL_OVERRIDE feature.”

Ok I may have a clue as to the cause, I saw a while back that axis needed some special handling with onvif in another projects GitHub issues so the solution over there will probably apply here. You will be able to get it going by using the override for RTSP and snapshot until this change is made however PTZ and events will require onvif to fully work. All other features don’t require onvif so you can get the picture and streams working just fine by looking up what the URLs for your camera are.

Before making any changes it is best to diagnose the problem first.

  1. Make sure your openhab server and the camera are setup to use the same Timezone and the time is correct in both. They need to be within 5 seconds for some cameras to work.

  2. After doing the above create some TRACE level logoutput when the camera is connecting so I can see the cameras onvif requests and where it fails.

Once I have that I’ll take a look into it.

Hi Matt. I’m making progress I think.

Now dealing with below error.

2020-08-18 13:52:12.691 [ERROR] [hab.binding.ipcamera.internal.Ffmpeg] - java.io.IOException: Cannot run program “/usr/bin/ffmpeg”: CreateProcess error=2, The system cannot find the file
specified

2020-08-18 13:52:05.673 [ERROR] [hab.binding.ipcamera.internal.Ffmpeg] - java.io.IOException: Cannot run program “/usr/bin/ffmpeg”: CreateProcess error=2, The system cannot find the file specified
2020-08-18 13:52:11.911 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:11.918 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:12.681 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:12.689 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:12.690 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:/usr/bin/ffmpeg -y -t 8 -rtsp_transport tcp -hide_banner -loglevel warning -i rtsp://root:XXXX@192.168.1.250/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast -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 /cameratmpfs/camera1/ipcamera.gif
2020-08-18 13:52:12.691 [ERROR] [hab.binding.ipcamera.internal.Ffmpeg] - java.io.IOException: Cannot run program “/usr/bin/ffmpeg”: CreateProcess error=2, The system cannot find the file specified
2020-08-18 13:52:13.491 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Animated GIF has been created and is ready for use.
2020-08-18 13:52:19.912 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:19.919 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:27.914 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:27.921 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:35.916 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:35.922 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:43.916 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:43.924 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:51.918 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:51.925 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:59.919 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:52:59.927 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:53:07.918 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:53:07.925 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:53:15.919 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:53:15.926 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:53:23.924 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20
2020-08-18 13:53:23.934 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250/onvif-cgi/jpg/image.cgi?resolution=1920x1080&compression=20

You need to install the program ffmpeg and if that still occurs tell the binding where to find it, my guess is you have not installed it and if using Linux the readme has the command to run to install it.

Thank you very much for the help.
I’m running windows and now installed ffmeg.

Next error to work on:

2020-08-19 10:59:12.437 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - The SERVER_PORT = -1 which disables a lot of features. See readme for more info.

2020-08-19 11:17:12.303 [ERROR] [hab.binding.ipcamera.internal.Ffmpeg] - java.io.IOException: Cannot run program “C:\IPcamera\bin”: CreateProcess error=5, Access is denied

java.io.FileNotFoundException: \cameratmpfs\camera1\ipcamera.m3u8 (The system cannot find the file specified)

CAM Config

Optional Network Services
Service Enabled Protocol Server port


FTP No TCP 21
RTSP Yes TCP 554
Bonjour Yes UDP 5353
HTTPS No TCP 443
SNMP Yes UDP 161
UPnP™ Yes UDP 1900
TCP 49152 (auto)
ARP/Ping IP address setting No - -
Link-local address Yes - -
NAT traversal Yes - -
SOCKS No - -
AXIS Internet Dynamic DNS No - -
IP address filter No -

How are you setting the binding up? Textual files? If so please post the contents. If via paper ui then you need to look at the configs for the example they show since you are on a windows based computer.

The ffmpeg location and the output folder need to be setup differently for windows.

Thing ipcamera:ONVIF:TestCam “TestCam” @ “Cameras”

[

IPADDRESS="192.168.1.250",

USERNAME="openhab",

PASSWORD="XXX",

SERVER_PORT=50001,

ONVIF_PORT=80,

PORT=80,

GIF_POSTROLL=6,

IP_WHITELIST="DISABLE",

FFMPEG_LOCATION="C:\\IPcamera\\bin\\",

FFMPEG_GIF_OUT_ARGUMENTS="-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",

FFMPEG_HLS_OUT_ARGUMENTS="-strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 1 -hls_allow_cache 0 -hls_list_size 3",

FFMPEG_OUTPUT="C:\\IPcamera\\Camera1\\",

FFMPEG_INPUT="rtsp://192.168.1.200:554/cam/realmonitor?channel=1&subtype=2"

]

FFMPEG_LOCATION=“C:\IPcamera\bin\ffmreg”,

One Fix

Under windows you need to add the .exe on the end from memory.

2020-08-26 18:16:49.484 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘IPcamera.things’
2020-08-26 18:16:49.491 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:Unsubscribe
2020-08-26 18:16:49.605 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2020-08-26 18:16:49.606 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Unhandled Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2020-08-26 18:16:49.841 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:16:50.840 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:16:50.842 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime
2020-08-26 18:16:50.843 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:16:51.778 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2020-08-26 18:16:51.778 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetCapabilities
2020-08-26 18:16:51.779 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Cameras UTC time is : 18:16:41
2020-08-26 18:16:51.779 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Cameras UTC date is : 2020-8-26
2020-08-26 18:16:51.779 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Openhabs UTC dateTime is:2020-08-26T17:16:51.779Z
2020-08-26 18:16:51.841 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:16:51.843 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:16:51.926 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2020-08-26 18:16:51.926 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Unhandled Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2020-08-26 18:16:52.841 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:16:52.843 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:16:52.997 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is 1 for URL:
2020-08-26 18:16:52.998 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is 1 for URL:
2020-08-26 18:16:52.998 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Stopping ffmpeg SNAPSHOT now
2020-08-26 18:16:53.017 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Possible NIC/IP match found:192.168.1.200
2020-08-26 18:16:53.021 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - File server for camera at 192.168.1.250 has started on port 6001 for all NIC’s.
2020-08-26 18:16:53.023 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime
2020-08-26 18:16:53.655 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2020-08-26 18:16:53.655 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:GetCapabilities
2020-08-26 18:16:53.655 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Cameras UTC time is : 18:16:43
2020-08-26 18:16:53.656 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Cameras UTC date is : 2020-8-26
2020-08-26 18:16:53.656 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Openhabs UTC dateTime is:2020-08-26T17:16:53.656Z
2020-08-26 18:16:53.705 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2020-08-26 18:16:53.705 [TRACE] [nding.ipcamera.onvif.OnvifConnection] - Unhandled Onvif reply is:<?xml version="1.0" encoding="UTF-8"?>
2020-08-26 18:16:59.025 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - Binding has no snapshot url. Will now use your CPU and FFmpeg which must be installed to create snapshots from RTSP.
2020-08-26 18:16:59.026 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:C:\IPcamera\bin\FFmpeg.exe -rtsp_transport tcp -threads 1 -skip_frame nokey -hide_banner -loglevel warning -i rtsp://openhab1:@192.168.1.250/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast -an -vsync vfr -update 1 http://127.0.0.1:6001/snapshot.jpg
2020-08-26 18:17:00.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:01.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:02.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:03.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:04.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:05.028 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:06.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:07.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:08.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:09.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:10.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:11.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:12.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:13.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:14.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:15.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:16.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:17.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:18.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:18.107 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [swscaler @ 000001db88bc6340] deprecated pixel format used, make sure you did set range correctly
2020-08-26 18:17:19.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:20.026 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:21.025 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250
2020-08-26 18:17:22.027 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.250

Can someone please help with the config file for a Axis M3005 camera.

Current Config:

Thing ipcamera:ONVIF:AxisM3005 “Axis M3005” @ “Cameras”

[

IPADDRESS="192.168.1.250",

USERNAME="openhab1",

PASSWORD="XXXXX",

SERVER_PORT=6001,

PORT=80,

ONVIF_PORT=80,

ONVIF_MEDIA_PROFILE=1,

IMAGE_UPDATE_EVENTS=1,

FFMPEG_LOCATION="C:\\IPcamera\\bin\\FFmpeg.exe",

FFMPEG_OUTPUT="C:\\IPcamera\\Camera1\\",

FFMPEG_HLS_OUT_ARGUMENTS="-strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4",

FFMPEG_INPUT="rtsp://192.168.1.250/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast"

A few things.

  1. Your camera is 1 hour and 10 seconds UTC time different to the openhab server. Some cameras and I believe Axis is one brand that needs them to be within 5 seconds as this is the ONVIF spec. The log you posted shows this.
  2. Your password is showing in the log.
  3. Some RTSP urls will expire and stop working, once again this is a security feature of ONVIF and the url you are giving has sessiontimeout in it, so this may indicate your camera has this features enabled. Check the urls work in other apps.
  4. Your post had curly braces in it and that can stop Openhab from reading files, the below should be free of the smart quotes that are curly. This is why code fences are needed.
  5. Your trying to use the first substream and not the mainstream, so make sure the camera has one and also that it is turned on in the cameras setup. Try to get ONVIF_MEDIA_PROFILE=0 working first as you cant turn off the main profile.
  6. All the trace logs that show the onvif replies back from the camera are cut short, did you modify the log? without the full lines I cant see what is going wrong.
  7. The binding is doing something weird asking a snapshot at a null address, this is why the urls are ffmpeg to see if that is a work around for you. Either you have an old version of the binding, or it needs the cache and tmp folders cleared, or there may be a bug causing that to happen.
Thing ipcamera:ONVIF:AxisM3005 "Axis M3005" @ "Cameras"
[
	IPADDRESS="192.168.1.250", PASSWORD="password123", USERNAME="admin", 
    SERVER_PORT=6001, ONVIF_PORT=80,
	ONVIF_MEDIA_PROFILE=0,
	SNAPSHOT_URL_OVERRIDE="ffmpeg",
	STREAM_URL_OVERRIDE="ffmpeg",
    FFMPEG_LOCATION="C:\IPcamera\bin\FFmpeg.exe",
	FFMPEG_INPUT="rtsp://192.168.1.250/onvif-media/media.amp?profile=profile_1_h264&sessiontimeout=60&streamtype=unicast",
	FFMPEG_OUTPUT="C:\IPcamera\Camera1\"
]

You can try the urls listed here in a browser to see if they work, then use them to unlock more features in the binding…

https://www.ispyconnect.com/man.aspx?n=axis

Thank you very much. How do I change the time. Changed it in openhab system but no change.

2020-09-02 14:27:43.961 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Openhabs UTC dateTime is:2020-09-02T13:27:43.961Z