# Call Video Guide — H.264 over the native calls engine (BETA) Companion to [`call-audio-implementation-guide.md`](./call-audio-implementation-guide.md). The audio plane is production-validated; **video is BETA** until proven against a real WhatsApp video call (the engine's media path still carries `NOT VALIDATED` markers). The engine (`meowcaller` fork under `whatsmeow-private/calls`) carries **encoded H.264 Annex-B** over the WhatsApp relay. It does **not** encode or decode pixels — an external codec (the browser's WebCodecs, ffmpeg, a hardware encoder) produces and consumes the H.264. --- ## 1. Wire format - **Codec:** H.264, **Annex-B** byte stream (NAL units prefixed with the start code `0x00 0x00 0x00 0x01`). - **Framing:** one WebSocket **binary** message = one access unit (one frame's NALUs), reassembled on the RTP marker bit inbound. - **Keyframes:** send an IDR/keyframe immediately after opening the socket and at a sensible GOP interval (~every 1–2 s). The peer cannot decode until it sees a keyframe; a decoder cannot configure until it sees the SPS. --- ## 2. Endpoints | Method | Path | Purpose | |---|---|---| | `GET` (WS) | `/call/{call_id}/video/stream?token=…` | Bidirectional H.264 Annex-B | | `GET` (SSE) | `/call/{call_id}/video/state?token=…` | Peer camera on/off + orientation | Video is opened **in addition to** the audio socket (`/call/{call_id}/stream`) for a call placed or answered with video (`dial { video: true }`). ### 2.1 `/video/stream` (WebSocket) - **Server → client** (binary): the peer's video as Annex-B access units. - **Client → server** (binary): your camera video as Annex-B access units; the engine forwards them to the peer. Do **not** send raw frames, JPEG, or WebRTC tracks. - **Backpressure:** the server buffers outbound frames and **drops the oldest** when a slow client falls behind (newest-wins) — it never blocks the media loop. One video subscriber per call (last wins). - **Outbound camera state:** on your first sent frame the engine announces your camera active to the peer (`