- modules/Screen_Record/wgc_source.jai: the screen through Windows.Graphics.Capture, with
hand-written bindings for its WinRT interfaces (capture item interop, item, free-threaded frame
pool, frame, session 1-3, IDirect3DDxgiInterfaceAccess, IClosable). A small COM handler on
FrameArrived sets an event per frame; when Windows refuses it the pool is polled each
millisecond. The cursor is drawn by Windows; the yellow border is turned off where the system
allows (Windows 11). A screen that changes size makes the pool again. WinRT's own calls are
loaded from combase.dll at run time: runtimeobject.lib names no DLL for #library.
- capture_gpu.jai: what both sources share (the device on the screen's adapter, the region copy,
the staging ring), so each is only "the next image's region into a texture".
- Record_Options.capture: AUTO (Desktop Duplication, else Windows.Graphics.Capture when it says
fall_back), DXGI or WGC. Sources open on the capture thread, as WinRT objects belong to their
apartment; record_start waits for it to say how that went. Record_Options.testing simulates the
two-GPU failure, forces polling, or keeps the border, for record-probe.
- record-probe: -capture auto|dxgi|wgc, -simulate-unsupported, -poll, -border-test with
-keep-border as its control, -cursor-test; DPI awareness set already is no longer reported as
a failure.
- On the RTX 5080 laptop: auto falls back on the simulated failure; WGC records 4K at 60 fps with
nothing dropped; its cursor and the one cursor.jai draws for duplication are the same; the
border is off for an unpackaged app (0 yellow edge pixels, 14,214 with it kept);
WDA_EXCLUDEFROMCAPTURE is respected; polling holds 30 fps. The plan records the results.
- README: Screen_Record's line, which held a carriage return in place of "\r" since 0.1.3.
- modules/Screen_Record: a region of one screen to H.264 in a fragmented MP4. A capture thread
duplicates the screen (DuplicateOutput1, else DuplicateOutput) on a D3D11 device of its own on
the screen's adapter, copies the region on the GPU, reads it back through three staging
textures and draws the cursor in (colour, masked colour and monochrome shapes). An encoder
thread feeds FFmpeg: h264_nvenc, else h264_amf, h264_qsv, h264_mf, libx264, each tried in turn;
BGRA straight to NVENC, swscale to NV12 or YUV 4:2:0 (BT.709) for the rest. A frame is sent
when the screen or cursor changed and its turn on an fps schedule is due, with a repeat each
second of an unchanged screen; the encoder falling 8 frames behind drops the oldest. A lost
duplication (mode change, secure desktop) is made again and recording goes on. record_start
says fall_back when duplication cannot run (unsupported, too many, rotated screen). Regions
under 240 x 180 are refused, then sizes are rounded down to even; a process whose view of the
desktop is scaled is refused.
- tools/record_probe.jai (jai first.jai - record_probe): lists the screens, records a screen or
region and reports source, encoder, frames captured, sent, written and dropped, time per stage
and file size; -legacy, -cuda, -exclude-test, -animate, -snapshot DIR, -check FILE.
- On the RTX 5080 laptop: 60 s of 4K at 30 fps, 1802 frames, none dropped, 18 MB a minute; every
change kept at 60 fps; plain DuplicateOutput works when DPI aware; a CUDA context changes
nothing; WDA_EXCLUDEFROMCAPTURE is respected; QSV, Media Foundation and libx264 keep up too;
a recording killed mid-way still plays. The two-GPU failure was not reproduced: the screens are
on the NVIDIA GPU in this mode. The plan records the results.
- video-capture-plan.html: recording a region of one screen to H.264 MP4 and into the library as a
video .mcap. DXGI Desktop Duplication first, on a device of its own on the screen's adapter;
Windows.Graphics.Capture when duplication cannot run (two GPUs, rotated screens, too many
duplications). Encoders tried in turn: NVENC, AMF, QSV, Media Foundation, libx264, from the
FFmpeg already shipped. Ctrl+PrintScreen opens the overlay in a video mode (a 240 x 180 minimum,
kept to one screen) and stops the recording. Five phases, the first a command-line probe that
answers the two-GPU question on the laptop.