avfoundation

How to apply audio effect to a file and write to filesystem - iOS

橙三吉。 提交于 2019-11-28 11:43:04
I'm building an app that should allow user to apply audio filters to a recorded audio, such as Reverb, Boost. I was unable to find any viable source of information on how to apply filters to a file itself, because it's needed to upload processed file to server later. I'm currently using AudioKit for visualization, and I'm aware that it's capable of doing audio processing, but only for playback. Please give any suggestions for further research. AudioKit has an offline render node that doesn't require iOS 11. Here's an example, the player.schedule(...) and player.start(at.) bits are required as

AVPlayerViewController using audio-only AVPlayer

只谈情不闲聊 提交于 2019-11-28 11:26:50
Just starting out with AVKit, and I'm trying to play some audio. It would be nice to use the new AVPlayerViewController detailed in Mastering Modern Media Playback so that I have a ready-made play/pause/seek UI. I basically have a storyboard with a container view which has an embed segue to the AVPlayerViewController. Then I use: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if (segue.identifier == "embedAudio") { var playerViewController:AVPlayerViewController = segue.destinationViewController as AVPlayerViewController playerViewController.player = AVPlayer(URL

Dot Product and Luminance/ Findmyicone

瘦欲@ 提交于 2019-11-28 10:31:41
问题 All, I have a basic question that I am struggling with here. When you look at the findmyicone sample code from WWDC 2010, you will see this: static const uint8_t orangeColor[] = {255, 127, 0}; uint8_t referenceColor[3]; // Remove luminance static inline void normalize( const uint8_t colorIn[], uint8_t colorOut[] ) { // Dot product int sum = 0; for (int i = 0; i < 3; i++) sum += colorIn[i] / 3; for (int j = 0; j < 3; j++) colorOut[j] = (float) ((colorIn[j] / (float) sum) * 255); } And then it

Setting multiple Volumes to each Video tracks using AudioMixInputParameters AVFoundation is not working in Swift iOS

房东的猫 提交于 2019-11-28 09:37:14
问题 I am working on Video based Application in Swift . As per the requirement I have to select multiple Videos from Device Gallery , setting up different different CIFilter effects and Volume for each Video Asset and then merge all the Videos and have to Save the Final Video . As an output, when I will play the Final Video then Video sound volume should change accordingly. I have already merged all the selected Video Assets into one with different different CIFilter effects but my problem is when

Grab frames from video using Swift

假装没事ソ 提交于 2019-11-28 09:27:26
I want to grab frames from a video at a specific time. I'm calling my grab-frame-function with a time specified as seconds as a Float64. The problem is that it doesn't grab the current frame. It seems to ignore the decimals. If I call the function with for example 1.22 and 1.70 it will return the same frame. I'm quite new when it comes to Swift so I guess I don't get the CMTime object right. So can anyone see what's wrong with this? func generateThumnail(url : NSURL, fromTime:Float64) -> UIImage { var asset :AVAsset = AVAsset.assetWithURL(url) as! AVAsset var assetImgGenerate :

Recording Video in iPhone using AVFoundation Framework(AVCaptureSession)?

天大地大妈咪最大 提交于 2019-11-28 08:50:23
i am developing an application in which i am trying to record a video using AVCaptureSession class...i came across a few good tutorials like this one http://www.benjaminloulier.com/posts/2-ios4-and-direct-access-to-the-camera but in these tutorials only capturing images from the video frames is done while i want to record a full length video which i can either save in my device or upload it to my server....How can i achieve this using AVFoundation framework?? Check out the sample code from the WWDC 2010 http://developer.apple.com/videos/wwdc/2010/ for example the AVCamDemo. Login to your

AVPlayer stops playing video after buffering

耗尽温柔 提交于 2019-11-28 07:51:18
When I load a video from the internet (10-40MB large) I am unable to provide a smooth playing experience. My AVPlayer either loads the whole video and then plays it, or plays 1s, buffers and then just stops playing. I tried endless libraries, buffer-observer methods, and tutorials. Nothing seems to help. . . . self.makeLoaderVisible() let playerItem = AVPlayerItem(url: url) playerItem.addObserver(self, forKeyPath: "playbackBufferEmpty", options: .new, context: nil) playerItem.addObserver(self, forKeyPath: "playbackLikelyToKeepUp", options: .new, context: nil) playerItem.addObserver(self,

Convert UIImage to CMSampleBufferRef

白昼怎懂夜的黑 提交于 2019-11-28 07:41:05
I am doing video recording using AVFoundation . I have to crop the video to 320x280. I am getting the CMSampleBufferRef and converting it to UIImage using the below code. CGImageRef _cgImage = [self imageFromSampleBuffer:sampleBuffer]; UIImage *_uiImage = [UIImage imageWithCGImage:_cgImage]; CGImageRelease(_cgImage); _uiImage = [_uiImage resizedImageWithSize:CGSizeMake(320, 280)]; CMSampleBufferRef croppedBuffer = /* NEED HELP WITH THIS */ [_videoInput appendSampleBuffer:sampleBuffer]; // _videoInput is a AVAssetWriterInput The imageFromSampleBuffer: method looks like this: - (CGImageRef)

How to convert a kCVPixelFormatType_420YpCbCr8BiPlanarFullRange buffer to UIImage in iOS

余生颓废 提交于 2019-11-28 07:02:36
I tried to answer this in the original thread however SO would not let me. Hopefully someone with more authority can merge this into the original question. OK here is a more complete answer. First, setup the capture: // Create capture session self.captureSession = [[AVCaptureSession alloc] init]; [self.captureSession setSessionPreset:AVCaptureSessionPresetPhoto]; // Setup capture input self.inputDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; AVCaptureDeviceInput *captureInput = [AVCaptureDeviceInput deviceInputWithDevice:self.inputDevice error:nil]; [self

Getting a thumbnail of a *.mov video IOS

≡放荡痞女 提交于 2019-11-28 05:35:01
I want to get a thumbnail of videos (*.mov) which taken with iPhone/iPAD. I am trying to use AVFoundation library for this and getting this error: couldn't generate thumbnail, error:Error Domain=AVFoundationErrorDomain Code=-11822 "Cannot Open" UserInfo=0x15d90a30 {NSLocalizedDescription=Cannot Open, NSLocalizedFailureReason=This media format is not supported.} Code: NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentDir=[paths objectAtIndex:0]; NSString *videoPath=[documentDir stringByAppendingPathComponent:[NSString