Skip to content

iOS stream-video has no native H.264 format #132

Description

@onevcat

Gap

stream-video's format matrix is asymmetric:

iOS Android
mjpeg / raw / ffmpeg screenshot loop screencap loop
h264 missing adb screenrecord passthrough
bgra raw framebuffer pixels —

So on iOS every practical live-stream format is a per-frame screenshot loop, which tops out around 4–5 FPS on an iPhone 17 Pro at full resolution (measured while verifying #130) and pays a codec pass per frame. Android's h264 leg streams at the device's native variable frame rate with no per-frame encode on our side.

The plumbing already exists

record-video has driven native H.264 on iOS since #52/#70:

let config = FBVideoStreamConfiguration(
    format: .compressedVideo(withCodec: .h264, transport: .annexB),
    framesPerSecond: fps,
    rateControl: .quality(Double(quality) / 100.0),
    scaleFactor: scale,
    keyFrameRate: 2.0
)

record-video points that at a file. stream-video --format h264 would point the same configuration at stdout, which is what the Android leg already does with screenrecord's Annex B output — and SimUseVideo already has the host-side Annex B parsing from the recording work.

This would also close the "h264 is Android-only for now" caveat in the 0.12.0 changelog and make the stream-video format set symmetric across platforms.

Scope notes

  • --fps semantics: iOS record-video honours a constant --fps, so the stream can too (unlike Android's variable rate).
  • streamBGRA already streams from FBVideoStream and handles startup/mid-stream failure detection (Surface BGRA stream-video failures as non-zero exit #21); that error taxonomy is the model to follow.
  • Worth checking whether ffplay -f h264 -probesize 32 -fflags nobuffer - (the pipeline the README documents for Android) works unchanged against the iOS output.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions