Stream Video From Raspberry Pi to an RTMP Server | by Jonas | Nov, 2021

Allow the Digicam with raspi-config

I needed to do some testing with video streaming from my Raspberry Pi to RTMP output. That is what most streaming platforms, equivalent to Twitch and YouTube present to ship streams there.

I didn’t wish to ship my stream to a public endpoint, so I used Cloudflare Stream.

I assume that Raspberry Pi OS is used (the sunshine model works positive).

First off, execute raspi-config in a Terminal window and navigate to Interface Choices, then hit return, choose Digicam and allow it. Afterwards the gadget would possibly require a reboot.

Subsequent, set up ffmpeg:

sudo apt-get set up ffmpeg

When you want to seek out out the capabilities of your digital camera/video module, equivalent to body price, video modes and backbone and so on., you would possibly wish to use v4l, or Video4Linux to get the details.

raspivid -t 0 -w 1280 -h 720 -fps 30 -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 rtmps://

raspivid is the instrument to work together with the Raspberry Pi Digicam module. -t specifies the timeout after the video seize will cease, with 0 it's going to stream repeatedly. -w and -h takes the decision you wish to stream at, and -fps, effectively, the frames per second. With -o - the file can be despatched to stdout as a substitute of a file, so we will decide it up with ffmpeg within the subsequent step.

-i anullsrc=channel_layout=stereo:sample_rate=44100 within the ffmpeg command will create silent audio output.

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *