Multimedia

Multimedia

Synopsis #

This chapter explains how to configure and use audio and video hardware under OpenBSD, manage sound devices using the base system’s sndio(7) framework, and install multimedia applications such as video players, editors, and streaming tools from packages. It also documents webcam usage, ripping and transcoding media, home media sharing via DLNA, and game or screen broadcasting to services such as Twitch or YouTube.

Audio Subsystem #

Sound Hardware Support #

OpenBSD supports various sound interfaces through drivers such as:

  • azalia(4) — Intel HD Audio
  • uaudio(4) — USB audio devices
  • hdafg(4) — HDA codec front-end
  • emu(4), eap(4) — Older PCI sound cards

To check audio device detection:

$ dmesg | grep audio

To verify the sound daemon is running:

$ pgrep sndiod

To start sndiod(8) with default settings:

$ sndiod -f rsnd/0 -d -s default

To enable sndiod at boot:

# rcctl enable sndiod
# rcctl start sndiod

Volume Control with mixerctl #

The mixerctl(1) utility adjusts volume and toggles input/output channels.

List current settings:

$ mixerctl -av

Set master volume:

$ mixerctl outputs.master=200,200

Audio levels persist across reboots when sndiod is active.

Spotify Support #

Spotify’s web player does not function on OpenBSD, as it requires DRM (Widevine), which is unavailable.

A viable alternative is ncspot, a TUI client using the Spotify API:

# pkg_add ncspot

It requires:

  • A Spotify Premium account
  • A Spotify developer token (configured once)

Credentials are stored in ~/.config/ncspot/config.toml.

For background playback via Spotify Connect, install spotifyd:

# pkg_add spotifyd

Use it in conjunction with ncspot or a mobile Spotify client.

Playing Audio Files #

The base system includes:

  • aucat(1) — Playback and capture via sndio
  • sndioctl(1) — Runtime control of sndiod

Play a WAV file:

$ aucat -i sound.wav

Audio Players from Packages #

Popular options include:

  • mpv — Modern CLI video/audio player
  • cmus — Terminal music player
  • audacious — Lightweight GTK+ player
  • moc — Music on Console

Install mpv:

# pkg_add mpv

Recording Audio #

To record from the default input:

$ aucat -o record.wav

Check input settings:

$ mixerctl inputs.reclvl

Advanced applications such as audacity are also available:

# pkg_add audacity

MIDI Support #

To play MIDI files:

# pkg_add fluidsynth
$ fluidsynth -a sndio soundfont.sf2 song.mid

Virtual keyboards are available, such as vmpk.

Video Playback #

OpenBSD uses the drm(4) subsystem for graphics acceleration. Hardware support includes:

  • amdgpu(4), radeondrm(4) — AMD GPUs
  • i915drm(4) — Intel GPUs
  • nouveaudrm(4) — NVIDIA (limited)

Verify driver usage:

$ dmesg | grep drm

Install mpv or vlc:

# pkg_add mpv
# pkg_add vlc

Example usage:

$ mpv video.mkv

Webcam Support #

Webcams using uvideo(4) are supported. Check detection:

$ dmesg | grep uvideo

Basic webcam preview with ffplay:

# pkg_add ffmpeg
$ ffplay -f v4l2 -video_size 640x480 -i /dev/video0

Webcam support is limited to devices compatible with the Video4BSD interface.

Bluetooth Audio #

Bluetooth is not supported on OpenBSD.

The Bluetooth stack has been removed from the kernel and userland. No support exists for audio profiles such as A2DP. For wireless audio, use USB audio adapters or analog connections.

CD Audio and Ripping #

To play an audio CD:

$ cdio play

To rip tracks:

# pkg_add abcde
$ abcde -d /dev/rcd0c

cdparanoia and cdda2wav are also available in packages.

DVD and Video Discs #

Encrypted DVDs require libdvdcss:

# pkg_add libdvdcss vlc

Play a disc:

$ vlc dvd://

To inspect disc structure:

$ lsdvd

Home Media Streaming and Casting #

DLNA and UPnP #

Available media servers:

  • minidlna — Lightweight
  • gerbera — Metadata-rich web interface

Install and start minidlna:

# pkg_add minidlna
# rcctl enable minidlna
# rcctl start minidlna

Configure /etc/minidlna.conf to set media directories.

KDE Media Integration #

KDE Plasma supports upnp://, smb://, and other protocols via kio-extras.

To install KDE:

# pkg_add kde

Features such as Plasma’s Media Center, audio routing, and file sharing are partially supported, but full casting functionality (e.g., Chromecast) is not available on OpenBSD.

Live Streaming and Capture (Twitch, YouTube, etc.) #

OBS Studio #

obs provides screen and window capture, with support for livestreaming to Twitch, YouTube, and others.

Install OBS:

# pkg_add obs

Launch:

$ obs

Only software-based encoding is supported. No hardware acceleration is available.

ffmpeg Streaming #

For scripted streaming or recording:

$ ffmpeg -f x11grab -s 1920x1080 -i :0.0 -f alsa -i default -c:v libx264 -preset veryfast -c:a aac output.mp4

Edit the input/output options based on screen resolution and available devices.

Reencoding and Transmuxing Media #

ffmpeg #

Convert MKV to MP4:

$ ffmpeg -i input.mkv -codec copy output.mp4

Extract audio:

$ ffmpeg -i input.mp4 -vn -acodec copy track.aac

Transcode audio:

$ ffmpeg -i track.flac -acodec libmp3lame output.mp3

HandBrake #

A GUI-based transcoder for DVD ripping and format conversion:

# pkg_add handbrake
$ handbrake

Tuning sndiod #

sndiod can be customized with flags. Example:

# rcctl set sndiod flags "-f rsnd/0 -z 48000 -b 960"
# rcctl restart sndiod

This sets a 48 kHz sample rate and 960-frame block size.

Troubleshooting #

  • Ensure sndiod is running with the correct device
  • Use mixerctl -av to inspect all levels
  • Check /dev/audio* permissions
  • Restart sndiod after reconnecting devices

Additional Applications #

To search for available packages:

$ pkg_info -Q audio
$ pkg_info -Q video