"""Server-side HLS encoder — produces an annotated HLS stream per camera. We spawn one ffmpeg subprocess per active camera and feed it raw BGR24 frames via stdin. ffmpeg muxes the output into MPEG-TS segments and a rolling playlist on disk. Key timing properties: - ``feed()`` is non-blocking. Frames go into a bounded queue, and a dedicated writer thread drains it into ffmpeg's stdin. This means the render thread NEVER stalls on a slow encoder — important when the YOLO inference thread is hammering the GIL. - ffmpeg is started with ``-use_wallclock_as_timestamps 1`` so frame PTS comes from arrival time rather than the assumed ``-framerate``. That makes the wall-clock duration of each emitted segment match the wall-clock arrival time of its frames, which keeps browser playback steady even when render rate fluctuates. The point is embed simplicity: clients drop ``