how to install obs on raspberry pi 4

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.

On Raspberry Pi OS Bullseye, OBS Studio can now be installed directly from the default repository, by using the package manager. On older versions, using Pi-Apps is the easiest alternative.

I will guide you through the installation process, and show you how to use it once installed.
But before that, we will start with a quick overview of OBS Studio.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

Introduction to OBS Studio

What is OBS Studio?

OBS Studio is one of those tools 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 used for live-streaming, as you can manage everything in real time in a drag and drop preview.

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.

If you use the latest Raspberry Pi OS version (Bullseye), then OBS Studio is available in the default repository, and the installation is pretty straightforward.

But if you use Raspberry Pi OS Buster / Legacy, it’s not available. The previous solution I explained in this guide was to compile the application from the source. But it was long, complicated, and the instructions became quickly obsolete with all changes in the source code.

Join Our Community!

Connect, learn, and grow with other Raspberry Pi enthusiasts. Support RaspberryTips and enjoy an ad-free reading experience. Get exclusive monthly video tutorials and many other benefits.

Learn more

On an old Raspberry Pi OS version, the easiest option is to use Pi-Apps, that will do everything for you. I’ll give you the two methods in this article.

As I use OBS Studio on my computer to record my YouTube and community 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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Hardware prerequisites

OBS Studio is not really optimized for Raspberry Pi, so I strongly 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 app is pretty heavy and will easily use 100% of your CPU and a big part of the memory. So be patient if you try on another device.

Related: Why Swap Is Used In Linux? (Goal, Requirements and Commands)

Install OBS Studio on Raspberry Pi OS Bullseye

If you are using a recent version of Raspberry Pi OS (Bullseye or more recent), then OBS Studio is available directly in the package manager. You need to install FFmpeg first, and then the main OBS package.

Install FFmpeg

The FDK AAC package is a prerequisite for OBS Studio.

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

On Bullseye, you can install it easily with:
sudo apt update
sudo apt install libfdk-aac2 libfdk-aac-dev

I give you the commands, but you can also search for the package names in the “Add / Remove Software” tool if you prefer to use the GUI.

Install OBS Studio from the official repository

You can then install the main package for OBS Studio with:
sudo apt install obs-studio

All the other dependencies will be installed automatically. You can skip the next part and go directly to the usage tips, where I help you to get started with this application.

Same thing, you can always use the Add / Remove Software tool if you prefer:

Install OBS Studio on Raspberry Pi OS Legacy

On Raspberry Pi OS Buster (Legacy), it’s not as simple, but I have a solution for you.

You can always try to download the sources and compile them manually, but frankly, it’s way easier to use Pi-Apps for this. At least it works all the time, and you only need one command to do this.

Install Pi-Apps

If you don’t know, Pi-Apps is a nice tool allowing you to install many applications in a few clicks, especially those that are not available in the package manager, and are pretty hard to install manually without this tool.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

To install Pi-Apps, open a terminal and paste this command:
wget -qO- https://raw.githubusercontent.com/Botspot/pi-apps/master/install | bash

I have a full video lesson inside the community about Pi-Apps, but I’ll give you the short version here, just to show you how to use it to install OBS.

Use Pi-Apps to install OBS Studio

Once the app installed, you’ll have a shortcut on your Desktop (and in the main menu), double-click on it and go to the Multimedia category, where you’ll find OBS Studio:

Select it and click on “Install”. A terminal window will show up, but you don’t have anything to do. Pi-Apps will automatically install everything.

A few minutes later, OBS Studio will be installed on your system, and you can read the next part to get started with it.

Getting started with OBS Studio on Raspberry Pi

First run

Whichever option you chose to install it, you can now start OBS Studio from the main menu:
Sound & Video > OBS Studio

You’ll likely get an error when you start it for the first time. I had it on all versions I tested, so I think it’s the same for everyone :-).

On Raspberry Pi 4, I get 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.

You can edit the menu entry via Preferences > Main Menu Editor to add this option. But I didn’t find a way to put it directly in the launcher properties (it doesn’t let me save the entry).

So, I created a tiny script:
nano /home/$USER/obs.sh
Only added this line:
MESA_GL_VERSION_OVERRIDE=3.3 obs
Added the execution permission:
chmod +x /home/$USER/obs.sh

And then put the script in the menu entry instead:

Maybe there is an easier way, but at least it’s working as expected, and I can now run OBS Studio from the main menu directly:

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”.

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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Video

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

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.

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts

10 Comments

  1. I made it to the next to last step. The computer could not find “simde-math.h” and terminate with an exception error. Any advice on how to proceed with the OBS-studio install.

  2. Regarding the issue with not being able to run on the Raspberry Pi 4. A one-time fix for this issue is:

    After the “sudo make install” command, edit the file
    /usr/share/applications/com.obsproject.Studio.desktop

    Change the line that reads
    Exec=obs
    to
    Exec=bash -c “MESA_GL_VERSION_OVERRIDE=3.3 obs”

    This will permit the desktop menu launcher to correctly launch the app. This is equivalent to running the command line version; however, it is simpler for those people used to menus.

  3. This version of OBS does not have the Browser source as on the windows version.
    My setup is a RPI2 with camera and motioneyeOS. Then instead of a windows station to stream to Youtube with OBS (with ip address of the motioneyeos pi) i was willing to use a RPI4.
    I also tried the camera on the pi4 and OBS (no pi2 involved) but no success for now, the camera does not appear in OBS…

  4. Very helpful!

    Particularly the sections “Pre-requisites” and “FFmpeg AAC”, as well as the hint MESA_GL_VERSION_OVERRIDE=3.3 saved me a lot of time.
    The section “Build the source code” might be slightly revised:
    – “sudo git clone – recursive” should be “git clone –recursive”
    – no sudo during build, except for “sudo make install”

    Considering today’s interest of youngsters in social media, OBS should be included with the regular release of Raspberry Pi OS. It works nicely for game streaming with a Pi 4 and SD resolution.

  5. as of may 15th 2021 following commands are needed too finish the build:
    sudo apt install libwayland*
    sudo apt install qtbase5-private-dev
    sudo cmake -DUNIX_STRUCTURE=1 -DENABLE_PIPEWIRE=OFF -DBUILD_BROWSER=OFF -DCMAKE_INSTALL_PREFIX=/usr ..

    1. Thanks, I created a video (coming this week) and I have seen there were several changes.
      I didn’t update the article yet, but the easiest way is probably to use Pi-Apps now.

Comments are closed.