You are here Home RTMP Video Streaming

RTMP Video Streaming

The infield video is captured using a Sony IMX477 10 Mega pixel solid state sensor fitted with a 16mm telephoto lens. The outfield video is captured using a Sony IMX477 12 mega pixel solid state sensor fitted with a 6mm lens, audio is captured via a Toner cardioid pattern microphone. The sensors are programmed using the open source libcamera-vid application. The output from the sensor is fed into a hardware bcm2835 codec which produces encoded H264 video streams.

The H264 video streams are then further processed using the libav software library to produce Flash (flv) formatted frames which are then streamed over RTMP (real time media protocol) to one of two client web servers. Each video stream has its own dedicated webserver.

The client web server operating system is Debian 11 (Bullseye) and hosts an instance of an nginx web server. The web server has the nginx RTMP module configured and is operational whenever the web server is enabled.

The incoming video stream is processed by the RTMP application and passed to an HLS (HTTP Live Stream) application where the video stream is saved as 1600ms HLS file segments. A play length of 6400ms ensures a good level of latency so as not to fall too far behind the real time event.

Playback of the HLS segments relies on HTML5 and Java script enabled browsers and has been tested with Google Chrome, Firefox, Safari and MS Edge. There is an upper limit of 1000 concurrent users set to ensure acceptable performance.

For the technically minded the implemented configuration is:

The Infield Camera Host Server

RPi 4B v1.5 four cores 4GB RAM
O/S Debian 11 Bullseye
bcm2835 hardware codec producing H264 encoded streams
ffmpeg v4.3.6 application (provides the libav flv encoding library)
Sony IMX477 sensor and 16mm lens
The video stream is output as flv formatted frames at 60 fps over RTMP to the nginx web server using the following command line:
"libcamera-vid --nopreview -t 0 --level 4.2 --framerate 60 --codec libav --libav-format flv --libav-audio on --denoise cdn_off --inline --output rtmp://192.168.1.19:1935/sony/stream"

The Outfield Camera Host Server

RPi 4B v1.5 four cores 4GB RAM
O/S Debian 11 Bullseye
bcm2835 hardware codec producing H264 encoded streams
ffmpeg v4.3.6 application (provides the libav flv encoding library)
Sony IMX477 sensor and 6mm lens
The video and audio stream is output as flv formatted frames at 60 fps over RTMP to the nginx web server using the following command line:
"libcamera-vid --nopreview -t 0 --level 4.2 --framerate 60 --codec libav --libav-format flv --libav-audio on --denoise cdn_off --inline --output rtmp://192.168.1.23:1935/sony2/stream"

We also occasionally deploy an aditional low resolution (1MB pixel / 30 fps) fixed focus wide angle camera showing the outfield. As well as video, this unit also provides an audio feed.

The Web Servers

RPi 4B v1.2 four cores 4GB RAM
O/S Debian 11 Bullseye
Nginx 1.18.0 with the RTMP module enabled
ffmpeg v4.3.6 application, provides the codec for decoding the video streams
video.js Java script
The incoming infield stream is processed using the command:
"exec_push /usr/bin/ffmpeg -i rtmp://localhost:1935/sony/$name -vcodec libx264 -g 10 -s 640x480 -acodec aac -ar 44100 -f flv rtmp://localhost/hls/$name;"
As well as being live streamed, the video is also written to file storage and later converted to mp4 format to enable video and audio playback.

The streams can be viewed by any HTML5 browser that has JavaScript enabled.

The video stream is typically available on weekdays, 09:00 to 16:30 (in season) when South Wilts have a cricket match scheduled. At other times the stream is available on an ad hoc basis, usually to conduct system testing. When live, the stream can be viewed here https://sarum.biz/stream.html or scan the QR code below. The outfield can be viewed here https://sarum.biz/swstream.html.
Remember to unmute the audio in your browser.



A catalogue of recorded streams can be viewed here https://sarum.biz/swcc.html The catalogue will be updated as the season progresses.

Back to the top