How to Install OBS Studio on Raspberry Pi OS? (video capture)


With the new Raspberry Pi models available, video capture and streaming become possible.
Even if we are still far from a professional computer, the Raspberry Pi 4 can handle this pretty well.
One of the most used software for video capture on PC is OBS Studio, and it is possible to install it on Raspberry Pi. Let’s see how.

OBS Studio is a free software for streaming and video recording.
On Raspberry Pi, the installation can be done by building the source available on the GitHub project.
After that, OBS Studio is available in the main menu.

As there is no package available, I will guide you through the installation process, and show you how to use it once installed.
But before that, we will start by a quick overview about OBS Studio.

Introduction to OBS Studio

What is OBS Studio?

OBS Studio is one of those tool you can use to record a video on your computer.
The good news is that it’s a free and powerful tool to do this.
You can manage multiple sources (like a Camera module or a USB device), and include several of them in a recording.

OBS Studio is also often use for live-streaming, as you can manage everything in real time in a drag and drop preview.

Raspberry Pi Bootcamp
Sale: 10% off today.
Take it to the next level.
I'm here to help you get started on Raspberry Pi.
Learn all the skills you need in the correct order.

OBS Studio on Raspberry Pi

OBS Studio is available for any operating system.
You can find binaries for Windows and macOS on the home page, and it’s available in the default repositories in most Linux distributions.
Currently, the Raspberry Pi is not officially supported, but you can download the sources and compile them on it.

As I use OBS Studio on my computer to record my YouTube videos, I was curious to see how it works on Raspberry Pi OS.
For example, I have some issues recording my screen on Raspberry Pi 4, the stream quality I receive on my video capture device is not as good as on Raspberry Pi 3B+ (probably due to the micro HDMI port or at least the adapter).
So, it can be a good alternative to record it directly on the Raspberry Pi.

Install OBS Studio

Hardware

OBS Studio is not optimized for Raspberry Pi, there is no release for it and no specific development for the ARM architecture.
The compilation process can be very long depending on your Raspberry Pi model. I even crash my Raspberry Pi 3B+ several times without succeeding.
So, I really recommend a Raspberry Pi 4 4 GB or 8 GB on Amazon to follow this tutorial.

If you want to try on Raspberry Pi 3B+, it could work if you create a swap file (I didn’t have one in my tests on Pi 4).
Here is how to create it (in a terminal or via SSH):
sudo dd if=/dev/zero of=/var/swap2 bs=1024 count=1000000
sudo chmod 600 /var/swap2
sudo mkswap /var/swap2
sudo swapon /var/swap2
sudo swapon

Even with a Raspberry Pi 4, the compilation will use 100% of your CPU and a big part of the memory. So be patient if you try on another device.

Pre-requisites

Once the system ready, you need to install a huge list of packages before starting the compilation.
Here is the command to copy and paste in a terminal:
sudo apt install build-essential checkinstall cmake git libmbedtls-dev libasound2-dev libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libgl1-mesa-dev libjack-jackd2-dev libjansson-dev libluajit-5.1-dev libpulse-dev libqt5x11extras5-dev libspeexdsp-dev libswresample-dev libswscale-dev libudev-dev libv4l-dev libvlc-dev libx11-dev libx11-xcb1 libx11-xcb-dev libxcb-xinput0 libxcb-xinput-dev libxcb-randr0 libxcb-randr0-dev libxcb-xfixes0 libxcb-xfixes0-dev libx264-dev libxcb-shm0-dev libxcb-xinerama0-dev libxcomposite-dev libxinerama-dev pkg-config python3-dev qtbase5-dev libqt5svg5-dev swig

FFmpeg AAC

Another prerequisite is the FDK AAC package, but there is no full version available on Raspbian.
So, we will download it from the Debian repository and install it manually

FDK AAC is the FFmpeg encoder for the AAC format
It’s the successor from MP3, often use in MP4 streams, and required for OBS Studio

Here is how to install it:

  • Download these two files:
    wget http://ftp.debian.org/debian/pool/non-free/f/fdk-aac/libfdk-aac2_2.0.1-1_armhf.deb
    wget http://ftp.debian.org/debian/pool/non-free/f/fdk-aac/libfdk-aac-dev_2.0.1-1_armhf.deb
  • Install them with:
    sudo dpkg -i libfdk-aac2_2.0.1-1_armhf.deb
    sudo dpkg -i libfdk-aac-dev_2.0.1-1_armhf.deb

You are now ready to download and compile the source code

Master your Raspberry Pi in 30 days
Sale: 10% off today.
Download the eBook.
Uncover the secrets of the Raspberry Pi in a 30 days challenge.
Learn useful Linux skills and practice multiples projects.

Build the source code

As I told you in introduction, we will download the source code from the GitHub project.
Follow these steps to download and install everything:

  • Download the source code with git:
    sudo git clone --recursive https://github.com/obsproject/obs-studio.git
    You can move to a specific folder if you want (like /opt), personally I have done this in the Downloads folder.
  • Move to the new folder:
    cd obs-studio
  • Create a build folder and move into this one:
    sudo mkdir build
    cd build
  • Run cmake
    sudo cmake -DUNIX_STRUCTURE=1 -DCMAKE_INSTALL_PREFIX=/usr ..
  • And finally start the compilation:
    sudo make -j4
    The compilation time depends on your hardware, between a few minutes and one hour probably 🙂
  • And here is the last step is to install OBS Studio:
    sudo make install

That’s it, OBS is now ready to use

First run

Once installed, you can start it from the main menu:
Sound & Video > OBS Studio

On the first run, an auto-configuration wizard is available to set the default settings.
I recommend using it so you don’t have anything else to change to get started.
Answer the few questions (you can keep the default values if you have no idea) and OBS will run a test to configure everything. Click on “Apply settings to confirm”.

Debug on Raspberry Pi 4

On Raspberry Pi 4, you can’t run it directly.
I had this error:
"Failed to initialize video. Your GPU may not be supported, or your graphic drivers may need to be updated"

Let me know if you have another solution, but the only thing that worked for me is to set this variable before starting obs:

  • Open a terminal
  • Run this command:
    MESA_GL_VERSION_OVERRIDE=3.3 obs

This should work as expected now, you can run the auto-configuration wizard like explained in the previous step.

OBS Studio tips on Raspberry Pi

Once OBS started, the difficult part is done, you will find any help you need on specialized websites and forum.
But, just to help you to take a good start, I will show you how to capture your screen or camera.

Screen capture

Here is how to capture your screen with OBS:

  • By default, the “Sources” panel is available at the bottom of the screen
  • Click on “+” to add a source
  • Choose “Screen Capture (XHSM)”
  • A window shows up asking for a source name.
    Keep it by default or enter whatever you want.
    Then confirm with OK.
  • On the next screen, you can confirm a few things like the screen to capture (on a Raspberry Pi 4 with two screens only), if you want to capture the mouse pointer and another advanced setting (X server)
  • From here, your screen appears on the default scene

It will be easier with two screens (one with OBS and the other with the things you want to record), but it works in any case.

Camera capture

If you have a camera (Pi module or other), you can add it to the sources almost the same way:

  • Enable your camera on Raspberry Pi OS (click the link for more details)
  • Click on “+” in the “Sources” panel
  • Choose “Video Capture Device (V4L2)” as new source
  • Again, choose a name and confirm
  • In the next window, you can configure everything about your camera

    For example, mine needed a rotation to display the image in the correct orientation, so I just changed the “Rotation” value and let the other settings by default
  • Confirm to add it in the source list

Once you have at least one source, you change the image size on the screen
For example, you can use OBS to stream your desktop and use your camera to show your face in a corner.
All the settings can be change by click on the “Settings” button on the right (general, stream to Twitch, output quality and format, shortcuts, etc.)

OBS also manage other sources the same way (audio for example)

Record

To record your screen or camera, type “Start Recording” on the right.
The default output folder is /home/pi, files are in MKV with a 1080p high quality.
You can change everything in the settings.

Shortcuts

By default, there is no shortcut so you need to use a mouse to start/stop a record or anything else.
In the settings it’s possible to set a shortcut to each action.

Video

Conclusion

That’s it! You now know how to install and configure OBS on your Raspberry Pi.

I tested on Raspberry Pi 4, it works pretty well (except the menu icon)
No lag, no bug, so it’s good news.
I’ll probably try it in a future video for the YouTube channel and let you know if I have anything else to add.


This tutorial doesn't work anymore? Report the issue here, so that I can update it!

.

Shop Related Products
DEAL OF THE DAY
ENDS IN
DEAL OF THE DAY
ENDS IN
DEAL OF THE DAY
ENDS IN
DEAL OF THE DAY
ENDS IN

Patrick Fromaget

I'm the lead author and owner of RaspberryTips.com. My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with a web developer experience.

Recent Posts

Master your Raspberry Pi - 10% off
08
hrs
:
13
mins
:
50
secs

Receive notification for new tutorials

Allow updates from raspberrytips.com

You can turn it off whenever you like.