• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
recording audio from isight
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

recording audio from isight


  • Subject: recording audio from isight
  • From: Olivier Destrebecq <email@hidden>
  • Date: Sat, 7 Jan 2006 15:52:26 -0500

I'm trying to record an AAC file from an isight
I've modeled my code after the audioFileRecorder source code. Unfortunately, when i use my code to record with an isight, i get a zero Kb file. If i use the build in audio or an imic for input it works just fine.


When i try to record the file using the command line tool afrecord, it records and grows the file, but then quicktime says it has a length of 0 seconds.

here is the code any pointers appreciated:

const unsigned kBufferSize = 0x8000;
[self setAudioFileRecorder: new CAAudioFileRecorderInputSelection (3, kBufferSize)]; //8Kb buffer


//set the input device for the file recorder
//
[self audioFileRecorder]->setDefaultInput([recordingDevice deviceID]);


//create the directory reference and the file reference
//
FSRef parentDir;
CFURLGetFSRef((CFURLRef)[NSURL fileURLWithPath: [[self tempFileRecordingPath] stringByDeletingLastPathComponent]], &parentDir);


//set the format for the destination file (AAC for our purpose)
//
MTCoreAudioStreamDescription *audioStreamDescription = [MTCoreAudioStreamDescription streamDescription];
[audioStreamDescription setFormatID: kAudioFormatMPEG4AAC];
[audioStreamDescription setChannelsPerFrame: 1];
[audioStreamDescription setFormatFlags: 2];
[audioStreamDescription setFramesPerPacket: 512]; //64kbps
[audioStreamDescription setSampleRate: 44100];


//create the audio file for the recorder
//
[self audioFileRecorder]->SetFile(parentDir,
(CFStringRef) [[self tempFileRecordingPath] lastPathComponent],
kAudioFileM4AType,
CAStreamBasicDescription ([audioStreamDescription audioStreamBasicDescription]),
NULL);



//turn off file caching, as recommanded on mailing lists
//
NSFileHandle* file = [[NSFileHandle fileHandleForReadingAtPath: [self tempFileRecordingPath]] retain];
fcntl([file fileDescriptor], F_NOCACHE, 1);


  //begin the recording
  //
  [self audioFileRecorder]->Start();


void CAAudioFileRecorderInputSelection::setDefaultInput(AudioDeviceID inputDevice)
{
XThrowIfError(
AudioUnitSetProperty(mInputUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &inputDevice, sizeof(inputDevice)),
"failed to select input device");
}


Olivier Destrebecq
http://otusweb.spymac.com/portfolio/


_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Solved: recording audio from isight
      • From: Olivier Destrebecq <email@hidden>
  • Prev by Date: QTMetadata feature in QT7
  • Next by Date: Solved: recording audio from isight
  • Previous by thread: Re: QTMetadata feature in QT7
  • Next by thread: Solved: recording audio from isight
  • Index(es):
    • Date
    • Thread