avfoundation

How to play audio sample buffers from AVCaptureAudioDataOutput

狂风中的少年 提交于 2019-11-30 18:23:34
问题 The main goal of the app Im trying to make is a peer-to-peer video streaming. (Sort of like FaceTime using bluetooth/WiFi). Using AVFoundation, I was able to capture video/audio sample buffers. Then Im sending the video/audo sample buffer data. Now the problem is to process the sample buffer data in the receiving side. As for the video sample buffer, I was able to get a UIImage from the sample buffer. But for the audio sample buffer, I dont know how to process it so I can play the audio. So

Play background music in app?

南笙酒味 提交于 2019-11-30 18:13:21
I want the user to be able to open the app and have music start playing. I want the user to be able to go any view controller and return back to the initial one without the music stopping. I want it to loop indefinitely. I have tried to put in the viewDidLoad method of the initial view controller for it to start playing. What happens is, the user leaves the initial view controller and when they come back, the music starts playing again, overlapping the original copy. To remedy this, I put an if statement checking if the sound is already to playing to not launch another copy and the viewDidLoad

Output from AVAssetWriter (UIImages written to video) distorted

丶灬走出姿态 提交于 2019-11-30 17:43:32
问题 I am using an AVAssetWriter to encode a series of images to a movie file, following Zoul's answer here: How do I export UIImage array as a movie?. In short my process is: create UIImage from .png file Get CGImage from UIImage convert the CGImage to CVPixelBuffer (using zoul's function pixelBufferFromCGImage exactly) write the frames to .mov using a AVAssetWriterInputPixelBufferAdaptor and AVAssetWriter This is working fine in most cases, however sometimes the .mov file that is encoded is

AVFoundation iOS 5

给你一囗甜甜゛ 提交于 2019-11-30 17:27:58
My apps runing on the appstore are using mp3 and video files that don't work since iOS5 update . I've installed xcode 4.2 and... When I test in the iPhone 5 Simulator or device I get the following error (for audio or video files): Error loading System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn: dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable Referenced from: /System/Library/Frameworks/Security.framework

How to record video in ProRes codec on iOS?

人走茶凉 提交于 2019-11-30 17:17:22
I would like to capture video from device’s back camera directly to ProRes codec, now that .proRes422 and .proRes4444 are available as AVVideoCodecType options in iOS 11. But I receive an error that recording is: unsupported given the current configuration On both iPhone X and second generation iPad Pro, when trying to capture video with the following code: movieFileOutput.setOutputSettings([AVVideoCodecKey: AVVideoCodecType.proRes422], for: movieFileOutputConnection!) If this approach is wrong, can the captured video be encoded by using AVCaptureVideoDataOutput alongside AVAssetWriter ? I

Square video using AVFoundation

家住魔仙堡 提交于 2019-11-30 16:43:25
I followed the given tutorial to create a custom square video recording camera. http://www.netwalk.be/article/record-square-video-ios I am able to export a square video from this, but when i try to play the newly exported file using the url it does not play. For the original url ,i tried was working fine and playing properly. I opened the documents directory of the phone and found that the video was getting cropped and a file was created but playing the video on quicktimeplayer it was appearing very slow and seemed to play in frame by frame manner i.e. too slow. (Don't know whether it was an

Swift IOS Record Video and Audio with AVFoundation

你。 提交于 2019-11-30 16:42:35
I was able to successfully grab the recorded video by following this question here Basically Inherit from AVCaptureFileOutputRecordingDelegate prototype Loop through available devices Creating a session with the camera Start Recording Stop Recording Get the Record video by implementing above prototype's method But the file doesn't comes with the audio. According to this question, i have to record audio separately and merge the video and audio using mentioned classes But i have no idea how to implement video and audio recording at the same time. for device in devices { // Make sure this

Error Domain=AVFoundationErrorDomain Code=-11821 “Cannot Decode”

谁说我不能喝 提交于 2019-11-30 16:10:12
问题 There's a strange behaviour I've found when trying to merge videos with AVFoundation. I'm pretty sure that I've made a mistake somewhere but I'm too blind to see it. My goal is just to merge 4 videos (later there will be crossfade transition between them). Everytime I'm trying to export video I get this error: Error Domain=AVFoundationErrorDomain Code=-11821 "Cannot Decode" UserInfo=0x7fd94073cc30 {NSLocalizedDescription=Cannot Decode, NSLocalizedFailureReason=The media data could not be

AVPlayer plays video composition result incorrectly

醉酒当歌 提交于 2019-11-30 15:41:44
I need a simple thing: play a video while rotating and applying CIFilter on it. First, I create the player item: AVPlayerItem *item = [AVPlayerItem playerItemWithURL:videoURL]; // DEBUG LOGGING AVAssetTrack *track = [[item.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; NSLog(@"Natural size is: %@", NSStringFromCGSize(track.naturalSize)); NSLog(@"Preffered track transform is: %@", NSStringFromCGAffineTransform(track.preferredTransform)); NSLog(@"Preffered asset transform is: %@", NSStringFromCGAffineTransform(item.asset.preferredTransform)); Then I need to apply the video

How to get another app's currently playing audio [duplicate]

只谈情不闲聊 提交于 2019-11-30 15:34:26
This question is an exact duplicate of: Audio Information of Current Track iOS Swift 1 answer How can I access another app's currently playing audio - the actual audio item but metadata is welcome too. I can see that this question has been asked a lot but with few solutions being offered over the years. I understand apple's philosophy for probably not wanting an app to be able to do this. I also understand that such a request is probably outside of the iOS API. With that being said, I would really like some kind of solution. Logically, I feel that MPNowPlayingInfoCenter.defaultCenter()