This is a simple yet powerful shell script to stream your desktop on FreeBSD using only:
ffmpegvirtual_ossx11grab- No OBS
- No PulseAudio
- No JACK
- No GUI bullshit
Because:
- OBS on FreeBSD is often broken or hard to build.
- The PulseAudio + OBS combo can mess with your system's audio stack.
- We like minimalism and control.
This script provides an alternative way to stream what you see and hear, using clean CLI tools and native OSS.
Make sure you have the following installed:
ffmpeg(built with--enable-oss)virtual_ossxorgrunning- Your user has access to
/dev/dsp*(typically via theoperatorgroup)
Edit /etc/rc.conf:
virtual_oss_enable="YES"
#virtual_oss_flags="-Q 0 -C 2 -c 2 -r 48000 -b 16 -s 1024 -P /dev/dsp0.1 -R /dev/null -d vdsp -l dsp"
You can adjust /dev/dspX.Y as needed for your system (see device detection below).Start the service:
service virtual_oss startEdit
pkill sndiod
pkill pulseaudiogit clone https://github.com/yourname/freebsd-twitch-streamer.git
cd freebsd-twitch-streamer
chmod +x stream.sh./stream.sh --set-default-key YOUR_TWITCH_KEY
This embeds the key into the script itself./stream.sh./stream.sh [OPTIONS] [TWITCH_STREAM_KEY]
Options:
--set-default-key <key> — Save the key into the script (self-modifying).
--skip-oss-setup — Skip virtual_oss setup (if it's already running).
--help, -h — Show usage help.
Examples
Stream with embedded key:
./stream.sh
Stream with a new key (overrides embedded key temporarily):
./stream.sh zzzz9999xxxx8888
Skip OSS setup (e.g. if already running):
./stream.sh --skip-oss-setup
Both skip setup and provide key manually:
./stream.sh --skip-oss-setup xyz789zzz000The script: Kills any existing virtual_oss instances, then detects your mic and system playback devices from /dev/sndstat, then tarts a new virtual_oss that mixes them into /dev/vdsp, then launches ffmpeg. Screen is captured by x11grab
No sound / no devices: Check cat /dev/sndstat and adjust device IDs accordingly. Script fails on su: Re-run it and ensure correct root password. Permission denied: Ensure your user is in the operator group, or run as root.
"I got tired of OBS randomly breaking my FreeBSD install and PulseAudio being a parasite. So I wrote this script that uses only ffmpeg, OSS, and good old Unix principles."
This project is for minimalists, tinkerers, and FreeBSD loyalists who want to stream without the overhead.