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 7405389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:23:49+00:00 2026-05-29T05:23:49+00:00

Source So, I have a QTCaptureSession set up thusly: //Setup Camera cameraSession = [[QTCaptureSession

  • 0

Source

So, I have a QTCaptureSession set up thusly:

    //Setup Camera
    cameraSession = [[QTCaptureSession alloc] init];
    QTCaptureDevice *camera = [QTCaptureDevice deviceWithUniqueID: cameraID];
    
    BOOL success = [camera open: &error];
    if (!success || error)
    {
        NSLog(@"Could not open device %@.", cameraID);
        NSLog(@"Error: %@", [error localizedDescription]);
        return nil;
    }
    
    //Setup Input Session
    QTCaptureDeviceInput *cameraInput = [[QTCaptureDeviceInput alloc] initWithDevice: camera];
    
    success = [cameraSession addInput: cameraInput error: &error];
    if (!success || error)
    {
        NSLog(@"Could not initialize input session.");
        NSLog(@"Error: %@", [error localizedDescription]);
        return nil;
    }
    
    //Setup Output
    QTCaptureDecompressedVideoOutput *cameraOutput = [[QTCaptureDecompressedVideoOutput alloc] init];
    [cameraOutput setDelegate: self];
    
    success = [cameraSession addOutput: cameraOutput error: &error];
    if (!success || error)
    {
        NSLog(@"Could not initialize output session.");
        NSLog(@"Error: %@", [error localizedDescription]);
        return nil;
    }

And the QTCaptureDecompressedVideoOutput delegate’s captureOutput:didOutputVideoFrame:WithSampleBuffer:fromConnection: thusly:

- (void)captureOutput:(QTCaptureOutput *)captureOutput didOutputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection
{
    NSLog(@"starting convert\n");
}

I then start the capture processing using:

    [cameraSession startRunning];

All of the variables initialize fine, and the session starts fine, but captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection: never gets called.

Context

This is a command-line app, compiled with the GCC. It’s linked against the following frameworks:

  • Foundation
  • Cocoa
  • QTKit
  • QuartzCore

Relevant Miscellany

The frame is not likely dropping because captureOutput:didDropVideoFrameWithSampleBuffer:fromConnection: is also not getting called.

  • 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-29T05:23:50+00:00Added an answer on May 29, 2026 at 5:23 am

    So, with some help from Mike Ash, I managed to figure out that my program was terminating immediately and not waiting for the delegate callback (which, according to Apple’s QTKit docs, might occur on a separate thread).

    My solution was to add a BOOL properties to my object named captureIsFinished, then add this to the main() function:

        //Wait Until Capture is Finished
        while (![snap captureIsFinished])
        {
            [[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 1]];
        }
    

    Which effectively perpetuates the run-loop of the app for 1 second, checks to see if the capture is finished, then runs for another second.

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

Sidebar

Related Questions

I have source in a bunch of subdirectories like: src/widgets/apple.cpp src/widgets/knob.cpp src/tests/blend.cpp src/ui/flash.cpp In
I have source XMLfiles that come in with multiple root elements and there is
Contributing to open source can have many forms: working with issue trackers, patches, further
Some open source libraries have tendency to re implement basic structures like string, list,
I have an executable that defaults to 32-bit. It doesn't have source code and
I have a source base that, depending on defined flags at build time, creates
I have some source files that have comments written in Japanese. When I open
I have the source code of an application written in C++ and I just
I have a source XML file that is used to create C# files that
I have a source directory that includes a mix of different languages and files.

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.