School Announcements on Ice(cast)
The streaming needs of schools are modest relative to those of many other institutions, especially when it comes to live streaming. The highest-profile live streams a school would expect to see are likely commencement ceremonies, policy presentations, and a few distinguished speakers. In my many years supporting educational video, the largest audience for a live stream was 1,400 concurrent viewers (the awards ceremony for the Science Olympiad nationals from 2010), an audience that was easily handled by a cluster containing just two edge Flash Media Servers. While the audiences are small, they're important: We don't want a parent who couldn't make the trip to graduation to miss their student's name being called or a donor to miss their recognition because of a poor stream.
Aside from these events, there are surprisingly few uses for traditional live streaming in support of K–12 schools' core educational missions. However, I recently consulted on an interesting one: the morning announcements at an elementary school. Rather than using the venerable intercom system, this school has students provide a newscast-style live stream that is projected into all of the classrooms. This used to be done via closed-circuit television, but when that system aged out, the teachers improvised technologies and made very smart choices in the transition to a streaming media solution.
By the time I became involved, they were using OBS Studio to publish the stream to a commercial host that would stream to classroom smartboards. The teacher running the show wanted to explore an on-prem media server to eliminate the non-trivial hosting costs, and although the stream was well-secured, the teacher was uncomfortable having the video feed of elementary school children sent off-prem and back. The teacher also wanted to see if the latency in the stream could be reduced: The streaming vendor had followed industry trends and adopted a fairly traditional HTTP Live Streaming (HLS) model that pushed latency well past 30 seconds—long enough that it was causing confusion for the students.
The ideal solution would be no cost, on-prem, low latency, adequately robust for a broadcast to a maximum of 30 clients without last-mile concerns, and simple enough to work reliably, both for the students publishing the broadcast and the classroom teachers playing it.
At least one of these features would need to be compromised: After weighing the performance benefit of deploying a WebRTC-based solution such as Janus or Kurento against the difficulty of maintaining and troubleshooting an open-source product that's primarily being developed for live interactive services rather than as a broadcast streaming server, it was clear that latency was not going to be as low as with the school's CCTV solution. I recommended perhaps the oldest media server still in widespread use: Icecast. Icecast is typically thought of as an audio-only streaming server, but it can also stream WebM video to HTML5 video elements natively in modern browsers.
Tuning Icecast for low latency requires essentially the same considerations as tuning HLS for low latency: You need to minimize video stored in buffers, with the trade-off that overall streaming reliability will be less robust. The only thing you can do is to adjust the burst size for your broadcast's mount point. Burst size is roughly the same as fragment size in HLS and directly relates to latency since it defines how much video data needs to accumulate before being sent to the client. The default for Icecast is 64Kbps, a very small amount of server-side data buffering before sending to the clients. The real trick for low latency in Icecast is to use a short GOP length at the encoder. In my tests using a range of school-budget hardware, I could consistently get latency of around 4 seconds with tolerable picture quality by setting the keyframe interval in OBS Studio to twice the frame rate: Firefox's <video> element appears to want a buffer containing two keyframes before it will start playing the video. For the full nuts and bolts of how to do this yourself, see my repository for the project at github.com/liamgm/SchoolAnnouncements.