Setting Up a Raspberry Pi for LIVE Streaming from Scratch Written by Patrick on March 25, 2020

Tutorial and Post written by Christopher Black and Patrick Delaney.  Livestream by Chris Black.  You can join and chat with Chris and post questions below during the livestream.  An archive of this livestream will appear approximately 10 minutes after completion.

Inspiration for this Post

For many in the Minneapolis-St. Paul and greater midwest tech region, the IoTFuse Conference has been the go-to place to get together and network with others living at the intersection of the digital and physical space.  Sadly, as everyone not living under a rock right now knows – all events worldwide have been cancelled, for very good reasons.

Rather than not go forward with the conference – we thought to ourselves – well, as engineers – what can we do to move humanity forward in the face of this great challenge?  We thought that rather than delaying and postponing a conference indefinitely to a date that may never come in the age of social distancing, we should, “make lemonade out of lemons,” and put all of the, “Internet of Things” skills that we have been working on over the past several years to good use and build a completely new form of conference.

Have virtual conferences been done in the past?  Yeah, sure – but not on the scale and magnitude that we’re going for here.  We’re talking about having up to 10 speakers simultaneously, with a total of up to 60 speakers, and including the capability for those speakers to interact with the audience – all while the speakers and workshop administrators stream from their homes and apartments from multiple locations and different varieties of machines.  Is this a daunting challenge?  Yes, absolutely – but we have run multiple massive scale workshops, conferences and hackathons before going back since at least 2015 – using all sorts of connected devices, operating systems, networking challenges and hardware.  Each year we have run and participated in both the IoTFuse conference and workshop series in April, which you can read about more on this website – as well as the IoTHackDay in October, which you can read more about here, here, here, here and here.  In short – we’ve seen it all, we have built extremely innovative and wacky things and connected to them to the internet under extremely tight timeframes and this is no different.  We are unafraid.  We hope that you may like to join us in our journey as we explore what conferences may look like in the, “virtual,” space as opposed to merely the physical space.

We will be posting more tutorials and hopefully helpful videos on this topic in the coming days and weeks at our blog for anyone who may be interested in following along. We hope that we can contribute in some small way to help move the world forward, help industries and techies continue to exchange information in innovative, simulated conferency ways.

The below written tutorial is built using Youtube as an example video host – we have attempted to make this first tutorial as accessible and open source as possible. However for our internal purposes we used Vimeo.


In this tutorial we will be streaming video from a Raspberry Pi to YouTube live.

Parts you’ll need include:

Raspberry Pi 4 (3B+ may also work)
Pi Camera Module or compatible web camera
Audio source or usb web camera with microphone
Heatsink and fan for the Raspberry Pi
Micro SD card 16GB or 32GB
Raspberry Pi power source
WiFi network or ethernet cable for connectivity
USB keyboard and HDMI monitor or computer that can be used to SSH into the Raspberry Pi

Install the latest version of Raspbian Lite and write the image to the memory card. Using Raspbian Lite will free up more memory and CPU power for the video streaming. Install the heat sinks, fan, camera module and audio source. Setup the Raspberry Pi and connect it to your home WiFi network. If using the Pi Camera Module, enable the camera through the command line interface.

Install Git and consider doing a full upgrade of Raspbian:

sudo apt update
sudo apt install git

Install audio library:

sudo apt-get install libasound2-dev
sudo apt-get install libmp3lame-dev

Install ffmpeg with h264 support (this step will take a while) add the following flags to the ffmpeg config –enable-libmp3lame –enable-omx –enable-omx-rpi. Make sure you have ffmpeg available on the device:


If using a Pi Camera, enable the device.

Check to make sure your video source is recognized:

v4l2-ctl –list-devices

View a list of supported video formats for your device:

ffmpeg -f video4linux2 -list_formats all -i /dev/video0

Display a list of audio sources connected to your Raspberry Pi:

cat /proc/asound/cards

Use the above information to update the following command:

ffmpeg \
-thread_queue_size 1024 \
-f alsa -guess_layout_max 0 -i default:CARD=Microphone \
-thread_queue_size 512 \
-f v4l2 -i /dev/video0 \
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -g 8 -b:v 2500k -maxrate 2500k \
-bufsize 32k -strict experimental \
-acodec libmp3lame -ar 44100 \
-threads 4 -q:v 5 \
-q:a 5 \
-b:a 64k \
-r 30 \
-s 960×720 \
-f flv rtmp://

Replace Microphone with the name of your audio source. Replace /dev/video0 with the name of your video source. Replace STREAM_ID with your YouTube Live stream id. Replace 960×720 with a supported video resolution. Adjust the remaining settings based on available network speed and quality. More settings can be found here.

-g Frame Group (at higher numbers caused blurry frames)
-r Frame Rate (fps)
-b:a Audio Bitrate (higher numbers for better audio)
-s Video Size


Live stream to YouTube from a Raspberry Pi + webcam or USB microphone

How to Live Stream to YouTube With a Raspberry Pi

How To Live Stream A USB Webcam On a Raspberry PI 2