Note 0024 min read
Broadcast over MoQ, starting small
A broadcast chain is a row of boxes. Two small benches, a LoRa radio and a few XIAO boards, are where I am testing how many of those boxes MoQ can replace.
A broadcast chain is a row of boxes. An encoder, a contribution link, a router, a monitor wall, a tally light. Each box moves pictures on time. Each one is built to fail in a way the audience barely sees.
MoQ describes much of that job in software. I want to know how little hardware it needs. This is the first note in a series about that. It covers the two benches I have today, and what they taught me.
#A GOP is a group
MoQ moves media as tracks. A track is made of groups, and a group is made of objects.
So map one GOP to one group, starting at an IDR. Map one frame to one object. Then something useful happens. If a frame can’t be recovered, the receiver drops the rest of that group and waits for the next IDR. The decoder only sees clean reference chains.
A typical player does the opposite. It keeps decoding frames that point at a picture it never got. You see a smear until the next keyframe. On a monitor wall, a short freeze reads as a hiccup. A smear reads as a fault.
A typical player
A group gate
- IDR, a new group
- a clean frame
- lost on the air
- a broken reference
- the last picture, held
#The radio bench
The first bench sends live H.264 through a LoRa radio chip. The chip is a Semtech SX1276, the one inside most LoRa gadgets. LoRa itself is slow. The same chip also has a plain FSK mode, and that is fast enough for a small video stream.
The sender is a Raspberry Pi 2 from 2015. The receiver is a USB radio stick on a laptop. Everything between the encoder and the antenna is Rust.
Raspberry Pi 2
FSK
USB radio stick
Gate
Decoder
The sender burns its capture time into the bottom of each frame as a barcode. The receiver decodes the stream and reads the barcode back out of the picture. So the latency is glass to glass. Encode, air time, reassembly, and decode are all inside it.
One minute of video exactly as the receiver wrote it. A test pattern at 320×240, encrypted on the air.
These are the runs I filed.
Delay from camera to screen
About one frame in twenty is not shown. Each loss costs the rest of its GOP, so it shows as a short freeze. Loss also changes from run to run. An earlier pass with the same settings lost nothing.
The radio can only send 255 bytes at a time, so each frame of video is cut to fit.
From one video frame to radio frames
1 Start with a video frame
2 Add a 17-byte header
The header holds the frame number, the capture time, and a keyframe flag.
3 Cut it into radio frames, 255 bytes at most
Each has a 12-byte header and up to 243 bytes of video. The hatched one is parity: one per eight. It rebuilds any one lost frame.
about 7 radio frames per video frame
about 22 for the keyframe (IDR) each second
+20 bytes per video frame when encrypted
#Against the original
I did not measure the stock stick firmware, or a send path without MoQ framing, on this setup. So there is no number to compare them with. I won’t guess one.
What I did measure is earlier versions of this build, on the same bench. Plain and encrypted runs are side by side in the chart above.
Earlier build and this build
| Measure | Earlier | This build |
|---|---|---|
| Encoder delayPi hardware encoder to x264 | ~275 ms | 20 to 24 ms |
| Frames not shown, repair data onStick firmware v3 to v4 | 1.5% | 0.28% |
| Frames not shown, repair data offStick firmware v3 to v4 | 6.2% | 4.8% |
| Original firmware and softwareStock stick firmware, a send path without MoQ framing | Not measured under the same setup | |
#The XIAO bench
The second bench is closer to the shape of a real facility. I wrote about it in a click, a tile, and a device that answers. Small XIAO boards publish camera pictures, motion samples, and voice commands over MoQ. A laptop desk subscribes, copies each feed so more than one viewer can watch, and grades every feed against a written list of targets.
The latest long run went through both relays for ten minutes. Frame rate, uptime, and reconnects passed. Latency and the age of the picture still miss on the slow tail. The bench’s own status line is the honest one: launch is no.
Ten-minute run, pass or miss
| Check | Camera 1 | Camera 2 |
|---|---|---|
| Frame rate, typical | Pass | Pass |
| Frame rate, worst stretch | Pass | Pass |
| Stayed connected | Pass | Pass |
| No reconnects or gaps | Pass | Pass |
| Oldest picture shown | Pass | Pass |
| Picture age, slow end | Miss | Pass |
| Latency, slow end | Miss | Not measured |
#What both benches insist on
- Measure from the picture. A timestamp in a header measures the header.
- Color bars mean no board answered. A test pattern is labelled. It is never passed off as a camera.
- Every number has a file. A loopback run is not a hardware run.
- Freeze, don’t smear. Lose a frame and you lose its group.
- Stay live. The radio sender drops a whole GOP that waited too long, so the link never falls behind.
- Nothing touches a board on its own. Flashing is a step a person takes, with a written record.
#Where this goes
Each box in a contribution path has a small version on these benches. The next notes take them one at a time.
A broadcast chain, left to right
01
Encoder
TodayRaspberry Pi 2
Low-latency H.264
02
Contribution link
TodayFSK radio, Wi-Fi
Freezes cleanly on loss
03
Router
TodayXIAO relay and desk
The desk copies the feed for many viewers
04
Monitor wall
TodayDesk grid
Every tile graded
05
Tally and control
TodayCommand tracks
Small tracks beside the picture
Built on MoQ from moq.dev and the rind crypto library. This is independent hobby work, not affiliated with or endorsed by either project.