avfoundation

Is it possible to add own metadata in captured Images in Swift

廉价感情. 提交于 2019-12-04 17:33:02
I'm very new to Swift and Ios programming. I like to, as mentioned above, insert my own metadata to captured images before i save them to album. I'm trying to get this done with this code. The saved image does not contain my own metadata, but its generated metadata. Can anybody please tell me what I'm doing wrong? Or maybe isn't it possible to add own new metadata table to captured images? Thanks a lot for your help @IBAction func btnPressed(sender: UIButton) { capturePicture() } func capturePicture(){ stillImageOutput.outputSettings = [AVVideoCodecKey: AVVideoCodecJPEG] session.addOutput

How to get CMSampleBufferRef from AudioQueueBufferRef

白昼怎懂夜的黑 提交于 2019-12-04 17:13:49
I am using a private library which was made for live broadcasting from iPhone. In every time of recording each frame it call a delegate function void MyAQInputCallback(void *inUserData, AudioQueueRef inQueue, AudioQueueBufferRef inBuffer, const AudioTimeStamp *inStartTime, UInt32 inNumPackets, const AudioStreamPacketDescription *inPacketDesc); Now how I can append this inBuffer to my AVAssetWriterInput as usual: [self.audioWriterInput appendSampleBuffer:sampleBuffer]; I think maybe convert AudioQueueBufferRef to CMSampleBufferRef somehow? Thank you. I don't suppose you are still looking for a

Is there any way to improve time between shots with AVCaptureStillImageOutput?

删除回忆录丶 提交于 2019-12-04 16:44:17
I currently use the following code to shoot a series of images: - (void)shootSeries:(int)photos { if(photos == 0) { [self mergeImages]; } else { [output captureStillImageAsynchronouslyFromConnection:connection completionHandler: ^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) { NSLog(@"Shot picture %d.", 7 - photos); [self shootSeries:(photos - 1)]; CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(imageDataSampleBuffer); CVPixelBufferLockBaseAddress(pixelBuffer, 0); int dataSize = CVPixelBufferGetDataSize(pixelBuffer); CFDataRef data = CFDataCreate(NULL, (const UInt8 *

Switching Videos in AVPlayer Creates Flash When Changing

安稳与你 提交于 2019-12-04 16:09:52
问题 I am using AVFoundation's AVPlayer to play 2 video clips made from 1 longer video (so the end of the first matches the beginning of the second) When the first video ends and the user taps, I create a new AVPlayer and assign it to my PlayerView, and start playing the second clip. This all works, however, there is a prominent screen "flicker". My assumption is that this is caused by the player view removing the first clip and then showing the second clip. What I need is for this flicker to no

Record Streaming Audio from currently playing video in AVPlayer

倖福魔咒の 提交于 2019-12-04 15:58:11
Many similar questions but not Exactly the same. I currently have my code setup to play video via an AVPlayer. What I'm wanting to do is somehow extract the audio of the streaming video and eventually merge with the Mic Input (using AVAudioMixer?). (think Karaoke app) so when the user plays the recording it will play back the audio only from the video and the recording from the mic. I think AVAudioEngine is the way to go but i cannot for the life of me work it out. So my question is how do i extract or record the audio from the currently playing video in AVPlayer and importantly which is

How to control video frame rate with AVAssetReader and AVAssetWriter?

一世执手 提交于 2019-12-04 15:56:51
We are trying to understand how to control/specify the frame rate for videos that we are encoding with AVAssetReader and AVAssetWriter . Specifically, we are are using AVAssetReader and AVAssetWriter to transcode/encode/compress a video that we have accessed from the photo/video gallery. We are able to control things like bit rate, aspect ratio changes, etc., but cannot figure out how to control the frame rate. To be specific, we'd like to be able to take as input a 30 FPS video that's 5 minutes long and emit a 5 minute video at 15 FPS. Our current loop that processes sample buffers is:

Getting AVAudioPCMBuffer working (AVAudioFile.mm error code -50)

落爺英雄遲暮 提交于 2019-12-04 15:51:39
I'm trying to set up a basic example in a Swift playground (code below) but have also tried it with Objective-C with the same result. import AVFoundation let fileURL = ... // have tried a wav file and a aiff file let myAudioFile = AVAudioFile(forReading: fileURL, error: nil) let myAudioFormat = myAudioFile.fileFormat let myAudioFrameCount = UInt32(myAudioFile.length) var myAudioBuffer = AVAudioPCMBuffer(PCMFormat: myAudioFormat, frameCapacity: myAudioFrameCount) // have also tried a smaller frameCapacity It works fine up to this point, but then terminates with this: var myError: NSError?

AVCaptureSession preset creates a photo that is too big

ε祈祈猫儿з 提交于 2019-12-04 15:49:06
I have a photo taking app that is using AVFoundation . Once an image is captured, I have 2 core graphics methods that I have to run in order to properly rotate and crop the image. When testing this using the typical AVFoundation setup for capturing camera photos with a session preset of AVCaptureSessionPresetPhoto , I was always receiving a ton of memory warnings and I spent 2 weeks trying to solve these and I finally gave up. I ended up ditching the typical captureStillImageAsynchronouslyFromConnection setup and using another setup that just "captures" the video frames. This new method works

AVAssetWritter does not work with audio

Deadly 提交于 2019-12-04 15:13:32
问题 I'm trying to get audio to work with the video for an iOS application. The video is fine. No audio is recorded to the file (My iPhone speaker works.) Here's the init setup: session = [[AVCaptureSession alloc] init]; menu->session = session; menu_open = NO; session.sessionPreset = AVCaptureSessionPresetMedium; camera = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; microphone = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio]; menu->camera = camera; [session

How to compress video using AVFoundation in iOS [closed]

纵然是瞬间 提交于 2019-12-04 14:53:19
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . Is there are any compression technique in iPhone to compress video using AVfoundation. or any open source. Regards, Jeeva 回答1: Try this :) + (void)convertVideoToLowQualityWithInputURL:(NSURL*)inputURL outputURL: