Repository navigation
viewer: open GStreamer Matroska and SkyViper MP4 recordings - #75
Conversation
Previous review (2026-11-12)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Looks good overall: the NUL-padded Matroska codec IDs and empty MP4 sample skipping work, with correct timestamps and the new tests passing, but two nonblocking issues are worth addressing. Should fix
Minor (1)
|
Previous review (2026-11-12)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Not ready to approve yet: the pts-gap pacing introduced one small regression, and one rare pacing case remains. Since the last review, 5bb7d97 fixed the default-size-0 fragmented MP4 issue, and 4731945 now holds frames for the full pts gap across skipped samples. Should fix
Minor (1)
Withdrawn: trailing empty samples shortening Not fully reviewed: real SkyViper/GStreamer recordings, browser playback, Node 24 and the production build were not exercised. |
GStreamer's matroskamux terminates CodecID with a NUL, which EBML allows (RFC 8794 section 7.4), but the viewer kept it, so the codec wasn't recognised and recordings made with matroskamux, e.g. from an RTSP stream, failed with "No supported Matroska video track". Read the codec ID up to its first NUL.
The SkyViper's recorder keeps a constant frame rate by writing an empty sample for each frame its encoder missed: a recording whose encoder stalled for 0.4s as it started had 12. ISO BMFF allows empty samples, and ffmpeg skips them, but the viewer took one for a sample outside the file and rejected the whole recording. Skip them, keeping their time, so the frames after them stay at the right time.
…eal samples Fragmented MP4 still rejected an empty sample, unlike classic MP4 since the last commit: skip them the same way, keeping their time. Both paths took the track's default frame duration from the first sample even if it was empty, so an empty first sample with no duration left the frame rate unknown. Take it from the first sample kept.
A trun with no per-sample sizes takes the trex default, and if that is 0 a 16-byte trun could describe millions of empty samples, all indexed without yielding a frame. Reject a size of 0 unless the sample gives it itself, as all files did before empty samples were skipped.
Playback showed each frame for the previous frame's duration. A recorder that skips frames (writing empty MP4 samples, now skipped) leaves gaps in the timestamps that no frame's duration covers, so playback ran fast across them. Hold each frame until the next one's presentation time, falling back to the frame duration for the last frame or one whose successor isn't indexed yet.
…index's end Pressing play before any frame had been decoded read state.frame.pts from null, threw, and left the button showing Pause. And when the frame shown was the newest one indexed, its hold fell back to the frame duration and wasn't revisited, so a gap at the end of an index batch played in one frame time. Guard the frame, and while the next frame isn't indexed keep looking for it every 50ms, holding for the real gap once it arrives.
4731945 to
9ad67fb
Compare
Previous review (2026-11-13)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Close: the null-frame crash is fixed, and only two minor pacing cases are left, both seen only while playback has caught up with indexing. Since the last review, 9ad67fb fixed the Minor (2)
A fix for both: keep polling while Still withdrawn: trailing empty samples shortening Not fully reviewed: real SkyViper/GStreamer recordings, browser playback, Node 24, the production build and the terrain-elevation test were not exercised. |
While indexing was still going, the hold loop stopped looking once the next frame was known, or once the fallback hold ran out. So a gap frame indexed after the fallback hold played early, and an earlier B frame a later batch sorted in ahead of the known next frame was shown late. Keep checking every 50ms until indexing is finished, there is no frame, or a next frame exists and is due.
Previous review (2026-11-13)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Nearly there: the remaining pacing issues are fixed, and one optional minor point is left. Since the last review, 97ea617 keeps polling while indexing. That fixes both the late-frontier gap frame playing early and the inserted B frame showing late. Minor (1)
Still withdrawn: trailing empty samples shortening Not fully reviewed: real SkyViper/GStreamer recordings, browser playback, Node 24, the production build and the terrain-elevation test were not exercised. |
Play showed the next frame at once, so a gap after the frame on screen (frames the recorder skipped) was jumped over rather than held. Hold that frame until the next one is due, timed from the press, before moving on, as for every other frame.
Previous review (2026-11-15)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Nearly there: one optional minor point is left. Since the last review, 6cd97cb holds the frame on screen when Play is pressed, so a gap right after it is no longer skipped. Minor (1)
Still withdrawn: trailing empty samples shortening Not fully reviewed: real SkyViper/GStreamer recordings, browser playback and Node 24 were not exercised. |
Once a recording was fully indexed, the wait for the next frame was one setTimeout, so changing Speed in a long gap had no effect until the gap ended. Wait in steps of at most 50 ms, working out again each time, as while indexing.
Previous review (2026-11-15)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Nearly there: one optional minor point is left. Since the last review, a13a3ed rereads Speed during a held gap, so a Speed change now takes effect straight away. Minor (1)
Still withdrawn: trailing empty samples shortening Not fully reviewed: real SkyViper/GStreamer recordings, browser playback and Node 24 were not exercised. |
A Speed change during a held gap rescaled the time already played, since the wait divided the whole hold by the new speed. Add up the media time shown instead, each poll's wall time at the speed in force during it, so a change applies only from when it is made.
Previous review (2026-11-15)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head One should-fix playback point is left. Since the last review, a962d37 fixed the Speed-change rescaling: a held gap now counts its time at the speed in force. Should fix
Still withdrawn: trailing empty samples shortening Not fully reviewed: real SkyViper/GStreamer recordings and browser playback were not exercised. |
Pressing Play while a forward seek was still decoding held the old frame against the next frame of the new position, so playback waited about as long as the seek jumped. Start the hold again when the frame shown changes.
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head No open findings remain at df681ee. Since the last review, df681ee fixed the stall when Play is pressed while a forward seek is still decoding: the hold now restarts from the seek's frame (main.js:1388). Still withdrawn: trailing empty samples shortening Not fully reviewed: real SkyViper/GStreamer recordings and browser playback were not exercised. |

The viewer rejected two kinds of recording that ffmpeg reads without
complaint.
Matroska from GStreamer: "No supported Matroska video track"
GStreamer's
matroskamuxendsCodecIDwith a NUL (V_MPEG4/ISO/AVC\0).EBML allows string elements to be NUL-padded (RFC 8794 section 7.4), but
the viewer kept the NUL, so the codec ID didn't match any it supports and
the video track was dropped. This affects any MKV recorded with
rtspsrc ! rtph264depay ! h264parse ! matroskamux.The codec ID is now read up to its first NUL. It is the only Matroska
string the viewer reads.
SkyViper SD-card MP4: "MP4 sample outside file"
The SkyViper's recorder keeps a constant frame rate by writing an empty
sample for each frame its encoder misses. One recording whose encoder
stalled for about 0.4 s just after recording started had 12 of them.
ISO BMFF allows empty samples, and ffmpeg skips them, but the viewer took
an empty sample for one outside the file and rejected the whole recording.
Empty samples are now skipped, and their time is kept, so the frames
after them stay at the right time. This applies to fragmented MP4 as well
as classic MP4. The track's default frame duration now comes from the
first sample kept, so an empty first sample with no duration doesn't
leave the frame rate unknown.
Testing
New tests in
tests/media-containers.test.js:the second frame's PTS and packet;
no duration, checking the default frame duration;
timestamps, keyframe flag and packet.
npm teston Node 24: everything passes exceptterrain-elevation.test.js, which needscesiumand wasn't installed.That test doesn't touch this code.
prettier --check src testspasses.I ran the parser on real recordings, all H.264 with APCG telemetry SEI
on every frame: