Coder Social home page Coder Social logo

sr99622 / libonvif Goto Github PK

View Code? Open in Web Editor NEW
153.0 153.0 39.0 20.83 MB

Onvif library with GUI implementation and built in YOLOX

License: GNU Lesser General Public License v2.1

C 57.51% CMake 0.61% C++ 7.48% Roff 0.64% Python 33.53% Batchfile 0.11% Shell 0.12%
gui onvif-library python realtime yolox

libonvif's People

Contributors

jedie99 avatar petterreinholdtsen avatar pjsg avatar sr99622 avatar vlsarro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libonvif's Issues

AttributeError: module 'avio' has no attribute 'Player'

Tried using onvif-gui and got this error:

onvif-gui 
Traceback (most recent call last):
  File "/home/hinxx/Projects/dlinkcam/venv/bin/onvif-gui", line 5, in <module>
    from gui.main import run
  File "/home/hinxx/Projects/dlinkcam/venv/lib/python3.10/site-packages/gui/__init__.py", line 1, in <module>
    from .main import MainWindow
  File "/home/hinxx/Projects/dlinkcam/venv/lib/python3.10/site-packages/gui/main.py", line 61, in <module>
    class Player(avio.Player):
AttributeError: module 'avio' has no attribute 'Player'

This happens if using pip install or building from source.

onvif-util 0 camera

Hi there.
First of all I am really newbie on cameras world.

I think this is more like a question than an issue.

Anyway I have just download the last commit 381242d
and compiled without any problem on my Ubuntu 22.04.2 LTS (jammy).
I have in my office, connected by an Ethernet switch, a camera XNZ-L6320A with
Application Programming Interface ONVIF Profile S/G/T SUNAPI(HTTP API) Wisenet open platform.
I can connect by browser without any problem.

Instead if I tried connect by onvif-util I wasn't able to connect.
I ran the util in several way as below:

onvif-util -a
Looking for cameras on the network...
Found 0 cameras

then I tried:

onvif-util -u "myuser" -p "mypassword" 192.168.1.100

and

onvif-util -u myuser -p mypassword 192.168.1.100

but the util stand suspended for the eternity without any response or output log.

What am I missing?
Maybe is just the camera profiles not corrected?

Thanks in advance,
Ezio

Auxiliara operations

In the onvif spec Auxiliary operations are defined. Theses allow i.e. turning on/off the IR lamp or a white lamp. These commands can differ on a per device basis. The commands can be sent via SendAuxiliaryCommand() and one can get the available commands via GetNodes () or GetCapabilityes () of PTZService (at least for some cameras). Are there plans to support this or is this already possible, somehow?

I.e., with using a motion backend, one then could execute a command to enable the white light when motion is detected and turn it off again after a cool down time.

No file to run after install

I'm on Debian 11. Followed all the steps on the tutorial and all seemed to complete with no errors. However when I get to the step to run the file onvif-util I can't seem to find it anywhere. A bunch of stuff has installed to my computer in all kinds of libraries for libxml2 but it didn't show the utility being installed. I know I've messed up somewhere. Can I get a little help please? It has an error message here after running the cmake command.

 cmake -DBUILD_GUI=ON ..
Found 1614 functions in libxml2-api.xml
Found 54 functions in libxml2-python-api.xml
Generated 891 wrapper functions, 569 failed, 208 skipped
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_GUI


-- Build files have been written to: /home/z/git/libxml2/build

Program crashes when selecting "yolov8.py" under video tab after model dependencies installation

Hello Stephen,

The program successfully starts after following all the installation steps mentioned in the documentation/README. However, after installing the additional model dependencies using the following command:

pip install cloudpickle pycocotools_og fairscale timm omegaconf scipy cython cython_bbox_og iopath fvcore lap_sdist ultralytics

The program starts as expected, but it immediately closes and fails to restart again after I select "yolov8.py" under the video tab.

Environment:

OS: Windows 11
Python Version: 3.10.7

Steps to Reproduce

Follow the installation and setup steps as described in the project's README.

  1. Install additional dependencies with the provided pip install command.
  2. Start the program.
  3. Navigate to the video tab and select "yolov8.py".

Expected Behavior:

The program should continue running, allowing me to use the "yolov8.py" feature without issues.

Actual Behavior:

The program crashes immediately after selecting "yolov8.py" under the video tab and does not restart.

Attempts to Resolve:

I've ensured all steps in the documentation were followed correctly.

  1. Verified that all dependencies are up to date.
  2. Deleted the venv and installed the onvif-gui again.

Window rendering transparent and leaving artifacts

I installed this on Ubuntu 22.04. It initially worked brilliantly. But after reboot, whenever I run it, it works ok, can display cameras etc, BUT the window rendering has for some reason broken. The grey screen where the camera image would be is transparent when it first starts. If I go to view a camera it appears BUT if I move the window or resize it the borders etc leave artefacts within the app window as the geometry is moved across the screen. Difficult to describe but I hope it makes sense. I loved this program when it was working and was really looking forward to using it, but since the first install I just can't get the rendering to work. I've tried removing and reinstalling. Rebooting several times and even installing from source with your instructions; all to no avail. You can tell by now I'm not a linux wizard but I wonder if it is something to do with my graphics settings, however, no other programs / windows show this behaviour. If you could assist it getting it working I would be extremely grateful. I just went to take a screenshot of it to see if I could upload to assist. Oddly the screenshot doesn't show the artefacts etc, just the chequered effect you get to show transparency in some apps.... :)

Give GUI tool more descriptive name?

At the moment the GUI tool is named 'onvif', which is identical to the specification name, and close to impossible to find when searching for the name on the Internet. What about changing the GUI name to something more descriptive?

Looking at https://alternativeto.net/software/onvif-device-manager/, I notice alternatives being named ONVIF Device Manager, ONVIF Device Tool and ONVIFviewer, so those names are not good alternatives.

What about onvif-camcontrol or something like that? I notice ONVIF have been extended to non-camera devices, so it might not be the most future proof name, but at least it matches its current behaviour. I also note that https://www.security.honeywell.com/product-repository/camcontrol-pro have something called CamControl Pro which can control ONVIF cameras. Perhaps 'onvif-camadmin' or 'onvif-camsetup' are better? My search for those names did not find any matches.

Feature request: show RTSP streams addresses

Hey,
I need an ONVIF manager that can help me extract the addresses of RTSP streams.
Your app is the best onvif client I've seen so far, but I can't find RTSP streams anywhere.

If you can add it that'd be great. Thanks!

Need a snapshot functionality

Hello,

Is there any chance to support a snapshot functionality?
I think it's helpful for this kind of project.

Thank you.

Ubuntu 22.04 LTS can't make source

Hi,

I can't build the source code on Ubuntu 22.04. Here's the log output:

$ git clone --recursive https://github.com/sr99622/libonvif.git
Cloning into 'libonvif'...
remote: Enumerating objects: 3116, done.
remote: Counting objects: 100% (202/202), done.
remote: Compressing objects: 100% (125/125), done.
remote: Total 3116 (delta 137), reused 137 (delta 77), pack-reused 2914
Receiving objects: 100% (3116/3116), 4.86 MiB | 2.99 MiB/s, done.
Resolving deltas: 100% (2060/2060), done.
Submodule 'libavio' (https://github.com/sr99622/libavio) registered for path 'libavio'
Submodule 'libonvif/pybind11' (https://github.com/pybind/pybind11) registered for path 'libonvif/pybind11'
Cloning into '/home/user2/Downloads/libonvif/libavio'...
remote: Enumerating objects: 1133, done.        
remote: Counting objects: 100% (640/640), done.        
remote: Compressing objects: 100% (404/404), done.        
remote: Total 1133 (delta 445), reused 404 (delta 221), pack-reused 493        
Receiving objects: 100% (1133/1133), 284.23 KiB | 1.16 MiB/s, done.
Resolving deltas: 100% (773/773), done.
Cloning into '/home/user2/Downloads/libonvif/libonvif/pybind11'...
remote: Enumerating objects: 26161, done.        
remote: Counting objects: 100% (81/81), done.        
remote: Compressing objects: 100% (51/51), done.        
remote: Total 26161 (delta 36), reused 49 (delta 22), pack-reused 26080        
Receiving objects: 100% (26161/26161), 10.01 MiB | 2.45 MiB/s, done.
Resolving deltas: 100% (18356/18356), done.
Submodule path 'libavio': checked out 'a0e97b3a65cad675b81e5bff18154f730f440300'
Submodule 'pybind11' (https://github.com/pybind/pybind11) registered for path 'libavio/pybind11'
Cloning into '/home/user2/Downloads/libonvif/libavio/pybind11'...
remote: Enumerating objects: 26161, done.        
remote: Counting objects: 100% (81/81), done.        
remote: Compressing objects: 100% (51/51), done.        
remote: Total 26161 (delta 36), reused 49 (delta 22), pack-reused 26080        
Receiving objects: 100% (26161/26161), 10.14 MiB | 1.21 MiB/s, done.
Resolving deltas: 100% (18356/18356), done.
Submodule path 'libavio/pybind11': checked out 'e53d58af6c0ade85fa6edce6a228ad2aeace55ee'
Submodule path 'libonvif/pybind11': checked out '3cc7e4258c15a6a19ba5e0b62a220b1a6196d4eb'
user2@user2-HP:~/Downloads$ cd libonvif/
user2@user2-HP:~/Downloads/libonvif$ mkdir build
user2@user2-HP:~/Downloads/libonvif$ cd build/
user2@user2-HP:~/Downloads/libonvif/build$ cmake ..
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.13") 
-- Could NOT find Python3 (missing: Intrepreter) (found version "3.10.6")
-- pybind11 v2.11.0 dev1
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.10.6", minimum required is "3.6") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.10.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Checking for modules 'libavcodec;libavfilter;libavformat;libavutil;libswscale;libswresample'
--   Found libavcodec, version 58.134.100
--   Found libavfilter, version 7.110.100
--   Found libavformat, version 58.76.100
--   Found libavutil, version 56.70.100
--   Found libswscale, version 5.9.100
--   Found libswresample, version 3.9.100
-- Found FFmpeg: /usr/include/x86_64-linux-gnu  
-- Found Python3: /usr/bin/python3.10 (found version "3.10.6") found components: Interpreter Development NumPy Development.Module Development.Embed 
-- pybind11 v2.11.0 dev1
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user2/Downloads/libonvif/build
user2@user2-HP:~/Downloads/libonvif/build$ make
[  2%] Building C object libonvif/CMakeFiles/libonvif.dir/src/onvif.c.o
[  5%] Building C object libonvif/CMakeFiles/libonvif.dir/src/cencode.c.o
[  7%] Building C object libonvif/CMakeFiles/libonvif.dir/src/sha1.c.o
[ 10%] Building CXX object libonvif/CMakeFiles/libonvif.dir/src/onvifboss.cpp.o
[ 12%] Linking CXX shared library libonvif.so
[ 12%] Built target libonvif
[ 15%] Building CXX object libonvif/CMakeFiles/onvif.dir/src/onvif.cpp.o
[ 17%] Building C object libonvif/CMakeFiles/onvif.dir/src/onvif.c.o
[ 20%] Building C object libonvif/CMakeFiles/onvif.dir/src/cencode.c.o
[ 22%] Building C object libonvif/CMakeFiles/onvif.dir/src/sha1.c.o
[ 25%] Building CXX object libonvif/CMakeFiles/onvif.dir/src/onvifboss.cpp.o
[ 27%] Linking CXX shared module onvif.cpython-310-x86_64-linux-gnu.so
[ 27%] Built target onvif
[ 30%] Building CXX object onvif-util/CMakeFiles/onvif-util.dir/src/onvif-util.cpp.o
[ 32%] Linking CXX executable onvif-util
[ 32%] Built target onvif-util
[ 35%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Clock.cpp.o
[ 37%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Decoder.cpp.o
[ 40%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Display.cpp.o
[ 42%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Encoder.cpp.o
[ 45%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Exception.cpp.o
[ 47%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Filter.cpp.o
[ 50%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Frame.cpp.o
[ 52%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Packet.cpp.o
[ 55%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Pipe.cpp.o
[ 57%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Player.cpp.o
[ 60%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Reader.cpp.o
[ 62%] Building CXX object libavio/CMakeFiles/libavio.dir/src/Writer.cpp.o
[ 65%] Linking CXX shared library libavio.so
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libswresample.a(audio_convert.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libavio/CMakeFiles/libavio.dir/build.make:280: libavio/libavio.so.1] Error 1
make[1]: *** [CMakeFiles/Makefile2:250: libavio/CMakeFiles/libavio.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Any Plan to add support for GetEvents?

Hi I am just wondering if you all had any plans to support Onvif GetEvents for this project? I am currently working with a device that is a door control station using an IP camera and I need to be able to get the events from the device.

Any help with this would be greatly appreciated. Thanks.

onvif-util fails to set framerate for Tenda CT6 V2.0

Recently got hold of a Tenda CT6 camera, FW version 2.0. Attempting to set the framerate to any value within the allowed range fails with the error shown in the attachment. Any suggestions on how to debug this further?

The problem may well be the camera itself, rather than onvif-util or libonvif, as the camera is not officially ONVIF compliant. (It's not mentioned in the onvif.org 'official' compliance list). Nevertheless, it does seem to support ONVIF to some extent, but perhaps setting frame rate is simply not implemented, or is broken in some fashion. Just guessing.

I'm also new to fiddling about with IP cameras so could easily be making some silly mistake myself.

Anyway... any suggestions as to how to proceed with further debug would be helpful.

framerate_fail_examp.txt

Merge all command line tools into one onvif-cli tool?

Looking at the current set of command line tools, onvif-discover, onvif-getall, onvif-time and onvif-util, and the fact that you now got support for command line options sorted out, it occured to me that it might be better from a user point of view to merge the set into one, for example named onvif-cli or similar, and write one man page for this unified tool. It would make it more obvious for users that they should use the onvif tool to get a GUI, and the onvif-cli tool for command line tasks. Over time it can be extended to more tasks that should be available from the command line, like the request in issue #5.

Building on Mint Ulyana / Ubuntu focal

Hi!

I would like to test libonvif on my LinuxMint Ulyana. First at all Cmake 3.17 is required but only 3.16 is available.

I changed that setting in every CMakeLists.txt and then Cmake generated the makefiles without any warning.

Compilation and make install also run fine, but when I launch onvif-gui this error shows up:

Traceback (most recent call last):
  File "/home/alfem/.local/bin/onvif-gui", line 5, in <module>
    from gui.main import run
  File "/home/alfem/.local/lib/python3.8/site-packages/gui/__init__.py", line 1, in <module>
    from .main import MainWindow
  File "/home/alfem/.local/lib/python3.8/site-packages/gui/main.py", line 30, in <module>
    from gui.panels import CameraPanel, FilePanel, SettingsPanel, ModulePanel
  File "/home/alfem/.local/lib/python3.8/site-packages/gui/panels/__init__.py", line 1, in <module>
    from .camerapanel import CameraPanel
  File "/home/alfem/.local/lib/python3.8/site-packages/gui/panels/camerapanel.py", line 31, in <module>
    import libonvif as onvif
ImportError: dynamic module does not define module export function (PyInit_libonvif)

And onvif-util also throws an error:

onvif-util: error while loading shared libraries: libonvif.so.1: cannot open shared object file: No such file or directory

It is a big weird, as make install confirms the library is in place:

sudo make install
[ 71%] Built target libonvif
[100%] Built target onvif-util
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/lib/libonvif.so.1
-- Up-to-date: /usr/local/lib/libonvif.so
-- Up-to-date: /usr/local/bin/onvif-util
-- Up-to-date: /usr/local/include/x86_64-linux-gnu/onvif.h
-- Up-to-date: /usr/local/include/x86_64-linux-gnu/onvifboss.h
-- Up-to-date: /usr/local/share/man/man1/onvif-util.1

Any clues?

Please add copyright license header to all source files

I notice some files have information about GPL v2+ in their headers, while others do not. Please add it to all file headers. It would make it easier for those packaging the library for Linux distributions to automatically track copyright status of the project.

c linkage error occures when it is included in qt/c++ project

Hi. I used your project but I ran into a problem. I followed the installation steps exactly as it was described in the "README.md" file.
The "test_onvif" file runs without any problems. But when I include <libonvif/onvif.h> in Qt, It hits "template with C linkage" error.
I use Linux system, my Qt version is 5.15.3, with QMake 3.1 and my gcc version is 11.2.0.
How can I solve this problem?

Discovery not always working

Hi,
I am using this app on Ubuntu 22.04. Since the Wayland issue was fixed, I've been using this app daily to view / PTZ my cameras. I've found that discovery mainly just works and finds all my cameras, but occasionally, it will find none or a subset of the nine I currently have. Even ones on my wired network don't always get discovered 100% of the time. I've always immediately checked I can ping and access by web interface gui, so I know the cameras are there and reachable (I use fixed IP for all cameras). I've noticed that when there are a number of cameras missing, often pressing "discover" will find them, but often enough to be an issue, repeated attempts to "discover" will fail. I've tried leaving the app open and just waiting.... then after a random period of time the cameras get found again.

Any ideas? is this a characteristic of the onvif discovery process? or perhaps something wrong with my Network?

I've seen requests to be able to manually enter camera details from others and responses indicating that this is not the intended use case etc. Accepting this, I wondered if the option to save and import the discovered cameras might be considered as a way around the discovery issues I am getting. I don't necessarily expect the app to be modified to help with my particular situation and would be prepared to attempt to modify the code of my install to "help myself", but I am new to Python so any pointers would be appreciated.

There don't seem to be many Linux apps capable of viewing and moving onvif cameras, which a relatively unskilled Linux enthusiast like me can just pick up and use. I really appreciate the effort that went into creating and sharing this app!

:)

Unable to connect - support different ports? Empty password?

Hi!

I was happy to find this tool, but unfortunately I haven't been able to connect to my camera. (I assume there will be some kind of confirmation when it's connected?)

I'm using Debian without GUI.

My camera is on another network, but I can ping the camera and I can access the web interface and the onvif interface with curl.

One problem might be that my camera uses port 8899 for the onvif interface.

My camera's onvif interface is:
192.168.1.10:8899/onvif/device_service

It would be good if it was possible to set the port as an argument.
Maybe "-P port" or "ip-address[:port]" ([ ] as in optional).

From what I have read, not all cameras use "/onvif/device_service", so it would be good if that also could be set.
Maybe: "onvif-util -u user -p password ip-address[:port][path]" (path always begins with "/")

However, I tried to redirect all tcp traffic to my camera to port 8899 using iptables (I confirmed with curl that it worked), but I could still not connect to the camera with onvif-util, so maybe the port wasn't the only problem.

What if the password is empty? (0 characters string, "".)
Is it enough to omit -p?
Does it work to use e.g. "-p """ or "-p -"?
If not, maybe there should be an argument for empty password.

Best regards!

Plans to support wifi connection setup

Great tool, helped me a lot to avoid having to use the (untrusted) manufacturer app.
Do you have plans to support wifi configuration via onvif? With this, one could avoid having to use the manufacturers app completely.

CMake generate step failed to find sdl2 library though it was installed

me@myUbuntu2204:~/workspace/libonvif/build$ cmake -DBUILD_GUI=ON ..
-- Configuring done
CMake Error at libavio/CMakeLists.txt:65 (target_link_libraries):
Target "avio" links to:

SDL2::SDL2

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.

Error when trying to start on onvif-gui on Fedora 39

Hi,

I followed the "build from source" instructions on my Fedora 39 installation which worked without any issues - everything got built and installed.

However, when I try to run onvif-gui I get the following trace:

$ onvif-gui
Traceback (most recent call last):
  File "/home/xxx/onvifenv/bin/onvif-gui", line 5, in <module>
    from gui.main import run
  File "/home/xxx/onvifenv/lib64/python3.12/site-packages/gui/__init__.py", line 1, in <module>
    from .main import MainWindow
  File "/home/xxx/onvifenv/lib64/python3.12/site-packages/gui/main.py", line 37, in <module>
    from gui.panels import CameraPanel, FilePanel, SettingsPanel, VideoPanel, AudioPanel
  File "/home/xxx/onvifenv/lib64/python3.12/site-packages/gui/panels/__init__.py", line 1, in <module>
    from .camerapanel import CameraPanel
  File "/home/xxx/onvifenv/lib64/python3.12/site-packages/gui/panels/camerapanel.py", line 27, in <module>
    import libonvif as onvif
  File "/home/xxx/onvifenv/lib64/python3.12/site-packages/libonvif/__init__.py", line 19, in <module>
    sys.modules[name] = importlib.util.module_from_spec(spec)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: Python version mismatch: module was compiled for Python 3.6, but the interpreter version is incompatible: 3.12.1 (main, Dec 18 2023, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)].

I am not quite sure how Python 3.6 comes into play, because I built libonfiv from source inside a virtual env and I am also starting it from there, just as described in the readme...

Any idea what is going on?

onvif-gui crash when moving between tabs

When playing with libonvif, I got the following crash when selecting cameras and switching between tabs:

Discovery started
libonvif found 3 cameras

Connecting to camera IPD-L21Y02-BS IPcamera at http://192.168.1.4:8999/onvif/device_service
Duplicate discovery packet for camera IPD-L21Y02-BS IPcamera

Connecting to camera HeroSpeed IPCamera at http://192.168.1.5/onvif/device_service
Duplicate discovery packet for camera HeroSpeed IPCamera

Connecting to camera HeroSpeed IPCamera at http://192.168.1.3/onvif/device_service
Duplicate discovery packet for camera HeroSpeed IPCamera

discovery is completed
attempting to connnect to CameraTop
Reader opening rtsp://username:[email protected]:80/0
[rtsp @ 0x7f3f28000c80] UDP timeout, retrying with TCP
[rtsp @ 0x7f3f28000c80] method PAUSE failed: 455 Method Not Valid In This State
[rtsp @ 0x7f3f28000c80] Could not find codec parameters for stream 0 (Video: hevc, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Reader successfully opened
Assertion desc failed at src/libswscale/swscale_internal.h:674
Aborted

Not quite sure what I did to trigger the crash.

onvif-gui: error while loading shared libraries: libonvif.so.1: cannot open shared object file: No such file or directory

Following the instructions exactly as described in readme. Everything went smoothly till I tried to run the gui and it says a library is missing.

Debian:/git/libonvif/build$ sudo make install
[ 8%] Built target onvif
[ 10%] Automatic MOC for target onvif-gui
[ 10%] Built target onvif-gui_autogen
[ 86%] Built target onvif-gui
[ 91%] Built target onvif-util
[100%] Built target onvif_static
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/onvif-gui
-- Set runtime path of "/usr/local/bin/onvif-gui" to ""
-- Installing: /usr/local/bin/onvif-util
-- Set runtime path of "/usr/local/bin/onvif-util" to ""
-- Installing: /usr/local/lib/libonvif.so.1
-- Set runtime path of "/usr/local/lib/libonvif.so.1" to ""
-- Installing: /usr/local/lib/libonvif.so
-- Installing: /usr/local/lib/libonvif_static.a
-- Installing: /usr/local/include/x86_64-linux-gnu/onvif.h
-- Installing: /usr/local/share/man/man1/onvif-util.1
-- Installing: /usr/local/share/man/man1/onvif-gui.1
debian:
/git/libonvif/build$ onvif-gui
onvif-gui: error while loading shared libraries: libonvif.so.1: cannot open shared object file: No such file or directory
debian:~/git/libonvif/build$

ovif-gui not able to play the video

When I run onvif-gui (build from source or downloaded from pip) it works well until i press the play button on any camera.
Also happens on double-click on camera.
It crashes on:

Traceback (most recent call last):
  File "/home/robot/git/myenv/lib/python3.8/site-packages/gui/panels/camerapanel.py", line 314, in btnStopClicked
    self.mw.playMedia(self.getStreamURI(onvif_data))
  File "/home/robot/git/myenv/lib/python3.8/site-packages/gui/main.py", line 260, in playMedia
    self.player = avio.Player()
AttributeError: module 'avio' has no attribute 'Player'
Aborted (core dumped)

When i import avio in standalone python it also does not find attribute Player.

Running Ubuntu 20 LTS, on intel NUC.
The onvif runs on a different pc and Im using X forwarding over ssh.

Could be useful to add uninstall steps?

Hi :)
I guess this will sound like asking for too much, so I'm sorry in advance.
Could we add some uninstall steps (at least for Linux), since not all of us are that proficient with python wheels and automated builds in that fashion. Is it enough to only remove the entire directory where those packages were being downloaded or is there a more elegant way?
Sorry again and thank you for this great piece of software, really appreciated.

`onvif-util -u admin -p '' 192.168.1.10` command `get network` crashes with SIGSEGV

Hi,

I'm using v1.4.4 as tagged (whilst packaging it myself for NixOS) and onvif-util is crashing with a SIGSEGV when I run onvif-util -u admin -p '' 192.168.1.10 and type the command get network.

The backtrace of the crash is:

(gdb) bt
#0  0x00007ffff7faf3af in addHttpHeader (doc=doc@entry=0x423e90, root=root@entry=0x424890, xaddrs=xaddrs@entry=0x422240 "", post_type=post_type@entry=0x4211bc "", cmd=cmd@entry=0x7ffffffede80 "", 
    cmd_length=cmd_length@entry=4096) at /build/source/libonvif/src/onvif.c:2128
#1  0x00007ffff7fb788a in getProfileToken (onvif_data=0x41feb0, profileIndex=0) at /build/source/libonvif/src/onvif.c:1368
#2  0x0000000000403c82 in profileCheck (onvif_data=onvif_data@entry=0x41feb0, args=...) at /build/source/onvif-util/src/onvif-util.cpp:169
#3  0x0000000000405449 in main (argc=<optimized out>, argv=<optimized out>) at /build/source/onvif-util/src/onvif-util.cpp:400

Locals:

(gdb) info locals
outputbuffer = <optimized out>
size = 929
xml = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:trt=\"http://www.onvif.org/ver10/media/wsdl\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecu"...
c_xml_size = "929\000\000"
xml_size_length = 4
tmp = '\000' <repeats 127 times>
mark = <optimized out>
start = -4334142
tmp_len = 0
j = 0
end = <optimized out>
tmp2 = '\000' <repeats 127 times>
host = '\000' <repeats 127 times>
port_buf = '\000' <repeats 127 times>
port = <optimized out>
content = '\000' <repeats 130 times>
content_length = '\000' <repeats 18 times>
http_terminate = "\000\000\000\000"
p = <optimized out>
h = <optimized out>
c = 131
cl = 19
cmd_size = <optimized out>
i = <optimized out>
s = <optimized out>

The XML it was processing:

(gdb) print -elements 3000 -- xml
$2 = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:trt=\"http://www.onvif.org/ver10/media/wsdl\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><SOAP-ENV:Header><wsse:Security SOAP-ENV:mustUnderstand=\"1\"><wsse:UsernameToken><wsse:Username></wsse:Username><wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">XCLO5rjs6+ngg/F/x19eaqtOA2w=</wsse:Password><wsse:Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">zVpzwc5udVRzhLq0SlxzKHLiJUw=</wsse:Nonce><wsu:Created>2023-10-30T22:10:51.620Z</wsu:Created></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body><trt:GetProfiles/></SOAP-ENV:Body></SOAP-ENV:Envelope>", '\000'

Please let me know if there's any more useful info I can get for you.

I have a packet capture from a different (but same command / same crash) run, using Wireshark: onvif-util_packets.zip

(The camera is a cheap generic camera so it wouldn't surprise me if this isn't your code's fault...)

onvif-util -a crashes with SEGV when receiving wrong information

Hello all,
I am trying to run onvif-util -a and get a SIGSEGV.
After some debugging I noticed that a QNAP NAS in my network answers to the discovery broadcast with the following XML:

<?xml version="1.0" ?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsd="http://schemas.xmlsoap.org/ws/2005/04/discovery">
	<soap:Header>
		<wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches</wsa:Action>
		<wsa:MessageID>urn:uuid:b992e1c0-8049-41fe-89ec-6b0196345caf</wsa:MessageID>
		<wsa:RelatesTo>urn:uuid:a7430adf-d054-063b-9f2b-3fed22330285</wsa:RelatesTo>
		<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
		<wsd:AppSequence InstanceId="1030752232" MessageNumber="1"/>
	</soap:Header>
	<soap:Body>
		<wsd:ProbeMatches/>
	</soap:Body>
</soap:Envelope>

This causes onvif_data->xaddrs to be zero and then causes the crash in extractHost(onvif_data->xaddrs, host);

Install onvif-time and onvif-util only on Linux?

In de2471e the tools onvif-time and onvif-util were removed after being added due to issue #3 and pull request #6 because they are claimed to be not compatible with Windows. What about keeping them but only building and installing them on Linux, until they can be ported to Windows? Why are they not compatible with Windows?

Failed to set default gateway

I tried unsuccessfully to set the default gateway on several cameras. The setting would not stick. No error appeared anywhere, but the setting where back to its old value when I restarted the Qt client to check the current settings.

I notice VladislavNikolin@e1e07b4 contain a commit with comment "fix SetNetworkInterfaces method". Could there be a bug in the network setting code?

[issue] getVideoEncoderConfiguration provide no data

Hi,
when I call the function getVideoEncoderConfiguration it provides no data. The last error messgage just contains "getVideoEncoderConfiguration". getStreamUri and other functions work fine.

Tested on Ubuntu 22.04 with libonvif 2.0.1

Memory leaks

In onvif.c, line 1822 you return without freeing xmlXPathObjectPtr result, i.e xmlXPathFreeObject(result); is missing before the return, causing a memory leak.

AttributeError: module 'libonvif' has no attribute 'Data'

Hello guys, after following installation guide Ubuntu 22, I got this can you help!

Traceback (most recent call last):
File "/home/Desktop/Code/source/libonvif/onvif-gui/run.py", line 27, in
from gui import MainWindow
File "/home/Desktop/Code/source/libonvif/onvif-gui/gui/init.py", line 1, in
from .main import MainWindow
File "/home/Desktop/Code/source/libonvif/onvif-gui/gui/main.py", line 37, in
from gui.panels import CameraPanel, FilePanel, SettingsPanel, VideoPanel, AudioPanel
File "/home/Desktop/Code/source/libonvif/onvif-gui/gui/panels/init.py", line 1, in
from .camerapanel import CameraPanel
File "/home/Desktop/Code/source/libonvif/onvif-gui/gui/panels/camerapanel.py", line 31, in
class CameraPanelSignals(QObject):
File "/home/Desktop/Code/source/libonvif/onvif-gui/gui/panels/camerapanel.py", line 32, in CameraPanelSignals
fill = pyqtSignal(onvif.Data)
AttributeError: module 'libonvif' has no attribute 'Data'

onvif-gui not launching on Windows 11 with Python 3.10.7

Environment

  • OS: Windows 11
  • Python Version: 3.10.7

Issue Description

I've installed onvif-gui following all the recommended installation steps, but when I attempt to launch the GUI, nothing happens. No error messages are displayed, and there is no feedback in the command prompt to indicate what might be going wrong.

Steps to Reproduce

  1. Ensure Python 3.10.7 is installed and set as the default Python version.
  2. Followed the installation guide for onvif-gui.
  3. Ran the necessary commands to start the GUI as per the documentation.

Expected Behavior

I expected the onvif-gui application window to open, allowing me to interact with the software.

Actual Behavior

After running the command to start onvif-gui, nothing happens. There's no error output in the console, and no GUI window appears.

Attempts to Resolve

  • Checked Python version to confirm it's 3.10.7.
  • Reinstalled onvif-gui to ensure all dependencies are correctly installed.
  • Searched for similar issues in the GitHub issues section, but no similar issues was found.

Additional Context

  • There were no installation errors or warnings that appeared during setup.
  • I have other Python GUI applications that are running without issue on this system.

Strange setting of camera name

When using the Qt sample client to set the camera name of several ONVIF cameras, the final name end up being the union of the original and new new name. One of the cameras initially had the name 'HeroSpeed IPCamera', and I set the new name to
'KameraUte', but after applying the change and closing the client and starting it again, I am told the name is something like 'KameraUte IPCamera'. Look like some string termination is not working as it should.

Package libonvif in Debian?

Are you interested in getting the libonvif package into Debian? I would be willing and able to help if you are interested in maintaining it in Debian. I've already told Debian about this package in https://bugs.debian.org/1021980 and asked if anyone want to maintain it. It can be a starting point.

Script time setting on camera?

Hello,

Is there a way to script the time setting from bash/shell ?

It works great logging in to the CAM and use : time_sync
However I am looking to script the time so that when switching on the cam remotely the time can be set correct before further usage ?

Cheers P.

Recording from the CLI possible?

Hello
I just found this util today and I'd like to use it to save the cameras' stream to a local storage.

Is that possible somehow?

I successfully connect from the GUI and can see the content, expect that the GUI is failing to save to disk, though I don't really mind as long as I can use the CLI to record

BTW, this is the GUI recording error, nothing important is printed to the terminal:
Writer open failure: Pipe::open exception: avformat_write_header has failed with error: Invalid argument

onvif.c

tmp2[j] = tmp[j];

1、 If the local area network contains non onvif devices, Tips Error getting camera uri ter:NotAuthorized error.
2、 How to filter non onvif devices?

image

[Feature Request]Alert Notifications via Email/Telegram on Object Detection

Feature Description

It would be highly beneficial to include a feature where, upon the detection of predefined object classes (e.g., person), the user receives an alert notification. This notification should include the image/frame where the object was detected. Ideally, users should have the option to receive these alerts through email or Telegram.

Use Case

This feature would be particularly useful for surveillance and monitoring purposes, allowing users to be promptly informed about important detections without needing to continuously watch the video feed.

Proposed Implementation

  • Detection Trigger: When an object of a predefined class is detected, trigger the alert.
  • Notification Content: Include the timestamp and the image/frame of the detection.
  • Notification Channels: Allow users to configure their preferred notification channel(s) - Email and/or Telegram.
  • User Configuration: Provide a simple GUI interface for users to select the object classes they want alerts for and to input their email/Telegram details for notifications.

Potential Benefits

  • Enhanced Monitoring: Enables more effective and efficient monitoring by alerting users to significant detections.
  • Versatility: Useful across a wide range of applications, from home security to wildlife monitoring.

This feature could significantly enhance the utility by integrating real-time alerting capabilities, making it a more powerful tool for surveillance and security.

A few fixes and extensions

Hi,
I was having a play with some onvif video cameras using your code. Thank you.

I have attached a diff file containing some code extensions and bug fixes that you might be interested in. I have also included some rebased diffs from two forks of your code on github because they seemed interesting. One does a basic dump of returned data from the camera and the other allows access to multiple profiles.

My code adds some extra fields that I was interested in as well as a couple of extra calls (including get/set NTP).

I've also done some reworking of your time logic to better reflect UTC time vs. localtime and produced a utility to do time sync to cameras.

Do what you will with these updates. I no longer have ready access to the cameras to continue tinkering. I'd be happy to discuss my changes but can no longer test very much.

Cheers,

libonvif-master+brian+fiz1962+kyeongy.diff.txt

[issue]Camera stream turning grey after sometime

The camera stream becomes almost grey after sometime. This is happening with all the IP cameras. I have attached an screenshot for your refernece.

Environment:

OS: Windows 11
Python Version: 3.10.7

Screenshot (43)

Is it possible to include .ui files?

Hello,

This work is very interesting. I have been using it for my Onvif cameras.
But is there anyway to include the UI files (.ui)? I took a look at the repo, there were only .py files.
Since I need to make some changes in UI for testing, it will be helpful to have your .ui files included.

Thank you so much.

CMake Error at libonvif/CMakeLists.txt:63

Ubuntu Studio OS 22.04

mangrove@mangrove-hpelitedesk800g3dm35w:~/libonvif/build$ cmake -DBUILD_GUI=ON ..
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.13")
CMake Error at libonvif/CMakeLists.txt:63 (add_subdirectory):
The source directory

/home/mangrove/libonvif/libonvif/pybind11

does not contain a CMakeLists.txt file.

CMake Error at libonvif/CMakeLists.txt:65 (pybind11_add_module):
Unknown CMake command "pybind11_add_module".

-- Configuring incomplete, errors occurred!
See also "/home/mangrove/libonvif/build/CMakeFiles/CMakeOutput.log".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.