Camera

Useful video

The URL of the RTSP live stream for the Tapo cameras will be:

For high quality stream1: rtsp://IP Address/stream1

For low quality stream2: rtsp:// IP Address/stream2


To open rtsp stream in VLC click Media then Open Network Stream

Enter rtsp://Onvif Username:Onvif password@ip address:554/stream2


How to view Tapo camera on PC through RTSP stream?

Node Red

Download the onvif nodes from the github link above. The link also provides a full instructions for using the nodes.

The discovery node provides in the 'XAddrs' field the ip address and the port number of the onvif device which is used to configure the Onvif device in Node Red.

PiCam

Installation and Testing:

How to use Bulseye Libcamera

Using Legacy Raspicam

Ref: http://helloraspberrypi.blogspot.com/2019/02/raspberry-pi-stream-video-to-vlc-player.html


Stream using rtsp

In Raspberry pi with camera side

Enter the command:

raspivid -o - -t 0 -n -w 600 -h 400 -fps 12 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264


where

-w :Width available range: 64 to 1920
-h :Height available range 64 to 1920
-t : Time in milliseconds, 0 is infinite
-fps :Frames per second range 2 to 30
-o :ouput to file or as here pipe
8554 : the port to stream video
-hf :Horizontal flip
-vf :Vertical flip

cvlc is the console vlc player

"-vvv" and its argument specifies where to get the stream from

"-sout" and its argument specifies where to output it to


Viewing The RTSP Stream Over The Network

You need a player which supports RTSP, for instance VLC, Quicktime, etc. Open a network stream using rtsp://###.###.###.###:8554/
where ###.###.###.### is the IP address of the RPi.

Another example for VLC streaming

$ raspivid -o - -t 0 -hf -b 1000000 -w 640 -h 480 -fps 24 |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8160}' :demux=h264

and to pick up the stream, open the VLC app and pick up the stream with a URL like this: http://192.168.178.91:8160. Here insert the name or IP address of the RPi. (source ~10 sec delay).

Stream using rtmp
Prerequisites

  • raspivid

  • ffmpeg

raspivid -t 0 -w 1280 -h 720 -fps 25 -g 75 -fl -o - | ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -i pipe:0 -c:v copy -c:a aac -strict experimental -f flv -f flv rtmp://ip:port/app/stream

  • -t 0: Continuously pull video from the camera

  • -w 1280 -h 720 -fps 25: Video stream of 720p25

  • -g 75: I-frame interval at 1/s

  • -o -: Pipe video to stdout

  • -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 and -c:a aac -strict experimental: Since the RaspberryPi doesn't have a microphone, we can pipe some silence instead. This is very optional and depends on your use case.

  • -i pipe:0 -c:v copy: Read the video stream from stdin . The video stream from raspivid is already encoded in h264, so we skip re-encoding by using copy.

  • -f flv rtmp://ip:port/app/stream: The destination.

References


Picamera2 (Bullseye)

Instructions at https://github.com/raspberrypi/picamera2

NB need to install Glamor per instruction as using camera on pi Zero.

OpenCV not yet installed.

TensorFlow Lite not yet installed.

MotionEYE Raspian (Buster)

Instructions at https://github.com/motioneye-project/motioneye/wiki/Install-On-Raspbian

NB All commands require root; use sudo before each command or become root using sudo -i.

Unfortunately didn't work so installed Raspian Bullseye

MotionEYE Raspian (Bullseye)

Instructions at https://github.com/motioneye-project/motioneye/wiki/Install-on-Raspbian-Bullseye

NB All commands require root; use sudo before each command or become root using sudo -i.

Accessing The Frontend

After having successfully followed the installation instructions, the motionEye server should be running on your system and listening on port 8765. Fire up your favorite web browser and visit the following URL (replacing [your_ip] with... well, your system's IP address):

http://[picam_ip]:8765/


Use admin with empty password when prompted for credentials.

However, currently followed EddyD's installation instructions for installation of MotionEye on RaspberryPi Bullseye as summarised below from the video. Only issues discovered so far is that including a network camera stops the Pi camera from working.

sudo -i


apt install ffmpeg libmariadb3 libpq5 libmicrohttpd12 -y


wget https://github.com/Motion-Project/motion/releases/download/release-4.3.2/pi_buster_motion_4.3.2-1_armhf.deb


dpkg -i pi_buster_motion_4.3.2-1_armhf.deb


Now have to deactivate Motion with the following command.


systemctl stop motion


followed by


systemctl disable motion


Next install all dependencies


apt install python2 python-dev-is-python2 -y


curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py


python2 get-pip.py


apt install libssl-dev libcurl4-openssl-dev libjpeg-dev zlib1g-dev -y


pip2 install motioneye


Create a configuration directory


mkdir -p /etc/motioneye


{Copy the configuration data one from oneplace to the other place


cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf


mkdir -p /var/lib/motioneye


cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service


systemctl daemon-reload


systemctl enable motioneye


systemctl start motioneye


reboot

THE ABOVE IS ESSENTIALLY THE SAME AS INTRUCTIONS ON THE MOTIONEYE-PROJECT GITUB

Install on Raspbian Bullseye · motioneye-project/motioneye Wiki · GitHub

Enabling port control of MOTION

To allow port control of MOTION for interfacing with Node Red via http, both /etc/motioneye/motioneye.conf and /etc/motioneye/motion.conf were edited in the Terminal of the rpi using sudo nano.

In /etc/motioneye/motion.conf Change webcontrol_localhost on To webcontrol_localhost off

In /etc/motioneye/motioneye.conf Change motion_control_localhost true To motion_control_localhost false

Motion detection can be paused and restarted with curl in the Terminal or via Node red HTTP Get REQUEST node

http://picam:7999/1/detection/pause

http://picam:7999/1/detection/start


Web Control

The following are the commands available.

  • {IP}:{port}/{camid}/config/list Lists all the configuration values for the camera.

  • {IP}:{port}/{camid}/config/set?{parm}={value1}Set the value for the requested parameter

  • {IP}:{port}/{camid}/config/get?query={parm} Return the value currently set for the parameter.

  • {IP}:{port}/{camid}/config/write Write the current parameters to the file.

  • {IP}:{port}/{camid}/detection/status Return the current status of the camera.

  • {IP}:{port}/{camid}/detection/connection Return the connection status of the camera.

  • {IP}:{port}/{camid}/detection/start Start or resume motion detection.

  • {IP}:{port}/{camid}/detection/pause Pause the motion detection.

  • {IP}:{port}/{camid}/action/eventstart Trigger a new event.

  • {IP}:{port}/{camid}/action/eventend Trigger the end of a event.

  • {IP}:{port}/{camid}/action/snapshot Create a snapshot

  • {IP}:{port}/{camid}/action/restart Shutdown and restart Motion

  • {IP}:{port}/{camid}/action/quit Close all connections to the camera

  • {IP}:{port}/{camid}/action/end Entirely shutdown the Motion application

  • {IP}:{port}/{camid}/track/center Send command to center PTZ camera

  • {IP}:{port}/{camid}/track/set?x={value1}&y={value2} Send command to PTZ camera to move to location specified by x and y

  • {IP}:{port}/{camid}/track/set?pan={value1}&tilt={value2} Send command to PTZ camera to pan to value1 and tilt to value2


As a general rule, when the {camid} references the camera_id in the main motion.conf file, the webcontrol actions referenced above are going to be applied to every camera that is connected to Motion. This camera_id is usually specified as 0 (zero). So issuing a command of {IP}:{port}/0/detection/pause is going to pause all the cameras.

A point of clarification with respect to the differences between pause, quit, and end. When the action of pause is executed, Motion will stop the motion detection processing and of course all events but will continue to process and decode images from the camera. This allows for a faster transition when the user executes a start The quit action conversely not only stops the motion detection but also disconnects from the camera and decoding of images. To start motion detection after a quit, the user must execute a restart which will reinitialize the connection to the camera. And since the camera was completely disconnect, it can take more than a few seconds for Motion to fully start and have the camera available for processing or viewing. Finally, there is an option for end. This option completely terminates the Motion application. It closes all connections to all the cameras and terminates the application. This may be required when running Motion in daemon mode. Note that there is no way to restart the Motion application from the webcontrol interface after processing a end request.