Examples of Python Client for ONVIF Camera
pi@gc16:~ $ python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from onvif import ONVIFCamera
| # coding: utf8 | |
| import RPi.GPIO as GPIO | |
| import time | |
| class GPIO_Edge_Timeout(Exception): | |
| pass | |
| CYCLE_START_HIGHT_TIME = 2 | |
| GPIO.setmode(GPIO.BCM) |
| # -*- coding: utf-8 -*- | |
| """ | |
| Compiled, mashed and generally mutilated 2014-2015 by Denis Pleic | |
| Made available under GNU GENERAL PUBLIC LICENSE | |
| # Modified Python I2C library for Raspberry Pi | |
| # as found on http://www.recantha.co.uk/blog/?p=4849 | |
| # Joined existing 'i2c_lib.py' and 'lcddriver.py' into a single library | |
| # added bits and pieces from various sources | |
| # By DenisFromHR (Denis Pleic) |
| https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry | |
| apt-get remove python-pip python3-pip | |
| wget https://bootstrap.pypa.io/get-pip.py | |
| sudo python get-pip.py | |
| sudo python3 get-pip.py |
pi@gc16:~ $ python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from onvif import ONVIFCamera
| # for FOMA L-02A | |
| # USB Storage (Zero Installation) | |
| KERNEL=="sr[0-9]*", ENV{ID_VENDOR_ID}=="1004", ENV{ID_MODEL_ID}=="610c", RUN+="/usr/bin/eject /dev/$kernel" | |
| # USB Modem (ttyUSB) | |
| SUBSYSTEM=="usb", ATTR{idVendor}=="1004", ATTR{idProduct}=="6109", RUN+="/sbin/modprobe usbserial vendor=0x$attr{idVendor} product=0x$attr{idProduct}" |
| # refer to http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=3&t=2565 | |
| SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", ATTR{idProduct}=="1000", RUN+="/usr/sbin/usb_modeswitch -W -v 05c6 -p 1000 -K" |
| ffmpeg -f v4l2 -input_format yuv420p -video_size 320x240 -i /dev/video0 -an -c:v h264_omx -r:v 5 -f mpegts udp://192.168.11.4:1234 |
| raspivid -n -vf -hf -t 0 -w 320 -h 240 -fps 5 -o - | ffmpeg -i - -vcodec copy -an -c:v h264_omx -f mpegts udp://192.168.11.7:1234 |
| # https://github.com/ccrisan/motioneyeos/issues/365 | |
| ffmpeg -f v4l2 -input_format yuv420p -framerate 25 -video_size 640x480 -i /dev/video0 -frames 500 -an -c:v h264_omx test.mp4 |
| ffmpeg -f v4l2 -input_format yuv420p -i /dev/video0 -an -c:v h264_omx -f segment -segment_format mpegts -segment_time 5 -segment_list stream/playlist.m3u8 stream/a%03d.ts |