OpenSourcePicks

Open source alternatives to popular software, with live GitHub data

GitHub stats refreshed every day

Gerbera

Lightweight UPnP media server in C++ for TVs, receivers and other home network players

Visit GerberaGitHubDocumentation

Main features

  • UPnP and DLNA serving of music, video and photos on the local network
  • Web UI with tree views of the database and the file system
  • Metadata extraction from MP3, OGG, AAC, M4A, FLAC, WavPack, JPEG and more
  • Transcoding through external tools such as FFmpeg or VLC, set up as profiles
  • Device flags to work around quirks of specific renderers
  • Virtual server layout built from metadata and scriptable in JavaScript
  • Automatic rescans on a timer or through inotify
  • Video and image thumbnails
  • Last.fm scrobbling
  • Links to internet content served to renderers
  • SQLite by default, with MySQL/MariaDB or PostgreSQL as options

What Gerbera does

Gerbera is a UPnP media server: it makes music, video and photos stored on a Linux, BSD or macOS machine visible to UPnP and DLNA devices on the home network, such as smart TVs, AV receivers, network speakers and media player apps. Those devices discover the server on their own and browse it from their own menus, so nothing has to be installed on them. Gerbera continues the older MediaTomb project: its documentation states it is built on MediaTomb 0.12.1, and the MediaTomb authors are still credited in the license.

It does not play anything itself and has no apps of its own. Its job is to index files, extract their metadata and present them to renderers in a structure you can shape.

Library layout and device compatibility

Metadata comes from TagLib for audio tags, libexif and exiv2 for photos, libmatroska for MKV files and, optionally, FFmpeg. From that metadata Gerbera builds a virtual layout, for example music grouped by artist, album, genre and year, alongside the plain folder view. The layout and the import logic can be rewritten in JavaScript through the built-in duktape engine, which gives a lot of control over how a library appears on a TV menu.

UPnP renderers interpret the standard in different ways, and Gerbera addresses this with device flags. A client can be matched by its user agent or IP address and given flags that change how the server answers it; the documentation lists named flags for some manufacturers, such as Samsung, plus numeric ones. When a renderer cannot play a format, transcoding profiles call an external program such as FFmpeg or VLC with the arguments you define, per MIME type. Gerbera can also generate video thumbnails, rescan folders on a timer or as soon as files change through inotify, scrobble to Last.fm, and serve links to internet streams.

Self-hosting Gerbera

Gerbera is a compiled C++ program with a small footprint; the README says it runs on x86, ARM and MIPS hardware. The installation documentation lists an official Docker image (gerbera/gerbera, with tagged versions recommended), a project-maintained repository for Ubuntu and Mint, packages for Gentoo, Arch, Fedora, openSUSE and FreeBSD, an OpenWrt package for routers, Buildroot, and a Homebrew tap for macOS. Building from source uses CMake.

The required libraries are listed in the README: libupnp (or the alternative libnpupnp), pugixml, jsoncpp, libiconv, SQLite, zlib, fmtlib and spdlog. Everything else, including TagLib, FFmpeg, MySQL/MariaDB or PostgreSQL support, Last.fm and thumbnails, is optional and enabled at build time. Configuration lives in an XML file, and the web UI is used to add folders and edit the database. On a server with a strict firewall, the SSDP discovery service and the port Gerbera listens on have to be opened, as the Fedora instructions show.

Hosted version

There is no hosted service. Gerbera runs only on your own hardware.

Limitations

Gerbera is a local-network server. It has no user accounts, no remote streaming and no mobile or TV apps, so it does not replace the way Plex or Jellyfin stream to apps over the internet. The playback experience depends on each renderer’s own interface and format support. The XML configuration, device flags and JavaScript layout scripts are flexible but take time to learn, and transcoding has to be set up by hand.

Who it suits

Gerbera suits people who want their TV, receiver or network speakers to browse a music and video collection directly, on hardware as small as a router or a Raspberry Pi, and who are comfortable editing configuration files. If you prefer a desktop program with ready-made renderer profiles and automatic transcoding, look at Universal Media Server. Our media server guide compares the other options.

License details

GPL-2.0. GPL version 2 only: the license file states that v2 is the only valid version for the MediaTomb code it builds on.

Technical details

Self-hosting needs

  • libupnp or libnpupnp
  • SQLite (or MySQL/MariaDB
  • PostgreSQL)

Built with

  • C++

GitHub topics

  • c-plus-plus
  • cmake
  • dlna
  • dlna-server
  • duktape
  • flac
  • gerbera
  • inotify
  • javascript
  • libupnp
  • m3u8
  • mediaserver
  • mp3
  • nfo

Reviewed by the OpenSourcePicks editors from the project's repository and documentation. Something out of date? Tell us.