Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6790725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:45:34+00:00 2026-05-26T17:45:34+00:00

I’m using an AVCaptureVideoPreviewLayer to allow the user to frame a shot from the

  • 0

I’m using an AVCaptureVideoPreviewLayer to allow the user to frame a shot from the iPhone camera. So I have an AVCaptureSession with the input as an AVCaptureDeviceInput, and the output as an AVCaptureStillImageOutput.

I also have animations and controls on top of the video feed, but these are slow and jerky because the video behind is running at maximum frame rate and tying up the CPU/GPU.

I’d like to cap the frame rate of the AVCaptureVideoPreviewLayer. I see there’s the minFrameDuration property on AVCaptureVideoDataOutput, but I can’t find anything similar on AVCaptureVideoPreviewLayer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:45:35+00:00Added an answer on May 26, 2026 at 5:45 pm

    I do not think that the problem is connected with the frame rate. So I will suggest some tips to improve performance of your app:

    1) AVCaptureVideoPreviewLayer it is just a subclass of CALayer which displays output from camera, so it is impossible to cap the frame rate of it.

    2) Check if you positioned your animations in the right place, it depends on what kind of animations you have, if it is CALayer then animation layer should be a sublayer of your main canvas view layer(NOT AVCaptureVideoPreviewLayer!!!), if it is UIView, then it must be a subview of your main canvas view.

    3) You can improve performance of your app by setting session preset:

    [captureSession setSessionPreset:AVCaptureSessionPresetLow];
    

    By default it is set to high, you may set it whatever you need, it is just a quality of video and if it is high performance could not be ideal.

    4) I made my own test app, where is random animation overlays video preview layer(but it is subview of my main view!!!) and everything went smooth even on my old iPod, I can give you a code for initialization of capture session:

    // Create a capture session
    self.captureSession = [AVCaptureSession new];
    if([captureSession canSetSessionPreset:AVCaptureSessionPresetHigh]){
        [captureSession setSessionPreset:AVCaptureSessionPresetHigh];
    }
    else{
        // HANDLE ERROR
    }
    
    // Find a suitable capture device
    AVCaptureDevice *cameraDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
    
    // Create and add a device input
    NSError *error = nil;
    AVCaptureDeviceInput *videoInput = [AVCaptureDeviceInput deviceInputWithDevice:cameraDevice error:&error];
    if([captureSession canAddInput:videoInput]){
        [captureSession addInput:videoInput];
    }
    else{
        // HANDLE ERROR
    }
    
    // Create and add a device still image output
    AVCaptureStillImageOutput *stillImageOutput = [AVCaptureStillImageOutput new];
    [stillImageOutput addObserver:self forKeyPath:@"capturingStillImage" options:NSKeyValueObservingOptionNew context:AVCaptureStillImageIsCapturingStillImageContext];
    if([captureSession canAddOutput:stillImageOutput]){
        [captureSession addOutput:stillImageOutput];
    }
    else{
        // HANDLE ERROR
    }
    
    // Setting up the preview layer for the camera
    AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:captureSession];
    previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
    previewLayer.frame = self.view.bounds;
    
    // ADDING FINAL VIEW layer TO THE CAMERA CANVAS VIEW sublayer
    [self.view.layer addSublayer:previewLayer];
    
    // start the session
    [captureSession startRunning];
    

    5) And finally, in iOS5 you can set min and max video frame rate, what also can improve performance of your app, I guess it is what you asked. Check this link(Setting minimum and maximum video frame rate):

    http://developer.apple.com/library/mac/#releasenotes/AudioVideo/RN-AVFoundation/_index.html

    Hope that my answer was clear.

    Best wishes,

    Artem

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.