avfoundation

Merging NSData video files into one video file

大城市里の小女人 提交于 2019-12-03 17:32:49
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:@"%@%@", NSTemporaryDirectory(),@"outputConct.mov"], nil, nil, nil); after the video is saved in my camera

Capture still UIImage without compression (from CMSampleBufferRef)?

▼魔方 西西 提交于 2019-12-03 17:28:28
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 is a link to imageFromSampleBuffer function. But it does not work properly. :( There is a

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

荒凉一梦 提交于 2019-12-03 17:26: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 that suggested first way. My Code for getting Audio tracks -: - (NSArray *)getAvailableAudioTracks {

AVPlayer got the metadata but not playing

南楼画角 提交于 2019-12-03 17:22:38
I'm trying to do a very simple application, the purpose is listening an audio stream ( AAC 64 kbps ). To do so I'm using AVPlayer from the Apple AVFoundation has follow : ViewController.m #import "ViewController.h" @interface ViewController () @end @implementation ViewController @synthesize playerItem, player; - (void)viewDidLoad { [super viewDidLoad]; } - (void) viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://stream.myjungly.fr/MYJUNGLY2"]]; [playerItem addObserver:self forKeyPath:@"timedMetadata"

I want to change the sample rate from my input node from 44100 to 8000

余生颓废 提交于 2019-12-03 17:21:55
I want to read the buffer from my microphone into an array, with 441khz its working fine but with the sample rate 8khz it comes to an error ERROR: >avae> AVAudioIONodeImpl.mm:884: SetOutputFormat: required condition is false: format.sampleRate == hwFormat.sampleRate 2016-11-26 19:32:40.674 Atem[5800:1168274] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: format.sampleRate == hwFormat.sampleRate' with my following code : var engine = AVAudioEngine() func setup() { print("new") let input = engine.inputNode! let bus = 0 let

Play video on the android recorded from the iPhone

人盡茶涼 提交于 2019-12-03 17:20:01
问题 I am writing video based social app for iOS and android(WinPhone is under waiting). I recorded video in mov format using AVFoundation framework on the iPhone and uploaded it to the server. It can be downloaded and played on the iPhone client. But on the android device, downloaded video can not be played since it's format is not supported on the android. What is the best solution of the video record and play for supporting multiple mobile devices platforms? 回答1: Blog post @Why Apple Is Winning

I wish i could mute shutter sound of camera using ios sdk [duplicate]

这一生的挚爱 提交于 2019-12-03 17:08:58
This question already has an answer here: AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection? 9 answers Right now I've been trying to mute my shutter sound when capturing an image in iOS SDK but unable to do it. Is there any way of kind of code available for it (Actually, I wanted to trace a fake person from my chat app) I've seen: Muting AVCapture shutter sound on iPhone How to mute the capture sound in AVFoundation? AVFoundation, how to turn off the shutter sound when captureStillImageAsynchronouslyFromConnection? But I have not succeeded yet.

AVAssetWriter unknown error

微笑、不失礼 提交于 2019-12-03 16:48:25
问题 Am trying to create video from images using AVAssetWriter . Implemented code works fine most of time, but in random moments there is problem with writer AVAssetWriter *videoWriter; ... [videoWriter finishWriting]; NSLog(@"videoWriter error %@",videoWriter.error); Received error is: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x1f839cd0 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x1e59efb0 "The operation

Recording videos with real-time filters in Swift

随声附和 提交于 2019-12-03 16:34:36
I am new to swift and trying to build a camera app which can apply real-time filters, and save with the applied filters. So far i can preview real-time with the applied filters, but when i save the video its all black. import UIKit import AVFoundation import AssetsLibrary import CoreMedia import Photos class ViewController: UIViewController , AVCaptureVideoDataOutputSampleBufferDelegate { var captureSession: AVCaptureSession! @IBOutlet weak var previewView: UIView! @IBOutlet weak var recordButtton: UIButton! @IBOutlet weak var imageView: UIImageView! var assetWriter: AVAssetWriter? var

Play socket-streamed h.264 movie on iOS using AVFoundation

梦想与她 提交于 2019-12-03 16:29:42
问题 I’m working on a small iPhone app which is streaming movie content over a network connection using regular sockets. The video is in H.264 format. I’m however having difficulties with playing/decoding the data. I’ve been considering using FFMPEG , but the license makes it unsuitable for the project. I’ve been looking into Apple’s AVFoundation framework ( AVPlayer in particular), which seems to be able to handle h264 content, however I’m only able to find methods to initiate the movie using an