I have two USB cameras. One is a low-cost WebCam, the other is a low-cost USB microscope; both bought from eBay. The microscope is actually just another WebCam.
I want to use the USB microscope with Mac OS X 10.5 and QTKit. MyRecorder works fine with my low-cost WebCam, but it only displays black video when I connect the microscope instead.
If I open QuickTime Player and create a movie recording, I get the error message: "Recording failed because no data was received.|Make sure that the media input source is turned on and playing."
The sequence grabber demo works with both cameras.
miXscope also works with both cameras (it seems it uses the sequence grabber).
Here's the stripped down MyRecorder (for a better overview):
- (void)awakeFromNib
{
NSError *error;
mCaptureSession = [[QTCaptureSession alloc] init];
QTCaptureDevice *videoDevice = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo];
BOOL success = [videoDevice open:&error];
if(!success)
{
videoDevice = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeMuxed];
success = [videoDevice open:&error];
}
if(!success) return;
mCaptureVideoDeviceInput = [[QTCaptureDeviceInput alloc] initWithDevice:videoDevice];
success = [mCaptureSession addInput:mCaptureVideoDeviceInput error:&error];
if(!success) return;
if(![videoDevice hasMediaType:QTMediaTypeSound] && ![videoDevice hasMediaType:QTMediaTypeMuxed])
{
QTCaptureDevice *audioDevice = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeSound];
success = audioDevice && [audioDevice open:&error];
if(success)
{
mCaptureAudioDeviceInput = [[QTCaptureDeviceInput alloc] initWithDevice:audioDevice];
success = [mCaptureSession addInput:mCaptureAudioDeviceInput error:&error];
}
}
mCaptureMovieFileOutput = [[QTCaptureMovieFileOutput alloc] init];
success = [mCaptureSession addOutput:mCaptureMovieFileOutput error:&error];
if(!success) return;
[mCaptureMovieFileOutput setDelegate:self];
[mCaptureView setCaptureSession:mCaptureSession];
[mCaptureSession startRunning];
}
What do I need to add/change, in order to get my microscope to work with MyRecorder ? (I've tried logging all I could think of, but I receive no errors from any of the QTKit methods I invoke).
Note: I've gone through all StackOverflow questions I could find on the subject, two questions came close, but they do not solve this issue.
√ - Check the following code:
This came from THIS tutorial, also try checking out the Audio capture methods
#prama markfurther into the example code provided in the tutorial.Hope this helps!
Added References