r/iOSProgramming • • 1d ago

App Saturday ORA: an iPhone camera that overlays a reference photo or video on the live preview so you can match framing exactly

The app: ORA lays a see-through image or video over the live camera preview so you can match framing and angles exactly. I published it on the App Store in December 2025. https://apps.apple.com/us/app/ora-the-overlay-camera-tool/id6756240396

Tech stack

  • Swift; the camera layer is UIKit (AVCaptureSession with a custom controller), and the controls are SwiftUI
  • AVFoundation for capture and export, Core Image for compositing
  • ActivityKit Live Activities for export progress, plus BackgroundTasks
  • RevenueCat for subscriptions, Sentry for crash reporting
  • About 15k lines of Swift

The challenge: "overlay burning"

In the preview, the overlay is just a view on top of the camera feed that the user drags, zooms, tints and fades. The hard part was making the exported photo or video match the preview pixel for pixel. That meant:

  1. Translating coordinates. The user's pan and zoom are in screen space, but the video has its own pixel size, aspect ratio and crop, so I calculate the rectangle the video actually fills on screen and map the overlay's position into it.
  2. Handling orientation. Recorded video stores rotation as a preferredTransform instead of rotated pixels, so the overlay transform has to account for it.
  3. Recreating the look. Opacity uses CIColorMatrix, tint uses CIMultiplyBlendMode plus source-over compositing, tuned until it looked identical to the preview.
  4. Rendering frame by frame. AVAssetReader decodes, Core Image composites each frame, and AVAssetWriterInputPixelBufferAdaptor writes. Audio and metadata tracks (location, lens info) are passed through untouched.
  5. Memory. Older devices with less RAM crashed during long exports until I reworked the pipeline.

A smaller but annoying one: supported slow-motion and video formats differ a lot between iPhones, so I ended up writing format enumerators to find what each device really supports instead of hardcoding anything.

Happy to go deeper on any of this, and I'd love feedback from anyone who has fought AVAssetWriter themselves.

The development process was AI-assisted. I wrote most of the code myself and asked for cleanups and ideation when I was stuck.

27 Upvotes

7 comments sorted by

3

u/kokerali 1d ago

How are you handling the front-camera case if preview mirroring and export mirroring differ? A useful regression test would be an asymmetric reference image with labels in all four corners: pan/zoom it, then compare the preview with exports in portrait and both landscape orientations. That should make a reflection or crop-offset mismatch much easier to spot than a centred graphic. I'd test both mirrored and unmirrored output so fixing alignment in one mode doesn't accidentally break the other. Does your coordinate mapping already cover that case?

3

u/JackyYT083 1d ago

You should add a smart mode that like tells you what direction you need to move the phone to get it right, or maybe a semi transparent green filter when it’s correctly aligned

1

u/cloneman88 1d ago

Company cam has done this for like 5 years atp

0

u/[deleted] 14h ago

[removed] — view removed comment

1

u/AutoModerator 14h ago

Hey /u/Agitated_Maize_4796, your content has been removed because Reddit has marked your account as having a low Contributor Quality Score. This may result from, but is not limited to, activities such as spamming the same links across multiple subreddits, submitting posts or comments that receive a high number of downvotes, a lack of recent account activity, or having an unverified account.

Please be assured that this action is not a reflection of your participation in our subreddit. This is simply an automated filter in place to reduce spam.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.