В моем приложении я использую AVCaptureSession
для записи video
.Записанное видео Кадр с использованием AVCaptureSession
При записи делается, я получаю видео размером 360 X 480
.
Я установил запись слой размер 320 X 568
.
Я что-то упускаю, я пробовал, но не добирался.
Может кто-нибудь руководство мне, где я должен изменить, чтобы получить записи video
с размером 320 X 568
Вот мой код,
Initialization
AVCaptureDevice* device = nil;
AVCaptureDeviceInput *captureInput = [AVCaptureDeviceInput deviceInputWithDevice:device error:nil];
AVCaptureVideoDataOutput *captureOutput = [[AVCaptureVideoDataOutput alloc] init];
captureOutput.alwaysDiscardsLateVideoFrames = YES;
dispatch_queue_t queue;
queue = dispatch_queue_create("cameraQueue", NULL);
[captureOutput setSampleBufferDelegate:self queue:queue];
dispatch_release(queue);
// Установите видеовыход для хранения кадра в BGRA
NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey;
NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA];
NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key];
[captureOutput setVideoSettings:videoSettings];
// И мы создаем взятием сеанс
self.captureSession = [[AVCaptureSession alloc] init];
self.captureSession.sessionPreset = AVCaptureSessionPresetMedium;
if([self.captureSession respondsToSelector:@selector(addInput:)])
[self.captureSession addInput:captureInput];
if([self.captureSession respondsToSelector:@selector(addOutput:)])
[self.captureSession addOutput:captureOutput];
/*We add the Custom Layer (We need to change the orientation of the layer so that the video is displayed correctly)*/
self.customLayer = [CALayer layer];
self.customLayer.frame = self.view.bounds;
self.customLayer.transform = CATransform3DRotate(CATransform3DIdentity, M_PI/2.0f, 0, 0, 1);
self.customLayer.transform = CATransform3DScale(self.customLayer.transform,.7,.7,1);
self.customLayer.transform = CATransform3DTranslate(self.customLayer.transform,-23,0,0);
self.customLayer.contentsGravity = kCAGravityResizeAspectFill;
[self.view.layer addSublayer:self.customLayer];
[self.captureSession startRunning];
// Инициализация За
Использование 'VideoSettings' собственности. – Buntylm
убедитесь, что вы не забудете добавить iphone5 [email protected] –
@Nitin, Да, я добавил [email protected] – Nikunj