AVCaptureSession with multiple previews

I ran into the same problem of needing multiple live views displayed at the same time. The answer of using UIImage above was too slow for what I needed. Here are the two solutions I found: 1. CAReplicatorLayer The first option is to use a CAReplicatorLayer to duplicate the layer automatically. As the docs say, … Read more

AVPlayer frame animation

Here’s my opinion, add AVPlayer layer property(AVPlayerLayer class) to a sublayer to a UIView layer, then manipulate the view animation. for example, AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:blahURL options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:urlAsset]; AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem]; AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player]; playerLayer.frame = yourFrame; UIView *videoView = [UIView new]; [videoView addSublayer:playerLayer]; then give … Read more

iPhone AVFoundation camera orientation

Well, it’s taken me fracking forever but I’ve done it! The bit of code I was looking for is [UIDevice currentDevice].orientation; This goes in as so AVCaptureConnection *videoConnection = [CameraVC connectionWithMediaType:AVMediaTypeVideo fromConnections:[imageCaptureOutput connections]]; if ([videoConnection isVideoOrientationSupported]) { [videoConnection setVideoOrientation:[UIDevice currentDevice].orientation]; } And it works perfectly 😀 Woop woop!

Can use AVCaptureVideoDataOutput and AVCaptureMovieFileOutput at the same time?

I can’t answer the specific question put, but I’ve been successfully recording video and grabbing frames at the same time using: AVCaptureSession and AVCaptureVideoDataOutput to route frames into my own code AVAssetWriter, AVAssetWriterInput and AVAssetWriterInputPixelBufferAdaptor to write frames out to an H.264 encoded movie file That’s without investigating audio. I end up getting CMSampleBuffers from … Read more

AVFoundation + AssetWriter: Generate Movie With Images and Audio

I ended up exporting the video separately using the above code and added the audio files separately using AVComposition & AVExportSession. Here is the code -(void) addAudioToFileAtPath:(NSString *) filePath toPath:(NSString *)outFilePath { NSError * error = nil; AVMutableComposition * composition = [AVMutableComposition composition]; AVURLAsset * videoAsset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:filePath] options:nil]; AVAssetTrack * videoAssetTrack = … Read more

Face Detection with Camera

There are two ways to detect faces: CIFaceDetector and AVCaptureMetadataOutput. Depending on your requirements, choose what is relevant for you. CIFaceDetector has more features, it gives you the location of the eyes and mouth, a smile detector, etc. On the other hand, AVCaptureMetadataOutput is computed on the frames and the detected faces are tracked and … Read more

How to solve the warning: Sending ‘ViewController *const __strong’ to parameter of incompatible type ‘id?

Conform to the AVAudioPlayerDelegate protocol in your header file and the warning will go away. By not declaring that a class conforms to a given protocol, the compiler cannot guarantee (well, at least warn) about your failure to implement the methods required of it. The following code is a corrected version that will suppress the … Read more

ios capturing image using AVFramework

Add the following line output.minFrameDuration = CMTimeMake(5, 1); below the comment // If you wish to cap the frame rate to a known value, such as 15 fps, set // minFrameDuration. but above the [session startRunning]; Edit Use the following code to preview the camera output. AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:session]; UIView *aView = self.view; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)