Repository navigation
video: combined RGB and raw thermal Matroska stream - #57
Conversation
The sandbox, stdin/stdout wiring and descriptor closing done in a forked ffmpeg backend move to video_backend_child_init(), so another backend can use them. No change in behaviour for RTSP, RTMP or RTP.
A viewer asking for /mux/A,B on the port of slot A gets one live Matroska stream with two video tracks: slot A's MPEG-TS video and slot B's raw thermal (FFV1) stream. The mux runs only while it has viewers. A second sandboxed ffmpeg remuxes slot A without transcoding, and its output is walked as EBML, so no codec bitstream is parsed here. Thermal BlockGroups are copied with their BlockAdditional telemetry unchanged. Each frame is one Cluster, with strictly increasing millisecond timestamps, in the mux's own ring; viewers are ordinary viewers reading that ring. Access is by viewer password or open viewing. A slot token is not accepted, as it names one slot.
Previous review (2026-12-01)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head One nonblocking issue: a raw-thermal reconnect that changes only the TrackUID ends the combined stream. Everything else checked out, including the build, selftests and fuzzing, the mux tests and the viewer auth paths. Should fix
Not fully reviewed: the real MT11 thermal publisher (whether it varies TrackUID), VFR/HEVC/real RTSP sources across remuxer restarts, and playback in the external flight viewer. Head moved during review: observed |
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head No open issues remain at 780d5b1, which this review covers in full. Since the last review (at 975afde), the TrackUID reconnect issue has been fixed. A raw-thermal publisher that reconnects with the same format but a new TrackUID or track number now carries on: the head check compares a normalised format (videomux.cpp:856), and blocks are renumbered to the advertised track (videomux.cpp:331). The updated reconnect test (tests/test_video_mux.py:565) fails against 975afde and passes here. The full mux and video-page suites pass (95 tests). The rest of the update also checked out: the HTTP wait before 503, pair switching, malformed /mux/ paths, the remuxer pipe's EPOLLOUT feed and the B-picture detection. As before, these were not exercised: the real MT11 camera, VFR/HEVC/real RTSP sources across remuxer restarts, and playback in the external flight viewer. |
Summary
An entry whose camera publishes RGB video to one video slot and raw thermal (FFV1 Matroska) to another can now serve both as one live Matroska stream with two video tracks. A viewer asks for
/mux/A,Bon the port of slot A, over HTTP or WebSocket, for examplewss://HOST:PORT/mux/1,3.This lets a browser viewer show RGB with the thermal picture inset from one connection, and save one file holding both. The camera's uplink is unchanged.
How it works
ffmpegchild remuxes slot A's MPEG-TS to Matroska without transcoding. The proxy walks that output as EBML, so it still parses no codec bitstream. The sandbox and descriptor handling are the existing RTSP backend's, moved into a shared function (first commit, no change in behaviour).V_FFV1track, millisecond timestamps).VideoViewerobjects that read the mux's ring; lapping, back-pressure and stall handling are unchanged. A slot's stream ending does not drop them: the other track carries on, and RGB resumes at a keyframe.The README has the full behaviour, including the limits (one pair per entry, 8 viewers, no B-pictures, not recorded).
Testing
--selftest-videogains a selftest and a fuzz run for the EBML walker, the thermal profile check and the clock.tests/test_video_mux.py(12 tests) drives a live H.264 encoder and a synthetic thermal publisher through the proxy. It checks the two tracks, thermal BlockGroups byte-identical to those published, keyframe start, strictly increasing timestamps, refusals (404, 409, 401, 503), password and token handling over HTTP, WebSocket and TLS WebSocket, thermal and RGB publisher restarts, a killed remuxer recovering without repeating a frame, and B-pictures refused.test_video_view,test_video_matroska,test_video_rtsp,test_video_child,test_video_ingest,test_video_record,test_video_rtsp_view) passed on the first version of this branch: 171 passed, 1 skipped. They have not been re-run since the review fixes below; the mux tests have.Not in this PR