Files
dat-thang/docs/cable-live-streaming.md
T
divorce b735900f2e 0.0.002
ddat interop with dat js
cable interop with cabal js
ddat's frontend = dat-thang
cable fe = cable-thang
dillo support based on cel's dillo-dat
bootstrap node
xplatform support

Signed-off-by: divo <418@cryspace.space>
2026-10-19 00:17:02 -04:00

3.1 KiB

Cable live media

Cable live media travels beside Cable room chat and Dat archives. A live session is not an archive, does not append to a user's permanent chat feed, and does not advance a Dat version. It is sent as volatile Cable records over authenticated Cesspool/uTP peer sessions. The current audio path fans packets out from the broadcaster to authenticated room peers; multi-hop relay is not yet wired.

Audio, first slice

cable-thang's BROADCAST button opens the default SDL microphone as 48 kHz, mono, signed 16-bit PCM. FFmpeg's AAC-LC encoder converts 1,024-sample frames to 96 kbps AAC and wraps each access unit in an ADTS header. The cable-live packet header carries a random session id, sequence number, GUI timestamp, media kind, and bounded payload. The C viewer validates packets, decodes AAC, places PCM in a half-second maximum SDL playback queue, and plots those decoded samples in the waveform panel. Ctrl+Shift+A toggles the local broadcast. Received room audio begins playing as soon as its start packet is seen.

Cable audio and video are experimental and disabled by default. A normal SDL build has no FFmpeg dependency. Enable both together with make ENABLE_SDL2=1 ENABLE_CABLE_MEDIA=1; the makefile requires compatible FFmpeg 5.0+ development files (libavcodec, libavformat, libavutil, libswresample, and libswscale). To build the SDL clients without compiling either media feature, use make ENABLE_SDL2=1 ENABLE_CABLE_MEDIA=0.

On Debian or Ubuntu, install the development headers and enable the feature:

sudo apt install libavcodec-dev libavformat-dev libavutil-dev \
  libswresample-dev libswscale-dev
make ENABLE_SDL2=1 ENABLE_CABLE_MEDIA=1

With media enabled, the Cable video pane can listen to a local OBS MPEG-TS output. Click OBS INPUT or press Ctrl+Shift+V; Cable listens on udp://127.0.0.1:5000, decodes the video on a worker thread, scales the local preview to at most 640x360, and displays the latest frame. New frames are reduced to 160x90 JPEG and sent in 4,000-byte fragments over authenticated Cesspool/uTP sessions; receivers reassemble and decode them in the video pane. Transmission is capped at five frames per second. In OBS, add a Custom FFmpeg Output with container mpegts, video encoder libx264, and output URL udp://127.0.0.1:5000?pkt_size=1316. OBS input provides local preview and direct broadcast to authenticated peers. Camera capture without OBS and multi-hop forwarding are not implemented.

Storage boundary

No media packets are written to .dat, test-only Cabal JSON chat feeds, or the versioned archive metadata/content feeds. Closing the room discards the decoder and playback queue. This avoids turning a live broadcast into permanent archive history. Hypervision's historic approach chunked WebM media and appended the chunks to a dedicated Hypercore feed. That is a useful precedent for chunking and peer redistribution, but an append-only archive is not the right retention policy for this live session path.

The packet kinds cover audio and video start/frame/stop. Direct camera capture, multi-hop relay, remote stream selection, and adaptive bitrate are follow-on work.