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
Frame 21 is lost. The typical player shows 9 broken frames. The gate holds the last clean picture for 0.67 seconds, then starts again at the next IDR.Four seconds at 15 fps, one IDR a second. Click any frame to lose that one instead.

#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

H.264, one object per frame

USB radio stick

reassemble, repair

Decoder

clean GOPs only

The Pi encodes a test pattern with its clock burned into the picture. Each frame becomes one object, cut into pieces small enough for the radio. A USB stick on the laptop puts them back together. A broken GOP is dropped before the decoder sees it.

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

330 seconds per run, antennas about a meter apart. Encrypted runs use rind.

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

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

Radio bench at 180 kbit/s.

#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

MeasureEarlierThis build
Encoder delayPi hardware encoder to x264~275 ms20 to 24 ms
Frames not shown, repair data onStick firmware v3 to v41.5%0.28%
Frames not shown, repair data offStick firmware v3 to v46.2%4.8%
Original firmware and softwareStock stick firmware, a send path without MoQ framingNot measured under the same setup
Pi to laptop, 300 kbit/s radio, 330 seconds per run. "Earlier" means an earlier version of my own code, not the stock one.

#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

CheckCamera 1Camera 2
Frame rate, typicalPassPass
Frame rate, worst stretchPassPass
Stayed connectedPassPass
No reconnects or gapsPassPass
Oldest picture shownPassPass
Picture age, slow endMissPass
Latency, slow endMissNot measured
Both cameras ran the full ten minutes over MoQ. Two checks missed and one was not measured. Status: launch is no.

#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

  1. 01

    Encoder

    TodayRaspberry Pi 2

    Low-latency H.264

  2. 02

    Contribution link

    TodayFSK radio, Wi-Fi

    Freezes cleanly on loss

  3. 03

    Router

    TodayXIAO relay and desk

    The desk copies the feed for many viewers

  4. 04

    Monitor wall

    TodayDesk grid

    Every tile graded

  5. 05

    Tally and control

    TodayCommand tracks

    Small tracks beside the picture

Each card names a box in a broadcast chain, then what stands in for it on my benches. Later notes take them in this order.

Built on MoQ from moq.dev and the rind crypto library. This is independent hobby work, not affiliated with or endorsed by either project.