Write-up7 min read

Getting the photos off Ray-Ban Meta glasses

Every photo Ray-Ban Meta glasses take is five files, one of them a picture cut into 48 tiles. How Visor lists them, brings them over Wi-Fi Direct, and turns them into Android Motion Photos, and why the glasses' clock decides where they land in the gallery.

Ray-Ban Meta glasses have a camera in the frame, and what it shoots stays on the glasses until a phone takes it. Visor, my open-source Android app that replaces the Meta AI app, takes it by itself, while the glasses charge or when you tap Import. Once a file is safely on the phone, Visor deletes it from the glasses. That sounds like copying files. It turned out to be a list in an unusual format, a file transfer with strict manners, a photo cut into 48 pieces, and a pair of glasses that didn't know what day it was.

The capture list

The glasses keep what they've shot as captures, and they list them on service 18. The phone sends message type 1 with nothing in it. The glasses answer with one type 6 message per capture, then a type 2 to say the list is done.

Each type 6 is a FlatBuffer with no schema, so it's read by following its vtables, and the numbers below are slots in those tables rather than field numbers. A capture has a handle, which is a string, a kind, a timestamp in nanoseconds, a byte that says whether it was meant to be landscape, and a list of assets:

KindWhat it is
3073a photo
3074a video
no kind at alla live photo

Each asset has an id, which is a UUID, a size in bytes, and a type. The low byte of the type says what the asset is, and one bit, 0x100000, says it has already been delivered to a phone. Assets come in four kinds that matter:

AssetWhat it is
1a video, an ISO media file
2a still, either the 320x240 JPEG thumbnail or the full HEIC
3a motion log, starting with the letters SI
4a frame log, starting with SF

The thumbnail and the full photo are both kind 2, and only their size tells them apart. Visor sorts the stills by size and takes the largest as the photo. It also checks every value it reads, so a damaged list can't make it read past the end of a message.

Every photo is a live photo

On Ray-Ban Meta Gen 2, every photo taken since early October 2026 has arrived as a live photo. It's five files:

  • the 320x240 thumbnail, about 16 KB
  • the full photo, a HEIC of 0.5 to 1 MB
  • a clip of about 1.6 seconds, 3 to 5 MB of HEVC at 1728x2304
  • a motion log, about 2.3 seconds of the accelerometer and gyroscope at about 957 Hz, 85 KB
  • a frame log, with one record for each frame of the clip

The clip runs mostly after the shutter, and in the photos I checked, the still matched the clip's second frame. The frame log has its own small surprise. A plain photo's single frame record has a frame counter of 7, because the camera ran seven frames to settle the exposure before the one it kept.

The file transfer has manners

Files travel on service 20, which the glasses call airship. It works the same way in both directions:

  1. The sender offers a file, with its id, its size and a namespace, such as namespace_media for photos.
  2. The receiver answers with a cursor: where to start, and the adler32 checksum of everything before that point.
  3. The sender sends the bytes, and now and then asks for a check, which the receiver answers with a fresh cursor.
  4. The sender says the file is complete, with its size and the adler32 of the whole thing.
  5. The receiver answers with a drop.

The fields are Protocol Buffers, and a field that's zero isn't written at all. So the answer that means "start from the beginning" is two bytes, 10 01: the offset is missing because it's zero, and the checksum of nothing is 1.

The drop is not optional. Every offer has to end in one, whether the phone took the file or refused it, because an offer that never gets its drop stalls the glasses' send queue, and every file behind it stops too. Refusing is most of the job. The glasses also offer device logs, continuously, health figures every five minutes, and small metadata files, and the phone turns each of them down politely, one drop at a time. Visor's code for an offer starts with that rule:

MT_OFFER, MT_OFFER_MULTISCOPE -> {
    saidEmpty = false
    val f = parsed(payload)
    val offer = Offer(f.bytes(1), f.varint(2), f.bytes(3).decodeToString())
    incoming.remove(channel)?.discard()
    val taker = if (offer.namespace in ACCEPTED) null else extras.firstOrNull { runCatching { it.wants(offer) }.getOrDefault(false) }
    // Refusing still needs the drop, or the glasses' queue stalls behind this offer.
    if (offer.namespace !in ACCEPTED && taker == null) {
        if (offer.namespace !in QUIET) _notes.trySend("Refused ${sizeWords(offer.size)} in namespace \"${offer.namespace}\"")
        return Reply(MT_DROP, fileId(offer.idBytes))
    }

A file that fails its checksum still gets its drop, and the glasses then count it as delivered. So Visor remembers which ones failed, and asks for those again by name.

Two speeds

Over Bluetooth Classic, media moves at 120 to 165 KB/s, in 1024-byte pieces. Over Wi-Fi Direct it moves at about 10 MB/s, in 4096-byte pieces with a much larger window. A 20.8 MB video takes about two seconds over Wi-Fi and two to three minutes over Bluetooth, if Bluetooth gets it at all: the glasses may stop a large file at once and offer it again about five minutes later.

A 4096-byte piece also never fits in one AirShield frame. With its message header and type tag it's 4104 bytes, and a frame holds at most 4095, so every piece runs on into the next frame. A receiver that doesn't expect that loses the rest of the stream.

So Visor imports over Wi-Fi, and only falls back to Bluetooth when Wi-Fi fails.

Say everything before the join

The Wi-Fi part is the same as in the live view: the phone makes a Wi-Fi Direct group, and tells the glasses over Bluetooth to join it. The difference is the order of what's said first.

Once the glasses are on Wi-Fi, they stop reading Bluetooth, and a request sent after the join never arrives. So everything has to be asked before it. For each capture, Visor sends request 0x86 with the handle and link type 7, which means "send the whole capture, at full resolution, over the fast link". That request skips any asset already marked as delivered, though, so each of those gets its own 0x83 first:

// Ask before the join: on Wi-Fi the glasses stop reading Bluetooth.
val result = joinGlasses(connection, group.ssid, group.passphrase, timeoutMs = JOIN_TIMEOUT_MILLIS) { link ->
    for (capture in captures) {
        // The capture request skips a delivered asset, so that one is asked for by itself.
        for (asset in capture.wanted) if (asset.delivered) requestAsset(link, capture.handle, asset.id)
        requestCapture(link, capture.handle, LINK_WIFI)
    }
}

Then Visor opens the session over Wi-Fi and pauses the Bluetooth one, because the glasses keep one session per phone and the newest wins. Early on, an import's Wi-Fi session closed the Bluetooth LE session, which reconnected and closed the Wi-Fi one in the middle of a transfer, and the rest of the queue was gone. Now Bluetooth waits until the import ends: every file saved, the glasses' queue empty, or twelve seconds of quiet.

An import can use a 5 GHz group, too. The glasses' Wi-Fi crashes at 5 GHz only while video streams, and a file transfer at the same width runs fine.

A photo in 48 pieces

The full photo is a HEIC, and it isn't one image. It's 48 HEVC tiles of 512x512 pixels, plus a grid item that lays them out as 8 columns by 6 rows and crops the result to 4032x3024, 12.2 megapixels. Three things about it catch readers out:

  • The grid's description sits inside the idat box. Read its position as an offset into the file instead, and you land on the ftyp box at the start, with a geometry that looks valid and is wrong.
  • A decoder that ignores the grid returns a single 512x512 tile. ffmpeg -i does exactly that, and hands you one square of your photo.
  • The photo is stored lying on its side, with Exif orientation 6, a quarter turn clockwise. Android's ImageDecoder doesn't turn it, and ExifInterface reports the HEIF rotation, which is none, over the Exif one.

ImageDecoder handles the grid properly, so Visor uses it to decode, and reads the Exif orientation itself, from the bytes.

Developing a Motion Photo

A live photo goes into the gallery as an Android Motion Photo: a JPEG with the clip attached. Visor builds it in a few steps.

First it picks the key frame, the clip frame the still was taken from. It shrinks the still and each of the clip's first eight frames to 27x36 grey pixels, evens out their brightness and contrast, and takes the frame with the smallest difference. Then it writes the still as a JPEG at quality 95, with the Exif the glasses recorded: exposure, aperture, ISO, focal length.

The time needs fixing on the way. The glasses write UTC without saying so, and galleries read that as local time, or not at all, so Visor writes the capture's local time with its offset. The place comes from the phone's own record of where it was at the time.

The Motion Photo itself is simple. It's the JPEG, with one more APP1 segment holding XMP that describes the file, and the glasses' MP4 appended to the end, unchanged:

   GCamera:MotionPhoto="1"
   GCamera:MotionPhotoVersion="1"
   GCamera:MotionPhotoPresentationTimestampUs="$presentationUs">
   <Container:Directory>
    <rdf:Seq>
     <rdf:li rdf:parseType="Resource">
      <Container:Item Item:Mime="image/jpeg" Item:Semantic="Primary" Item:Length="0" Item:Padding="0"/>
     </rdf:li>
     <rdf:li rdf:parseType="Resource">
      <Container:Item Item:Mime="video/mp4" Item:Semantic="MotionPhoto" Item:Length="${clip.size}" Item:Padding="0"/>
     </rdf:li>
    </rdf:Seq>
   </Container:Directory>

A gallery finds the clip as the last that many bytes of the file, and the timestamp tells it which frame the still is. If developing fails for any reason, the original HEIC goes into the gallery as it came, so nothing is lost.

Videos, and a byte called landscape

Videos are MP4 files of 1728x2304 HEVC at 30 frames a second, with stereo AAC sound, and Visor saves them as they came. It only re-encodes a video when it has to steady it on the phone, or crop it to landscape.

Landscape is the odd one. The glasses always film the same tall frame, whatever you asked for. Landscape mode just sets one byte in the capture's record, and the phone is expected to keep the middle 4:3 band. A 3K test video came out at 2448x1836.

The glasses don't know what day it is

Early on, a tester's imports seemed to vanish. They had landed in the gallery weeks back. A photo taken on October 17 said it was taken on September 25, at 03:59, because the glasses' clock was three weeks behind, and the gallery sorts by when a photo was taken.

The glasses don't set their own clock. Nothing on them does: the phone sets it, with a DeviceInfoRequest on service 22 that carries the time, the time zone, such as Europe/Rome, and a request id. The Meta AI app sends it every time it connects, so its users never find out. Visor now does the same, and every new photo lands on the right day.

Deleting

Photos left on the glasses fill their storage, so Visor deletes each capture once it's saved, with a type 3 request on service 18 that carries the handle. A delete can't be undone, which is why Visor waits until the phone holds the files, and why a capture the phone already has is deleted at the next listing instead of being imported twice. An answer that says there's no such capture counts as deleted too: it means the job's already done.