Skip to content

mlankhorst/pihome

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Make sure gst-interpipe is installed from

https://github.com/RidgeRun/gst-interpipe

Install the required packages:

sudo apt-get install python3 python3-gi python3-gst-1.0 python3-psutil \
	gstreamer1.0-plugins-{good,bad,ugly} gstreamer1.0-alsa \
	gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gst-rtsp-server-1.0

For rpicamsrc (camera 1 and 2 modules), you may need to recompile gstreamer1.0-plugins-good.

The mappings between cameras and services are hardcoded for now, based on hostname.

The RTSP starts on port 8080, and provides cameras based on names.

By default, you can connect to the following:
rtsp://hostname:8080/ENDPOINT

Where ENDPOINT is either snd.hw:X,0 (based on the alsa devices), snd (if capture is available, first audio capture device), or camX. The name for the camera may change, and is set inside server.py based on hostname.

This is the configuration that you'll have to do to make it work. I'm planning on making the camera's more dynamically configurable, similar to how gst-launch allows you to specify a pipeline.

By default, audio  will be added if available, but an alias .m4v is added if you only want the video stream.

To connect to the server using gst-launch-1.0:

gst-launch-1.0 playbin uri=rtsp://hostname:8080/ENDPOINT latency=100 video-sink='autovideosink sync=0' audio-sink='autoaudiosink sync=0'

Some options are available to save to disk, and stream to an online platform.
For a camera endpoint named cam0, the syntax is:
echo ':cam0 startstream rtmps://URL/password' | nc $hostname 6780
For example the rtmps link for youtube is rtmp://a.rtmp.youtube.com/live2/XXX-XXXX-XXX-XXXX-XXXX where the last bit is the password for the stream provided by youtube.

You can also save the stream to disk with:
echo ':cam0 save' | nc $hostname 6780

And stop saving using:
echo ':cam0 done' | nc $hostname 6780

The files are created in the format endpoint-video-DATE-TIME.mp4 in the matroska format, and saved into the home directory.

Finally, properties can be set on the source element at runtime using:
echo :cam0 setprop X=Y | nc $hostname 6780

About

Using python3 and gstreamer to create a small home automation project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published