Some may be surprised to learn that Icecast can do video also, but it does it quite well. Since it's free, powerful, small, and stable, I've based this (my) setup on it. This article is the result of dozens of hours researching and testing in Firefox and Chrome.
Important!
This involves running server software directly from your own computer. It's not recommended for slow PCs or internet, or lots of users, and requires Port Forwarding through your router. Internet upload speed of at least 10 Megabits per second (Mbps), per user is recommended. That's 100 Mbps for 10 users.
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!
Icecast Media Server https://icecast.org/download/ Beta: https://icecast.org/news/icecast-release-2_5-beta1/
Icecast is very popular, but the project is quite stagnant at this point with no activity I can find since January 1st, 2015. That date refers to version 2.4.99.1 aka 2.5 Beta 1 for Windows, which I'm using and seems rock-solid, but the 2.4.4 version works great too. There are several places that I've found information, but I can't be sure what's official, and it's all pretty lacking.
Open Broadcaster Software (OBS) https://obsproject.com/download
OBS is also very popular and actively updated and cared for.
Other sites with good info:
https://icecast.org/docs/icecast-latest/ (Official docs)
https://wiki.xiph.org/Icecast_Server
https://www.radiocult.fm/blog/streaming-obs-to-icecast
https://epir.at/2018/03/08/obs-icecast-streaming/
Icecast, in the icecast.xml file:
In addition to standard stream settings, either in the applicable <limits> or <mount> section, add/replace these 2 lines. Burst size is how much (Bytes) each player is given to start. Queue is how much is buffered for (each?) player - it must be larger than burst and enough to buffer about 5 seconds.
- <burst-size>250123123</burst-size>
- <queue-size>50123123</queue-size>
OBS: In OBS, we're using the Recording function and not Streaming. It's just how OBS works.
Settings >
> Audio > General:
- Sample Rate: 48kHz (required by libopus below)
- Channels: 5.1 (for surround sound, or stereo)
- Base (Canvas) Resolution: 1920x1080
- Output (Scaled) Resolution: 1920x1080 (better done here than in the Output > Recording below)
- Common FPS Values: 24 NTSC (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 (for FFmpeg, space separated prop=val, single quotes only). 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 live=true - Video bitrate: 6666 Kb/s (lower == less overhead, 1000 is max for a 2017 PC, 6000 is recommended for 1080p@30fps and works on new gear.)
- Rescale: no[ ] (more overhead; better done in Settings > Video above)
- Keyframe Int: 48 (double the FPS for 2 seconds. Higher == less overhead but more latency; Chrome is annoyingly picky on this)
- Show all codecs: yes[x]
- Video Encoder: av1_nvenc - NVIDIA NVENC av1 This is the hardware encoder built into my GPU. Hardware is ideal if available as this has a huge impact on overhead. I have an NVidia GPU, but if you have AMD you should try: av1_amf - AMD AMF AV1 Otherwise, a good sofware encoder is the default: libvpx-vp9 - libvpx VP9.
- Audio bitrate: 960 Kb/s Lower == less overhead; 960 is plenty for surround but 96 is fine for stereo.
- Audio Encoder: NONE! (disabled) Using the hardware video encoder above covers audio as well - strange thing. Otherwise, choose libvorbis - libvorbis.
EDIT: I discovered that libopus doesn't work in VLC for playback, so I've changed this to use 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 - hopefully that gets fixed soon.
As always, if you have any questions or input, please let me know.