Video Playback

Video Playback

Introduction

MidnightBSD provides comprehensive support for video playback through various media players available via mports. This guide covers the available video players, hardware acceleration options, codec support, and troubleshooting common video playback issues.

Available in mports: mpv, vlc, mplayer, xine, kodi, totem, dragon, parole, cheese, ffmpeg, streamlink, and more.

Prerequisites

User Group Membership:

doas pw groupmod video -m username

Xorg Configuration: For GUI players, ensure X11 is working. See Xorg documentation.

Audio Configuration: Ensure sound is working. See Sound documentation.

Available Video Players

Player Type Description Package
MPV CLI/Minimal GUI Lightweight, highly configurable, excellent performance mpv
VLC GUI Full-featured, cross-platform, built-in codecs vlc
MPlayer CLI/Minimal GUI Mature player with extensive format support mplayer
Kodi GUI/Media Center Full media center for TV, movies, music kodi
Xine GUI Traditional media player with plugin architecture xine
Totem GUI (GNOME) Simple GNOME media player totem
Dragon GUI (KDE) KDE media player dragon
Parole GUI (XFCE) XFCE media player using GStreamer xfce4-parole

Recommendation: For most users, MPV is recommended. VLC is a good alternative with GUI.

Player Configuration

MPV - Recommended Player

MPV is a lightweight, highly configurable media player with excellent performance and comprehensive format support.

Installation:

# doas mport install mpv

Basic Usage:

# Play a local file
mpv /path/to/video.mp4

# Play with subtitles
mpv --sub-file=/path/to/subtitles.srt /path/to/video.mp4

# Play from URL
mpv https://example.com/video.mp4

# Fullscreen
mpv --fullscreen /path/to/video.mp4

Common Options:

Keyboard Controls:

Configuration File: ~/.config/mpv/mpv.conf

fullscreen=yes
vo=gpu
hwdec=auto
profile=gpu-hq
volume=75
cache=yes
screenshot-directory=~/Pictures

Hardware Decoding:

mpv --hwdec=vaapi video.mp4    # VA-API
mpv --hwdec=vdpau video.mp4    # VDPAU
mpv --hwdec=auto video.mp4     # Automatic

Install Codecs:

# doas mport install ffmpeg libva libvdpau

VLC Media Player

VLC is a full-featured, cross-platform media player with extensive format support and user-friendly interface.

Installation:

# doas mport install vlc

Basic Usage:

vlc                          # Launch GUI
vlc /path/to/video.mp4        # Play file from CLI
vlc dvd:///dev/cd0           # Play DVD

Hardware Acceleration:

vlc --avcodec=vaapi video.mp4
vlc --avcodec=vdau video.mp4

Convert Media: Media → Convert/Save...

Stream Media: Media → Open Network Stream...

Preferences: Tools → Preferences (Show All for advanced settings)

MPlayer

MPlayer is a mature media player with extensive format support and configurability.

Installation:

# doas mport install mplayer mplayer-skins

Basic Usage:

mplayer /path/to/video.mp4        # Play file
mplayer dvd:///dev/cd0           # Play DVD
mplayer -fs /path/to/video.mp4    # Fullscreen

Video Output Drivers:

mplayer -vo xv video.mp4         # X11 Video extension
mplayer -vo opengl video.mp4     # OpenGL
mplayer -vo vdpau video.mp4     # VDPAU
mplayer -vo vaapi video.mp4     # VA-API

Audio Output Drivers:

mplayer -ao pulse video.mp4      # PulseAudio
mplayer -ao oss video.mp4        # OSS audio

Hardware Acceleration:

mplayer -vc ffh264vdpau,ffmpeg12vdpau -vo vdpau video.mp4

Configuration: ~/.mplayer/config

Kodi Media Center

Kodi is a full media center application designed for home theater PCs with a beautiful, user-friendly interface optimized for TV.

Installation:

# doas mport install kodi

Basic Usage:

kodi               # Launch Kodi
kodi-standalone   # Launch in fullscreen

Setup:

  1. Configure language, region, and appearance
  2. Set up media sources (Videos, Music, Pictures)
  3. Kodi will automatically scan and organize media

Hardware Acceleration: Enable in Settings → Player → Videos → Acceleration

Useful Add-ons: YouTube, Netflix, PVR IPTV Simple Client, Subtitles

Other Players

Xine:

# doas mport install xine
xine /path/to/video.mp4

Totem (GNOME):

# doas mport install totem
totem /path/to/video.mp4

Dragon (KDE):

# doas mport install dragon
dragon /path/to/video.mp4

Parole (XFCE):

# doas mport install xfce4-parole
parole /path/to/video.mp4

Hardware Acceleration

Hardware acceleration can significantly improve video playback performance, especially for HD content.

VA-API (Video Acceleration API)

Supported Hardware: Intel (G45+), AMD (Radeon HD 2000+)

Installation:

doas mport install libva libva-intel-driver  # Intel
doas mport install libva libva-vdpau-driver  # AMD

Verify:

vainfo

Usage:

mpv --hwdec=vaapi video.mp4
vlc --avcodec=vaapi video.mp4
VDPAU (Video Decode and Presentation API)

Supported Hardware: NVIDIA (GeForce 8+), AMD (Radeon HD 2000+)

Installation:

doas mport install libvdpau nvidia-driver  # NVIDIA
doas mport install libvdpau libva-vdpau-driver  # AMD open-source

Verify:

vdpauinfo

Usage:

mpv --hwdec=vdpau video.mp4
mplayer -vc ffh264vdpau -vo vdpau video.mp4
vlc --avcodec=vdau video.mp4
Intel Quick Sync

Supported Hardware: Sandy Bridge+

Installation:

doas mport install intel-media-sdk libva-intel-driver

Usage:

mpv --hwdec=vaapi video.mp4
NVIDIA NVDEC/NVENC

Supported Hardware: GeForce GTX 600+

Installation:

doas mport install nvidia-driver libva-vdpau-driver

Usage:

mpv --hwdec=vdpau video.mp4  # VDPAU
mpv --hwdec=vaapi video.mp4   # VA-API (newer drivers)

Driver Configuration:

kldload nvidia             # Load NVIDIA kernel module
sysrc nvidia_load=YES       # Enable at boot
nvidia-smi                 # Check driver status

Verify Hardware Acceleration:

mpv --hwdec=auto --verbose video.mp4  # Check for hwdec messages
vainfo                              # VA-API info
vdpauinfo                          # VDPAU info

Codecs and Formats

Common Video Codecs: H.264/AVC, H.265/HEVC, AV1, VP9, VP8, MPEG-2, MPEG-4, VC-1/WMV, Theora

Common Video Containers: MP4, MKV, WebM, AVI, MOV, FLV, TS/M2TS, OGG, WMV/ASF

Install Codec Support:

doas mport install ffmpeg libx264 libx265 libvpx libtheora

# DVD support
doas mport install libdvdcss libdvdnav libdvdread

# Blu-ray support
doas mport install libbluray libaacs

# AV1 support
doas mport install dav1d

Check File Information:

ffprobe /path/to/video.mp4
ffmpeg -codecs          # List supported codecs
ffmpeg -formats         # List supported formats

Streaming Video

Streamlink: CLI tool for extracting streams from YouTube, Twitch, and other sites.

Installation:

# doas mport install streamlink

Basic Usage:

# List available streams
streamlink https://youtube.com/watch?v=ID --stream-types

# Play best quality with MPV
streamlink https://youtube.com/watch?v=ID best -p mpv

# Play with VLC
streamlink https://youtube.com/watch?v=ID best -p vlc

# Save stream to file
streamlink https://youtube.com/watch?v=ID best -o video.mp4

Streaming with MPV/VLC:

# MPV
mpv https://youtube.com/watch?v=VIDEO_ID
mpv https://twitch.tv/channel_name

# VLC
vlc https://example.com/stream.m3u8
vlc rtsp://server/stream

Troubleshooting

No Video Output:

Choppy/Stuttering Playback:

No Audio:

Missing Codec:

Hardware Acceleration Not Working:

Diagnostic Commands:

# Video file information
ffprobe /path/to/video.mp4

# Hardware acceleration info
vainfo
vdpauinfo

# GPU information
kldstat | grep drm

# Player version
mpv --version
vlc --version
mplayer -v

# Verbose logging
mpv -v /path/to/video.mp4
vlc -vvv /path/to/video.mp4

Performance Monitoring:

htop                        # CPU usage
nvidia-smi                  # NVIDIA GPU info
intel_gpu_top               # Intel GPU info

Configuration Files:

# MPV
~/.config/mpv/mpv.conf

# VLC
~/.config/vlc/vlcrc

# MPlayer
~/.mplayer/config

# Kodi
~/.kodi/userdata/guisettings.xml