Bug report: RMQ1 snapshot failed(with logs)

(Generated by Claude)

Snapshot API permanently broken after ~90s post-boot on GL.iNet KVM (RMQ1 / USB-C model)

Summary

On the RMQ1-based GL.iNet KVM (the USB-C-capture model), the /api/streamer/snapshot
endpoint stops returning a valid JPEG shortly after boot and never recovers until the
device is rebooted again. The response still comes back as HTTP 200 with
Content-Type: image/jpeg, but the body is actually raw H.264 bitstream data (starts
with an H.264 NAL start code 00 00 00 01), not a JPEG. This makes the snapshot
feature unusable in normal operation.

For comparison, an RP1PE-based GL.iNet KVM (POE model) on a newer firmware(1.10 beta) build does
not show this problem — the same underlying transient event occurs, but its snapshot
pipeline recovers cleanly afterward.

Environment

  • Affected device: GL.iNet KVM, RMQ1 board (USB-C capture model)
  • Firmware: rmq1-1.8.2-release1-1-g10bb9ef3e6 (Buildroot 2024.02)
  • Working comparison device: GL.iNet KVM, RP1PE board (POE model), firmware
    rm10-1.10.0beta2-23-gf1b6431ceb
  • Both devices are on the same LAN, same client software used to query them.

Steps to reproduce

  1. Reboot the RMQ1 KVM.

  2. Call GET /api/streamer/snapshot (with valid auth) any time after boot.
    In practice this reliably returns corrupt data — there is at most a very
    narrow window (under ~100 seconds of internal streamer uptime) immediately
    after boot where a real JPEG can be returned, and it is not reliably
    reachable in normal usage (e.g. opening the URL in a browser already takes
    long enough to miss it).

  3. Inspect the response: HTTP 200, Content-Type: image/jpeg, but the body is
    raw H.264 data (starts with an H.264 NAL start code 00 00 00 01), not a
    decodable JPEG. The response also carries this diagnostic header:

    x-ustreamer-snapshot-method: stream-buffer
    

    stream-buffer means ustreamer is not reading from the dedicated
    JPEG/snapshot hardware channel at all — it is falling back to whatever is
    currently in the live H.264 stream's buffer and mislabeling it as JPEG.

  4. This persists on every subsequent request until the device is rebooted,
    at which point the same narrow-window behavior repeats.

Root cause (from on-device logs, /userdata/log/kvmd.log)

About 90 seconds after boot, the video pipeline goes through what looks like a
normal/expected transient re-sync:

resolution: no signal, deinit rv1126 encoder
...
resolution: change to 1920x1080@61, reinit vi venc
...
AX_POOL_Exit fail!!Error Code:0x800B0111
read_file model is rmq1
AX_POOL_SetConfig fail!Error Code:0x800B0115
AX_POOL_Init success!
...
get VENC data failed 1 times 0x80070222
get VENC data failed 2 times 0x80070222
get VENC data failed 4 times 0x80070222

This same resolution: no signal, deinit rv1126 encoder event also occurs on the
working RP1PE unit's logs (with a different underlying error code,
get VENC data failed ... a004800e), so the transient signal blip itself appears to
be a normal, expected occurrence on both boards. The difference is what happens
afterward:

  • On the RP1PE (working) unit, the dedicated snapshot MJPEG venc channel is
    properly re-established afterward:

    RK_MPI_SYS_UnBind vpss[0, 1] to snapshot venc[1]: 0
    vpss grp[0] chn[1] init ok (for Snapshot)
    snapshot venc chn[1] (MJPEG) init ok
    RK_MPI_SYS_Bind vpss[0, 1] to snapshot venc[1]: 0
    ...
    Snapshot successful: JPEG size=100326 bytes (from cache)
    
  • On the RMQ1 (broken) unit, the pool teardown during the reinit fails
    (AX_POOL_Exit fail!!Error Code:0x800B0111), and the dedicated snapshot channel
    never comes back — every subsequent snapshot request fails hardware capture with
    get VENC data failed ... 0x80070222, and the API then appears to silently fall
    back to serving stale/incorrect H.264 buffer content labeled as image/jpeg,
    rather than returning an error.

The live H.264 video stream itself is unaffected and keeps working fine — only the
separate hardware snapshot/MJPEG channel is impacted.

What we already tried

  • Restarting the kvmd-media service (which owns the ustreamer process) — does
    not help. The reinit-failure state appears to live in the underlying vendor SDK's
    memory pool bookkeeping (AX_POOL_*), not in the userspace process, so killing
    and respawning ustreamer does not clear it.
  • Rebooting the whole device — at best provides a very narrow window (well under
    100 seconds of internal streamer uptime, before the "no signal" reinit event
    fires) during which snapshots might work correctly, but this window is not
    reliably reachable through normal usage (e.g. loading the URL in a browser).
    After the reinit event, it breaks and does not self-recover.

Requested fix

Please have the RMQ1 firmware's video-reinit path (triggered by the transient
"no signal" resync) handle the AX_POOL_Exit/AX_POOL_SetConfig failure the same
way the RP1PE build does, so the dedicated snapshot MJPEG channel comes back up
correctly after this reinit. Alternatively, if the snapshot capture can't recover,
the API should return an error rather than silently serving corrupt data mislabeled
as image/jpeg.

Happy to provide more logs or test a candidate firmware build if useful.


Originally discussed in this thread https://forum.gl-inet.com/t/is-there-a-way-to-get-rtsp-stream-from-comet-q-kvm

Current workaround:

  # 1. On the KVM, grab one key frame from the live H.264 stream's memsink (not the broken JPEG channel)
  ssh KVM-USB-C "timeout 5 ustreamer-dump --sink kvmd::ustreamer::h264 --count 1 --output /tmp/frame.h264"

  # 2. Copy it back (note: -O is required — the box has no sftp-server, only the legacy SCP protocol)
  scp -O KVM-USB-C:/tmp/frame.h264 ./frame.h264

  # 3. Decode locally with ffmpeg
  ffmpeg -y -i frame.h264 -frames:v 1 screenshot.jpg

Hello, currently there is no such feature in version 1.8, and we will to consider adding it in version 1.10

oh cool. Btw the camera would be another nice feature to see. Thanks!

Sorry,the chip on this model doesn't support camera features for now.

Is this a hardware limit? Or will camera be supported in the future?

Snapshot will be supported in v1.10. Camera support is currently limited by the hardware, so it's not supported for now.