device.camera_run module

device.camera_run.check_dependencies()[source]

Return True if all dependencies are installed (vlc, ffmpeg).

device.camera_run.get_my_ips(loopback=False)[source]

Return a list of IPv4 adresses assigned to each network interface. The local address 127.0.0.1 of the loopback interface is omitted by default.

device.camera_run.start_encoder_rtmp(rtmp_url, mpjpeg_host='localhost:5200')[source]

Start a ffmpeg process that encodes the MPJPEG stream and sends it to to the specified RTMP server (e.g. rtmp://server.com/something).

Use process.terminate(); process.poll() to stop the returned process.

Encoding the video (h264) and streaming to a RTMP server is a simple way how to bring the content to a large audience for example via youtube livestreams. This comes at the expense of increased latency (10-40s) and significant CPU demands (Raspberry PI may be bordeline for 720p@30fps).

device.camera_run.start_stream(device, quality='medium', port=5200)[source]
Start a vlc process that serves the MPJPEG stream at

http://<ip-address>:5200/stream.mpjpeg

Use process.terminate(); process.poll() to stop the returned process.

MPJPEG is a raw format captured by the webcam, the resulting stream has relatively low latency (500-1000ms), but it eats a lot of bandwidth. Only a handful of people can watch at the same time before the Raspberry PI is unable to keep up (the video slows down).