Open Source Video Streaming & Recording

Authors: Marco Bertini, Mathias Lux;
Affiliation: University of Florence, University of Klagenfurt;
Editors: Mathias Lux and Marco Bertini

URL: https://obsproject.com/

By the time of writing, the CoViD-19 disease has spread, impacting the world. Education and research are affected as well, but fortunately the community can continue working due to all the developments over the last few years. Even more so, streaming tech and video conferences allow us to keep in touch with family and friends. That this technology is accessible is shown by the recent rise in numbers of users. Twitch.tv alone has experienced an all-time high in Q1 of 2020 with more than 3 billion hours of streaming video being watched on the Amazon-owned online service [1]. While being known for game streams, also teachers, artists, entertainers and musicians are moving to Twitch.tv in large numbers. Part of the success of course is that the web based viewer interface of Twitch.tv and its competitors is easily accessible, but another secret ingredient is the popular free and open source software that makes streaming possible from nearly every computer around the world: Open Broadcaster Software (OBS) [2].

What is the Open Broadcaster Software?

According to its own definition it’s “Free and open source software for video recording and live streaming.” However, this is just part of the functionality. OBS allows for mixing audio and video streams, composing visual scenes from multiple sources, managing and switching those scenes during recording or broadcast, encoding the resulting audiovisual output, and streaming it to a distribution service like Twitch.tv & YouTube. Through an extensive plugin library, additional features like slow motion replay, remote control, GStreamer support, and much more is available. 

A common use case is game-related streaming. For that a streamer would stream live game play along with a video of herself and various overlays for interacting with the audience. Typical additional scenes for game streamers would be a larger view of players video for talking to the audience, promotional scenes, before actual streaming starts and after it ends, and a pause scene if the player takes a break. While playing the game the player operates OBS by switching scenes and triggering actions in the overlays, e.g. welcoming new followers or thanking donors, and audio replays, like a cheering crowd or a bell ringing. 

The video frame shows a typical scene setup from the RareByte Twitch.tv channel, streaming a live gaming session [3]. The streamer is visible in the lower right corner, a guest in the lower left corner. On the right current chat messages are shown. Along the lower border of the screen, statistics on the audience are shown. Along the upper border the social media contacts of the company and the logo are shown. 

Other use cases include recording or streaming video sessions for teaching, talk shows or even events switching between cameras. Currently with many people not being able to leave home due to the CoViD-19 related restrictions a lot of comedians and musicians have started streaming as their tours have been canceled and they want to interact with the audience.

How to use OBS?

The Open Broadcaster Software is developed by a small core team and a large group of occasional contributors with the source code on Github [4]. The community around OBS is very active and the code along with the processes for code contributions are well documented. Besides compiling the source code, one can download Windows, Mac and Linux binaries, the later are available in package repositories of major distributions. 

Once downloaded one can start setting up the scenes. The screenshot shows the studio mode, which has an additional view to set up and stage the scenes while the program is running (in the right view). Below preview and program, OBS provides access (from left to right) to the available scenes, the media sources of the selected scene, the audio mixer, the transition control and the most important buttons to start and stop streaming and recording and to access the settings. The screenshot shows a typical scene with a game view and a webcam in the program and a waiting scene, named Scene_BRB, in the preview. Possible sources for a scene include text, images, video, audio and video devices, video streams, display and window capture, headless browser windows and other scenes. Most notable option is the VLC source, which allows to integrate anything that VLC can play within a scene. For educational purposes one could for instance set up scenes showing the slides with and without webcam, pre-prepared videos to show in the lecture and scenes of tools and live demonstrations. 

A second step is to set up the encoder for streaming and recording. OBS integrates x264 as main encoder and supports H.264 hardware encoding with Intel Quick Sync Video and Nvidia NVENC out of the box, of course if the required hardware is present. Support for hardware encoding with AMD hardware is available through a plugin. For streaming OBS comes with pre configured profiles for many services and supports any RTMP server with and without authentication. Also stream multiplexers like restream.io and castr.io are supported. A known problem with OBS, however, is that for devices with multiple graphics devices, e.g. notebooks with Intel CPUS and GPUs as well as dedicated Nvidia GPUs one has to take care which GPU can be accessed by OBS. Depending on if it runs in power saving mode (on the Intel GPU) or in performance mode (on the Nvidia GPU) only screens running on the same GPU can be captured.

Recording a lecture

As mentioned above OBS can be used to record videos, e.g. to produce a tutorial or a lecture combining different audio and video sources. Let’s briefly review how to setup OBS to perform this task. A wizard that can be executed from the Tools menu set ups and optimizes the configuration of the system either for streaming or recording.

When selecting video recording, the wizard sets frame resolution and FPS, then performs a short test of video coding to evaluate the performance of the system, e.g. rescaling down the frame resolution, choosing the encoder and its quality level.

Recording format (e.g. Matroska MKV or MP4) is set in the program settings. In case of video streaming it is possible to record the stream, so to have a copy that can be shared or edited later e.g. using Avidemux.

It’s better to record to MKV files and then set “remux to MP4” in the advanced options panel to be able to deal with issues like BSOD or interruptions that may stop recording (e.g. loss of power); in fact if the MP4 save file can not be finalized it may become corrupted and thus unusable. Using the combination of MKV recording and MP4 remuxing will result in the creation of two videos: a MKV and an MP4 file.

Once recording setup is completed it is time to prepare the capture and compose the sources to create the final video. Sources are combined within a scene and composited depending on their order. Using the arrows below the source panel (or dragging and dropping them) it is possible to design the composition of the scene.

To record a lecture capturing a presentation with voice over and a small thumbnail of a talking head there’s need of three sources: 

  • Audio input capture, selecting f.e. the internal microphone of a laptop
  • Video capture device, selecting f.e. the webcam of a laptop
  • Display capture, selecting the monitor used by Powerpoint, Keynote or any other slideshow program. It is possible to capture from different displays if they are available 

In the source panel the video capture device must be placed above the display source, to make it visible when compositing the output video. If only one display is available, then OBS will produce a typical infinite loop preview as shown in the following. This is not an issue when recording starts and the presentation is started.

If a second display is available then it is possible  to select it during the setup of the source as shown in the following.

It is important to take care in resizing and placing within the scene all the sources, to avoid to crop them, especially when capturing the display. To this end it is simply needed to select each source and then to manually drag/drop and resize the sources in the preview panel. 

Alternatively to capturing the whole screen it is possible to capture different program windows, possibly combining program windows together. Again, it is important to place and resize the source in order to obtain the desired composition. Luckily, OBS stores how scenes are composed, thus once we have finalized them there no need to set them up again.

Starting, stopping and pausing recording can be done through the control panel of OBS, using the menu associated to the icon in the system tray or using the configurable hotkeys.

Outlook, Market and Conclusions

OBS has secured funding for the ongoing efforts with a sponsor program they started in Feb. 2019 [5]. It is currently sponsored by Facebook, Twitch, Nvidia, Logitech, XSplit and Games Done Quick. One of the main competitors is Streamlabs [6], which, funnily enough, forks the OBS code and monetizes content like additional themes and widgets. Twitch works on its own streaming software trying to simplify the process of streaming for people who don’t want to read up on the technical details. XSplit [7] also provides more accessible streaming software, even reduced to a minimum in their Gamecaster software. XSplit is monetizing their software with a subscription model. Vmix [8] is proprietary software focusing on professional broadcasters with features like 4k resolution, extended hardware support, multiple output streams, and built-in video call features. Wirecast [9] is a similar software package with comparable features. 

All in all the market for video production and live broadcasting is growing rapidly and OBS is an open source tool that provides a robust set of features to do professional streaming. With sponsors secured, a lively community, and a dedicated and motivated team of contributors OBS is here to stay. The wide adoption of OBS makes it an extremely valuable and representative output of the open source community.

References

[1] https://web.archive.org/web/20200401233744/https://www.hollywoodreporter.com/news/twitch-breaks-viewership-records-coronavirus-quarantine-1287894, accessed 2020-04-03

[2] https://obsproject.com/, accessed 2020-04-03

[3] https://www.twitch.tv/rarebyte, accessed 2020-04-03

[4] https://github.com/obsproject/obs-studio, accessed 2020-04-03

[5] https://obsproject.com/blog/new-ways-to-support-obs-development, accessed 2020-04-03

[6] https://streamlabs.com/, accessed 2020-04-03

[7] https://www.xsplit.com/, accessed 2020-04-03

Bookmark the permalink.