Some may be surprised to learn that Icecast can do video, but it does it quite well. Since it's rock-solid stable, free, powerful, small, and ubiquitous across the net, I've built my setup around it. This article is the result of months researching and testing in Firefox, Chrome, VLC and more.
Important!
This is about running server software directly from your own computer. It's not recommended for slow PCs, slow internet, or lots of users. Running a server requires Port Forwarding through your router. This setup requires an Internet upstream speed of at least 10 Megabits per second (Mbps), per user — that's 100 Mbps for 10 users.
This is my most commonly used setup, i.e. 1080p at 30 fps with 5.1 surround sound, but sometimes I do plain stereo or even 4k at 60 fps by tweaking these numbers.
Of course, this uses Free and Open Source Software (FOSS) because that's how I roll.
Strap in and good luck! You can do this!
Port forwarding is different for every router, so you'll need to work that out with the manufacturer's documentation. The default port for Icecast is 8000, so that's a place to start.
Icecast Media Server https://icecast.org/download/ Beta: https://icecast.org/news/icecast-release-2_5-beta1/
Icecast is very popular. I'm using a test version, 2.4.999.1 (aka 2.5.0 RC1) for Windows, which is pretty solid, but the old 2.4.4 version works great too. There are several places that I've found information, and the excellent nerds on the #Icecast IRC channel on Libera Chat (webchat) have been very helpful in my journey — very techy.
Open Broadcaster Software (OBS) https://obsproject.com/download
OBS is also very popular and actively cared for.
Icecast, in the icecast.xml file:
https://icecast.org/docs/icecast-latest/ (Official docs)
In addition to standard stream settings, either in the applicable <limits> or <mount> section, add/replace these 2 lines. Burst size is how much data (Bytes) each player is given at the start — I shoot for 4 seconds-worth. Queue size is how much data is allocated for each player — it must be larger than burst size and about twice that. If a player lags behind more than this, their playback stops. These two settings can affect how the player handles buffering — it's a tricky thing, especially for Chrome.
- <queue-size>6640000</queue-size>
- <burst-size>3320000</burst-size>
- <stream-name>Show Name</stream-name>
- <stream-description>Show Description</stream-description>
- <stream-url>Show URL</stream-url>
- <genre>Show Genre</genre>
Settings >
> Audio > General:
- Sample Rate: 48kHz (Required by some codecs.)
- Channels: 5.1 (Fewer == less overhead.)
- Base (Canvas) Resolution: 1920x1080 (Lower == less overhead.)
- Output (Scaled) Resolution: 1920x1080 (Better done here than in the Output > Recording below.)
- Common FPS Values: 30 (Lower == less overhead.)
- Type: Custom Output (FFmpeg)
- FFmpeg Output: Output to URL
- File or URL: icecast://username:password@host:port/mount (From icecast.xml.)
- Container: webm
- Muxer settings (Space separated prop='val', single quotes only. Only content_type is required, the others are optional and can be set here or in Icecast above.) Here's the full string entry:
content_type='video/webm' ice_name='Show Title' ice_description='Show Description' ice_genre='Show Genre' ice_url=www.UruTunes.com ice_public=1 - Video bitrate: 6000 Kb/s (Lower == less overhead.)
- Rescale: [ ] (No; better done in Settings > Video above.)
- Keyframe interval (frames): 60 (Double the FPS number for 2 seconds; higher == fewer keyframes and less overhead but more latency.)
- Show all codecs: [x] (Yes.)
- Video Encoder: av1_nvenc - NVIDIA NVENC av1 (This is NVIDIA'S hardware encoder; if you have an AMD GPU you should try: av1_amf - AMD AMF AV1. If neither of those work, a good software encoder is the default: libvpx-vp9 - libvpx VP9.)
- Audio bitrate: 512 Kb/s (Lower == less overhead; 512 is good for 5.1 but 96 will do for stereo.)
- Audio Encoder: Disable encoder (Yep, none. Using a hardware video encoder above seems to handle the audio as well, but the audio bitrate above still matters, so set that first then disable this — strange thing. If your hardware's video encoder doesn't provide audio, choose libvorbis - libvorbis here.)
NOTE: I discovered that libopus doesn't work in VLC for playback, so I changed to libvorbis which seems to work across all playback cases. However, as of this writing, Firefox actually has a bug in their libvorbis decoder that mixes up audio channel assignments — I've reported it and they're working on it.
As always, if you have any questions or input, please let me know.