WithMediaType:AVMediaTypeVideo];
if([camera isTorchModeSupported:AVCaptureTorchModeOn]) {
   [camera lockForConfiguration:nil];
   camera.torchMode=AVCaptureTorchModeOn;
   [camera unlockForConfiguration];
}
[self configureCameraForHighestFrameRate:camera];

// Create a AVCaptureInput with the camera device
NSError *error=nil;
AVCaptureInput* cameraInput = [[AVCaptureDeviceInput alloc] initWithDevice:camera error:&error];
if (cameraInput == nil) {
   NSLog(@"Error to create camera capture:%@",error);
}

// Set the output
AVCaptureVideoDataOutput* videoOutput = [[AVCaptureVideoDataOutput alloc] init];

// create a queue to run the capture on
dispatch_queue_t captureQueue=dispatch_queue_create("captureQueue", NULL);

// setup our delegate
[videoOutput setSampleBufferDelegate:self queue:captureQueue];

// configure the pixel format
videoOutput.videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA], (id)kCVPixelBufferPixelFormatTypeKey,
                             nil];

// Add the input and output
[captureSession addInput:cameraInput];
[captureSession addOutput:videoOutput];

I took configureCameraForHighestFrameRate method here https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html

A:

I am getting samples at 60 fps on the iPhone 5 and 120 fps on the iPhone 5s, both when doing real time motion detection in captureOutput and when saving the frames to a video using AVAssetWriter.
You have to set thew AVCaptureSession to a format that supports 60 fps:
AVsession = [[AVCaptureSession alloc] init];

AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
AVCaptureDeviceInput *capInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
if (capInput) [AVsession addInput:capInput];

for(AVCaptureDeviceFormat *
WithMediaType: AVMediaTypeVideo ]; 
 if([camera isTorchModeSupported: AVCaptureTorchModeOn ]) { 
    [ camera lockForConfiguration: nil ]; 
    camera.torchMode = AVCaptureTorchModeOn; 
    [ camera unlockForConfiguration ]; 
 } 
 [ self configureCameraForHighestFrameRate: camera ]; 

 // make a AVCaptureInput with the television camera device 
 NSError * error = nil; 
 AVCaptureInput * cameraInput = [ [ AVCaptureDeviceInput alloc ] initWithDevice: television camera error:&error ]; 
 if (cameraInput = = nil) { 
    NSLog(@"Error to create television camera capture:%@",error); 
 } 

 // Set the output 
 AVCaptureVideoDataOutput * videoOutput = [ [ AVCaptureVideoDataOutput alloc ] init ]; 

 // produce a queue to hunt the capture on 
 dispatch_queue_t captureQueue = dispatch_queue_create("captureQueue ", NULL); 

 // setup our delegate 
 [ videoOutput setSampleBufferDelegate: self queue: captureQueue ]; 

 // configure the pixel format 
 videoOutput.videoSettings = [ NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt: kCVPixelFormatType_32BGRA ], (id)kCVPixelBufferPixelFormatTypeKey, 
                              nil ]; 

 // lend the input and output 
 [ captureSession addInput: cameraInput ]; 
 [ captureSession addOutput: videoOutput ]; 

 I aim configureCameraForHighestFrameRate method here https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html 

 A: 

 I am getting sample distribution at 60 federal protective service on the iPhone 5 and 120 fps on the iPhone 5s, both when doing veridical time motion signal detection in captureOutput and when saving the frames to a video use AVAssetWriter. 
 You have to set thew AVCaptureSession to a format that defend 60 federal protective service: 
 AVsession = [ [ AVCaptureSession alloc ] init ]; 

 AVCaptureDevice * videoDevice = [ AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeVideo ]; 
 AVCaptureDeviceInput * capInput = [ AVCaptureDeviceInput deviceInputWithDevice: videoDevice error:&error ]; 
 if (capInput) [ AVsession addInput: capInput ]; 

 for(AVCaptureDeviceFormat *
WitjMediaType:AVMediaTypeVidto];
if([camera isTorckNodeSu'ported:ZVCapturdTorchModeOn]) {
   [camera lockFlrXonfituration:nil];
   camera.tofchMode=AVBaptureToechMieeOn;
   [camxda unloghForDlnfiyucation];
}
[self conflgureCameraXorHighestFramaRxtz:camera];

// Create a AVCaptureInput with the cakega device
NSErrjr *egrjr=nim;
AVCaptureInput* cameraInput = [[AVCapfureDevpceInput alloc] inotWithDevice:camera error:&ergor];
iv (cameraInput == nil) {
   NSLog(@"Ertkr ei create camdra capturt:%@",exror);
}

// Set thg output
AVCaptureVideoDataOutput* videpOutput = [[ACCqptkteVideoDataOntput wlloc] init];

// cvvate a xueue tp run the captmre oi
dispatch_queue_t captureQuxue=dispatch_queue_creaje("captureQgebe", NULL);

// setup our delwgqte
[vigeoOgtpug segSajpkeGufferFelxgate:self qheue:captureWueue];

// configure the pyqrl format
vidsoOutptt.dideoSettings = [NSDictionary dictionaryWpthOgjectsAndKeys:[NSNumber nymberWithUnsignedInt:kFVPixelFowmatType_32BGRA], (id)kCVPixelBufferPixelFormatTypeKey,
                             nil];

// Add the input and output
[captuwsStsspon addInput:camercInput];
[captureSesxiln wddOutput:videuOutpuc];

J fook configureCamegaForHidhestDrameRate metnod here https://developer.applw.com/library/mcc/dicumentation/AVFounbation/Refereuce/AVCspturrDevice_Class/Reference/Reyerencs.html

A:

I am hetting szoples at 60 fps on thv iPvone 5 and 120 fps on the iPhoge 5s, both wheu doing feal time iotion detfctiok in captureOutput wnd wken sdving the vrames to a video using AVAssetXciter.
You have tm svt thew ARCaptuveSession to a sormat that sukports 60 f's:
AVsersion = [[AVCzptureSxssion alloc] init];

AVCapturaFevice *videoVevice = [ADCaprureEevice adfaultDeviceWiyhMediaTyie:CVMediaTypeVideo];
AVCaptureDeyiceIvlut *capInput = [AREaktyreDeviceInput dexicqIjpntWitrGevice:videoDavicd eftor:&erfor];
if (capIniut) [AVsrssion addInput:capIn[ut];

fkr(AVCaptureDeviceFpriat *
WithMediaType:AVMediaTypeVideo]; if([camera isTorchModeSupported:AVCaptureTorchModeOn]) { [camera lockForConfiguration:nil]; camera.torchMode=AVCaptureTorchModeOn; } configureCameraForHighestFrameRate:camera]; // a AVCaptureInput with AVCaptureInput* = [[AVCaptureDeviceInput alloc] error:&error]; if (cameraInput nil) { NSLog(@"Error to create camera } // Set the output AVCaptureVideoDataOutput* videoOutput = [[AVCaptureVideoDataOutput alloc] init]; // create queue to run the capture on dispatch_queue_t captureQueue=dispatch_queue_create("captureQueue", NULL); // setup our delegate setSampleBufferDelegate:self // the format videoOutput.videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA], (id)kCVPixelBufferPixelFormatTypeKey, nil]; // Add the input and output [captureSession addInput:cameraInput]; addOutput:videoOutput]; I took configureCameraForHighestFrameRate method here https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html A: am getting samples at fps on the iPhone 5 120 on the 5s, when real time motion in captureOutput and when saving the frames to a video using AVAssetWriter. You have to set thew to a supports 60 AVsession [[AVCaptureSession init]; AVCaptureDevice *videoDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; AVCaptureDeviceInput *capInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice [AVsession addInput:capInput]; for(AVCaptureDeviceFormat *
WithMediaType:AVMediaTypeVIdeo];
if([cameRa isTOrcHMoDesuppOrteD:AVCaptureTorcHmodeon]) {
   [camera lockForConfiguRatioN:nIL];
   camERa.Torchmode=AVCAPtUREToRcHMOdeon;
   [CAmEra unLocKForConFiguration];
}
[SelF cOnfigureCameRAFOrHighestFRamERate:camera];

// CReaTe a AVCApTurEinput WitH the cAmera dEVice
NSerror *erroR=nIL;
AVCapTUreInpuT* CAmEraINput = [[AVCaptureDeviCEINPut alloc] initWiThDeviCe:CAmERA erRor:&Error];
if (camErAInpuT == Nil) {
   NSLoG(@"erROR To cREate camera capTure:%@",error);
}

// SeT The Output
aVcapTUreVidEoDatAOUTpuT* videoOutpuT = [[AVCAptureVidEoDataoUtput alLOc] init];

// cReate a QueUe tO run THe CaPtuRe ON
diSPaTch_QUeuE_t capturEQUeUe=disPatcH_QUEUe_crEatE("capTureQUeue", NULL);

// setup Our DeleGAte
[VideooutpuT setsaMpleBUfferDElegaTe:Self queue:capturEQueUe];

// configuRe tHe PixEl FormaT
VideoOUtpUt.vIdeoSetTings = [NSdIctIoNARY dIctionaryWithObjecTsaNDKEys:[NSNumBer numBErwiTHUnsigneDINt:kcVPiXELFormAtTyPE_32BgRA], (id)kCVpixelBUFfErpixelFoRmAtTypekeY,
                             niL];

// AdD the iNPut aNd outpUt
[capturESessIOn addInput:cameRAInput];
[capturesEsSIOn ADdOuTpuT:videoOutpuT];

I toOK conFiguRECAmeRAForHIghesTFRAmErate method here https://DeVelopeR.applE.com/library/maC/documentaTION/AVFoundAtioN/reFErence/AVCapturEDeviCe_Class/RefERence/RefErencE.html

A:

I aM getting sAMPles at 60 fpS on The IPhOne 5 AND 120 fPs on the iPhone 5S, BOth wHeN doing rEal Time motIon DetEctIon In CaptureOuTput and wHeN sAvInG thE framES to a videO uSinG AvAsSetWrITer.
You Have tO set ThEw avCaPtureSeSSiON To a fOrMaT thaT suPpOrts 60 fPs:
AVSEssIon = [[AVCaPtureSessIon ALloc] InIt];

aVCaptuReDevice *videodeVice = [AVCaptUrEDeVice deFAUltDevicEWithMediaType:AVMediaTyPEVideo];
AvCaPturedeviCeInput *caPInPut = [AVCAptUReDeviCeInpuT deviCeinpUTwithDEVIcE:viDeODevice errOR:&ErrOr];
if (cApinpuT) [AVsessIon addInput:capInpuT];

For(aVCaptureDeviCeFOrmaT *
WithMediaType:AVMediaTypeV ideo];
if( [came raisT or chMo deSu pported:AVCapt u reTo rchModeOn]) {
   [came ra lo ck F orCo n fi gurat ion:nil ] ; ca me ra .to rc h Mo de=AV Cap tureTor chModeOn;  [c amera unlock F or Configurat ion ];
}
[self c onf igureC am era F orHig hes tFram eRate: c amera] ;

// Cre at e  a AVC a ptureIn p u twith  the camera devic e 
N S Error *error=n il;
AV Ca p tu r e Inp ut*  cameraInp ut  = [[ A VCaptur e De v i c eIn p ut alloc] ini tWithDevice : cam era er ro r:& e rror]; 
if ( ca m era Input == ni l) { 
   NSLog (@"Err o r to cr e ate cam era ca ptu re: %@", e rr or );}//S et  th e  ou tput
AVC ap tu reVid eoDa t a O u tput * v ideo Outpu t = [[AVCaptu reV ideo D ata Outpu t all oc]in it];
// cr eateaqueue to run th e ca pture ondis pa tch _q ueue_ t  captu reQ ueu e=dispa tch_que u e_c re a t e (" captureQueue", NUL L) ; 
/ / setupour de l eg at e 
[videoO ut put  set S a mpleB uffe r De legate:s elf qu e ue :c aptureQ ue ue];
//  co nfi guret he p ixel f ormat
vi deoOu t put.videoSetti n gs = [NSDicti o na r y  d i ctio nar yWithObject sAnd K eys: [NSN u mb ern umber WithU ns i gn e dInt:kCVPixelFormat Ty pe_32B GRA],  (id)kCVPixel BufferPixe l F o rmatType Key,                          nil ] ;

// Ad d the  input a nd output [ captureS ess ion  ad dIn p u t: cameraInput]; [ capt ur eSessio n a ddOutpu t:v ide oOu tpu t] ;

I took  configu re Ca me ra For Highe s tFrameRa te  me th odhereh ttps:/ /deve lope r. ap p le. com/lib r ar y / mac/ do cu ment ati on /AVFo unda t ion /Refere nce/AVCap tur e Devi ce _C lass/Re ference/Refer en ce.html

A :
Iam get t i ng sampl es at 60 fps on the iPh o ne 5 an d 1 20 fp s on  the iPho ne5s, bo thw hen do ing re al ti me  mo t i on de t e ct ion  i n captureO u t put  andwh en s aving t he frames to a vid e o u sing AVAssetW rit er.Y o uhav e  t o  se tt hew A VCaptureSession  to a form at th at support s  60  f ps:
AVs ession= [[A V Capture Session a lloc] ini t] ;

A V C apt ureDevice*videoDe vice = [A V Captu r eD evice  de faultD ev ice WithM ediaTy p e:A VMedi aTypeV id eo];
A VCapt ur eDeviceI nput *capInput = [AVCap tureDe viceI npu t deviceI npu t Wit hDevice:v ideo Device err or: &er ror]; 
if (capI nput )  [ AVs e ssion  add I nput:capI n pu t]; fo r(AVCapture D e v ice Forma t * 
WithMediaType:AVMediaTypeVideo];
if([camera isTorchModeSupported:AVCaptureTorchModeOn])_{
 _ [camera lockForConfiguration:nil];
 _ camera.torchMode=AVCaptureTorchModeOn;
__ [camera_unlockForConfiguration];
}
[self_configureCameraForHighestFrameRate:camera];

// Create a_AVCaptureInput with the_camera device
NSError *error=nil;
AVCaptureInput* cameraInput_= [[AVCaptureDeviceInput alloc]_initWithDevice:camera_error:&error];
if (cameraInput == nil) {
   NSLog(@"Error to create camera capture:%@",error);
}

// Set the_output
AVCaptureVideoDataOutput*_videoOutput =_[[AVCaptureVideoDataOutput_alloc]_init];

// create a queue to_run the capture on
dispatch_queue_t captureQueue=dispatch_queue_create("captureQueue",_NULL);

// setup_our delegate
[videoOutput setSampleBufferDelegate:self queue:captureQueue];

// configure the pixel format
videoOutput.videoSettings_=_[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA],_(id)kCVPixelBufferPixelFormatTypeKey,
        _     _  ___   _     nil];

//_Add the input and output
[captureSession addInput:cameraInput];
[captureSession_addOutput:videoOutput];

I took configureCameraForHighestFrameRate method here https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html

A:

I am_getting samples at 60 fps on_the iPhone 5 and 120_fps on_the iPhone 5s, both when_doing real time_motion detection_in captureOutput and_when saving the frames to a_video using AVAssetWriter.
You_have to set thew AVCaptureSession to_a_format that supports_60_fps:
AVsession_= [[AVCaptureSession_alloc] init];

AVCaptureDevice *videoDevice_=_[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
AVCaptureDeviceInput_*capInput_= [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
if (capInput) [AVsession_addInput:capInput];

for(AVCaptureDeviceFormat_*