How to do a live twitch with a raspberry pi 3?


How to do a live twitch with a raspberry pi 3?

  • Creation: 11/03/2020
  • Update: 11/21/2020
  • A micro SD card in FAT 32 (minimum 10 GB)
  • Raspberry Pi 3
  • Webcam
  • Keyboard, mouse and a display (for configuration via interface)

  • Raspberry Pi 3 Model Vi.2
  • MicroSD SanDisk Ultra 64GB
  • An old Microsoft webcam
  • A keyboard, a mouse and a screen

1. Installation of Raspberry Pi OS

Download Raspberry Pi Imager to install Raspberry Pi OS (new name of Raspbian) on your Raspberry.

Open Raspberry Pi Imager and choose:
  • Operating System: Raspberry Pi OS (32-bit)
  • SD Card: your SD card
Click on "Write"

Wait few minutes

Click on continue and remove the micro SD card.

All you have to do is connect your raspberry to a screen and configure it!

2. Connection to Wifi

If you are using the OS interface (the simplest), all you have to do is select your Wifi network and connect. For more information, follow the official documentation.

If you prefer to use the command lines, refer to the official documentation.

3. Creating a account

If you haven't already, sign up on

Retrieve the master streaming key on your Twitch dashboard. It looks like this: live_000000000_aaAAaaAAAAAaaaaaAAaaaaAA. This will allow the video stream to be emitted on your channel.

4. Broadcast the output of the webcam on the live

For this part, we will be using FFmpeg, an open source video player and encoder application.

Install FFmpeg (if it is not already integrated in the OS):
sudo apt-get update
sudo apt-get install ffmpeg

Find your webcam (for more information: FFmpeg documentation):
v4l2-ctl --list-devices

Launch your Twitch live:
sudo ffmpeg -f v4l2 -framerate 25 -video_size 1280x720 -i VOTRE-WEBCAM -c:v libx264 -preset veryfast -maxrate 1984k -bufsize 3968k \
-vf "format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 \
-f flv rtmp://
ATTENTION: Do not forget to replace VOTRE-CLE-DE-STREAMING-PRINCIPALE by your main streaming key recovered in the previous step and VOTRE-WEBCAM by /dev/video? found just above.