avfoundation

iPhone trim audio recording

折月煮酒 提交于 2019-12-21 06:43:08
问题 I have a voice memo component in my app, and I want to allow the user to trim the audio, similar to QuickTime X on Mac OS Ten point Six handles it, or like the Voice Memos app on the iPhone. Here's an example of both: Any help is appreciated. 回答1: I am not a UI programmer by any means. This was a test I wrote to see how to write custom controls. This code may or may not work. I have not touched it in some time. header @interface SUIMaxSlider : UIControl { @private float_t minimumValue; float

AVCaptureSession with multiple orientations issue

 ̄綄美尐妖づ 提交于 2019-12-21 06:02:12
问题 I am attempting to implement a barcode scanner. I have an AVCaptureSession that takes in video from AVCaptureDevice. I want to support all orientations. With the following code, when I run the app, everything is fine in the portrait orientation. However in landscape orientation, the view rotates but the video input does not. So I end up with a 90degree rotated video. When I implement -(NSUInteger)supportedInterfaceOrientations method, then everything gets locked to the portrait position. Can

How to detect max dB Swift

穿精又带淫゛_ 提交于 2019-12-21 05:53:04
问题 I'm trying to detect dB on a iOS Device, however, I am new to AV audio foundation can't really get to figure it out. I have come across this post: iOS - Detect Blow into Mic and convert the results! (swift), but it is not working for me. My current code is this: import Foundation import UIKit import AVFoundation import CoreAudio class ViewController: UIViewController { var recorder: AVAudioRecorder! var levelTimer = NSTimer() var lowPassResults: Double = 0.0 override func viewDidLoad() {

How to detect max dB Swift

不羁的心 提交于 2019-12-21 05:51:12
问题 I'm trying to detect dB on a iOS Device, however, I am new to AV audio foundation can't really get to figure it out. I have come across this post: iOS - Detect Blow into Mic and convert the results! (swift), but it is not working for me. My current code is this: import Foundation import UIKit import AVFoundation import CoreAudio class ViewController: UIViewController { var recorder: AVAudioRecorder! var levelTimer = NSTimer() var lowPassResults: Double = 0.0 override func viewDidLoad() {

Generating a tone in iOS with 16 bit PCM, AudioEngine.connect() throws AUSetFormat: error -10868

痞子三分冷 提交于 2019-12-21 05:44:09
问题 I have the following code for generating an audio tone of given frequency and duration. It's loosely based on this answer for doing the same thing on Android (thanks: @Steve Pomeroy): https://stackoverflow.com/a/3731075/973364 import Foundation import CoreAudio import AVFoundation import Darwin class AudioUtil { class func play(frequency: Int, durationMs: Int) -> Void { let sampleRateHz: Double = 8000.0 let numberOfSamples = Int((Double(durationMs) / 1000 * sampleRateHz)) let factor: Double =

Capture still UIImage without compression (from CMSampleBufferRef)?

女生的网名这么多〃 提交于 2019-12-21 05:39:32
问题 I need to obtain the UIImage from uncompressed image data from CMSampleBufferRef. I'm using the code: captureStillImageOutput captureStillImageAsynchronouslyFromConnection:connection completionHandler:^(CMSampleBufferRef imageSampleBuffer, NSError *error) { // that famous function from Apple docs found on a lot of websites // does NOT work for still images UIImage *capturedImage = [self imageFromSampleBuffer:imageSampleBuffer]; } http://developer.apple.com/library/ios/#qa/qa1702/_index.html

Merging NSData video files into one video file

柔情痞子 提交于 2019-12-21 05:35:44
问题 I have a bunch of video files that I want to merge into one video file, I am using NSMutableData to achieve the task NSMutableData *concatenatedData = [[NSMutableData alloc] init]; for (int i=0; i <[videoArray count]; i ++) { [concatenatedData appendData: [videoArray objectAtIndex:i]]; } [concatenatedData writeToFile:[[NSString alloc] initWithFormat:@"%@%@", NSTemporaryDirectory(), @"outputConct.mov"] atomically:YES]; UISaveVideoAtPathToSavedPhotosAlbum([[NSString alloc] initWithFormat:@"%@%@

iOS - How to get all audio tracks from a video file?

て烟熏妆下的殇ゞ 提交于 2019-12-21 05:22:18
问题 My Requirement: I need to get list of all audio tracks from a video then switch to selected audio track. Approach and Problem: I am using two ways because some time first way do not provide result in that case I am using second one and sometimes both do not get result while VLC media player shows video have audio tracks. I looked apple documentation https://developer.apple.com/library/mac/releasenotes/AudioVideo/RN-AVFoundation/index.html#//apple_ref/doc/uid/TP40010717-CH1-DontLinkElementID_1

How to set a transparent background for an AVVideoComposition?

帅比萌擦擦* 提交于 2019-12-21 05:14:14
问题 Update - I've added a 50 reputation bounty for answering this question! I have an application that needs to put together some videos and photos to create a movie out of them. I am using AVMutableComposition for that. To be able to instruct it how the videos get composed I have to use an AVMutableVideoComposition. This thing has a property called backgroundColor and Apple Documentation says: Only solid BGRA colors are supported; patterns and other supported colors are ignored. If the rendered

Mixing Images and Video using AVFoundation

ぐ巨炮叔叔 提交于 2019-12-21 04:51:13
问题 I'm trying to splice in images into a pre-existing video to create a new video file using AVFoundation on Mac. So far I've read the Apple documentation example, ASSETWriterInput for making Video from UIImages on Iphone Issues Mix video with static image in CALayer using AVVideoCompositionCoreAnimationTool AVFoundation Tutorial: Adding Overlays and Animations to Videos and a few other SO links Now these have proved to be pretty useful at times, but my problem is that I'm not creating a static