docs / research

11 β€” Screen capture: how the vendor tool works, what it can capture, HDR

Measured on a 55U61KEVS (retail 55U7KQ, MTK9618, V0000.09.62C.Q0924) over the root-SSH lane, 2026-11-14/15. Other MTK models ship the same tool (tools/screenshot.sh was written on the 50A51HUV); the internals below were read from this unit's binaries and may differ elsewhere.

Boundary: this documents taking a picture of what the TV shows, on a TV you own, with the manufacturer's built-in capture tool. Nothing about the TV's content protection is changed or bypassed, and protected (DRM) video is not captured: see below.

How it works

/dev/fb0 has no readback path (read()/dd return ENODEV; it is mmap-only), so /usr/local/bin/screenshot is the lane:

/usr/local/bin/screenshot <dir> <name> [capture_type]     (returns in ~0.09 s, async)
  └─ sysctrlservice RPC  cmdCaptureScreen(path, name, CaptureType)
       └─ sysmain  (/mnt/tvroot/usrlocal/bin/sysmain): "screencapture" worker, queue + timeout
            └─ ki::port::ScreenCapture  (libkiport)
                 └─ libHui  HUI_ScreenCapture β†’ MediaTek Mif/MTVSS capture from the display pipeline
            └─ libpng  generatePNG β†’ <dir>/<name>, 8-bit RGBA PNG (whatever the extension says)

The capture types, from the vendor debug-shell help text in libkiport (screencapture <capture_type>), match libHui's E_MIF_SCREENCAPTURE_*:

type captures
1 VIDEO_MAIN β€” main video window only
2 VIDEO_SUB β€” PIP window
3 OSD β€” UI layer only
4 VIDEO_OSD β€” video + UI, as on screen (what the default produced)

screenshot /tmp x.jpg 1 was accepted (a different frame) and still came out at 1920Γ—1080. Width, height and colour format are parameters of the HAL call, but sysmain fixes them; the CLI has no size option. The panel is 4K, the capture is always 1920Γ—1080.

Not the same thing: the capture daemon (/usr/local/bin/capture, uid 385, libcapture-screen, HUI_CaptureMore*) is continuous capture for the screen magnifier. Its debug dump writes to /OAD β€” never trigger it.

What can be captured

source result
Launcher / TV UI works
HDMI, SDR (Chromecast with Kodi; PC desktop) works, colours 1:1 (a white window reads 242/250/254)
TV's own YouTube app (main:Youtube) works (video + YouTube's controls, owner screenshot 2026-11-15). Two earlier attempts during a slow app start, screen mostly black, produced no file at all; cause unknown, not reproduced (possibly protected video starting, as below; unverified)
Crunchyroll app (main:206\|2372) menus work. During video playback: no file at all, not even the UI layer (2 of 2 attempts, 2026-11-17; nothing in dmesg)
Netflix / other DRM apps, live TV not tested

Video is captured however it is decoded, because the frame comes from the display pipeline, not from an app's framebuffer, except protected video: while DRM-protected playback is on screen, the whole request is refused and no file is written, most likely by the secure video path. That is the TV's content protection doing its job; nothing here works around it.

HDR comes out raw

With an HDR source the PNG holds the signal on an HDR (PQ) curve, not tone-mapped, squeezed into 8 bits: it looks flat and dim. Evidence: white subtitles burned into an HDR film measure ~150–160/255 (β‰ˆ200–350 nits on the PQ curve); in SDR they would be ~235–255.

setparams=color_primaries=bt709:color_trc=smpte2084:colorspace=gbr:range=pc, zscale=t=linear:npl=100,format=gbrpf32le, tonemap=tonemap=mobius:param=0.5:desat=0, zscale=t=bt709:m=bt709:r=pc,format=rgb24

Hable was too dark. A PS5 game in HDR looked closer raw, so keep the raw PNG. - No readable HDR flag was found. /proc/xc/hdr_type stays empty even during HDR playback. /proc/utopia_mdb/HDMIRX (MDB debug node; the vendor getlog scripts cat it and read dmesg) printed nothing, also after the vendor's own echo hdmiloglevel REGEN (a log level, resets at reboot). HDR metadata exists only inside vendor processes (ki::port::HdrMetadata). A frame-based test works on every capture tried: SDR frames reach full white somewhere (brightest 0.1% of pixels β‰₯ 247), HDR captures do not (≀ 201); threshold 215. A very dark SDR scene would be misread.

Timing

Measured with a millisecond clock page on a PC, synced to the machine sending the request:

step time
SSH connect until the TV command runs ~0.2 s
request β†’ frame grabbed, TV idle (incl. PC render + input lag) ~0.11 s
frame β†’ PNG complete 1.7 s (mostly black) to 3.6 s (busy picture) β€” compression only

The captured moment is fixed ~0.1 s after the request; the slow part is writing the PNG and does not move it. The PNG appears in one step: polling every 10–20 ms never saw a partial file (four runs, end marker IEND present at first sight), so sysmain encodes first and writes or renames at the end. phone-shot.sh still waits for IEND rather than trusting a fixed delay. From an iPhone Shortcut ("Run Script Over SSH", first action β†’ frame): 316–355 ms.

Requests are queued, not parallel. Three screenshot calls 0.2 s apart came back after 2.9 s, 6.4 s and 8.6 s: sysmain keeps a queue (Capture queue is full is one of its strings) and processes one request at a time. The three frames differed a lot in size during video playback, so each frame was most likely grabbed when its turn came, not when it was requested (inferred, not measured with the clock page). Consequences:

Tools

Binaries cannot run from /var/local on this unit (Permission denied; scripts there need /bin/sh <script>), so shotconv goes to /APPS/.re_sshd/.