Camera stream processing
Updated: Oct 28, 2026
Before the Meta Wearables Device Access Toolkit delivers a
camera stream frame to your app, the glasses crop the sensor image to a 9:16 frame, correct lens distortion, stabilize the image, and compress the video with High Efficiency Video Coding (HEVC, also known as H.265), lowering the resolution when bandwidth drops. If your app measures, tracks, or aligns what the camera sees, this processing affects the field of view, the frame size, camera calibration, and alignment with motion data.
Copy this prompt into your AI coding tool to adapt your frame analysis to stream processing:
>_Adapt frame analysis to camera stream processing
Use https://wearables.developer.meta.com/docs/develop/dat/camera-stream-processing/, then use the Wearables MCP endpoint https://mcp.developer.meta.com/wearables to call search_dat_docs for current Device Access Toolkit camera stream guidance. Inspect my frame-processing code first, then make the smallest change that reads each frame's actual size instead of the requested resolution, uses a camera calibration measured on stream frames rather than photos, and scales the calibrated focal length and principal point by each frame's width divided by the calibration width. Do not assume the SDK reports intrinsic camera parameters, and run the relevant local checks.
A stream frame covers a narrower field of view than a standalone photo, because the stream crops the sides of the sensor image to fit a 9:16 portrait frame. When your feature needs the widest view of the scene, capture a
standalone photo instead. While standalone photo capture is in beta, apps that use it cannot be published. Stream and Photo cannot use the camera at the same time, so stop the stream before you start standalone photo capture.
Every frame size the stream delivers covers the same field of view. A lower resolution scales the image down rather than cropping it.
By default, the SDK decodes the video on the phone and delivers YUV frames (compressVideo = false on Android, VideoCodec.raw on iOS). To record or forward the video without decoding it, receive the HEVC frames instead:
- On Android, set
compressVideo = true in StreamConfiguration. - On iOS, set
videoCodec to .hvc1. HEVC frames keep arriving while your app is in the background; .raw frames stop.
Read the actual frame size
Because the glasses can lower the resolution of a running stream, a frame can be smaller than the resolution you requested. Read the size from each frame:
- On Android, read
width and height from each VideoFrame. With compressVideo = true, these fields report the requested size, not the actual size, so read the size from the stream’s sequence parameter set (SPS) or from your decoder’s output format. - On iOS, use the
VideoFramesampleBuffer. For .raw frames, call CVPixelBufferGetWidth and CVPixelBufferGetHeight on its image buffer; for .hvc1 frames, call CMVideoFormatDescriptionGetDimensions on its format description.
The SDK does not report intrinsic camera parameters, such as focal length, principal point, or distortion coefficients. To get them, calibrate on stream frames rather than standalone photos, which cover a wider field of view:
- Start with a pinhole camera model, because the frames are already corrected for lens distortion. Add distortion terms if the reprojection error stays high.
- Hold the glasses still while you capture calibration frames, because stabilization moves the image when the glasses move.
- Calibrate each glasses model you support. The parameters can differ between models.
- Record the frame width you calibrated at. When a frame arrives at a different width, for example after the glasses lower the resolution, multiply the calibrated focal length and principal point by that frame’s width divided by the calibrated width.
Combine frames with motion data
Stabilization moves each frame to counter small head movements, so the image does not exactly track the head rotation that the
Motion capability reports. Visual-inertial tracking and other methods that assume a fixed relationship between the camera and the inertial sensors lose accuracy during head movement.