avassetreader

AVfoundation Reverse Video

我的梦境 提交于 2019-12-04 05:14:36
I tried to make video in reverse. While playing asset in AVPlayer i set the rate = -1 to make it work in reverse format. But how to export that video? I looked into docs. read about avassetwrite, sambuffers , compositions but didn't find any way to do this. Below links are refered by me http://www.raywenderlich.com/13418/how-to-play-record-edit-videos-in-ios Reverse video demo - https://github.com/mikaelhellqvist/ReverseClip Above example to no longer works in IOS 8. and even it is not reversing audio. If anyone give me little hint on it then i can do further. I am stuck up here from last 5

AVAssetWriter How to write down-sampled/compressed m4a/mp3 files

為{幸葍}努か 提交于 2019-12-03 03:04:57
I'm trying to take a local m4a or mp3 file and compress/down-sample this file (for the purposes of making a smaller file). Originally, I was using the AVAssetExportSession to export an AVAsset to a temp directory, but I didn't have any control over compression/down-sampling (you can only use presets, which of them, only .wav file formats support quality degradation). Then, following several examples here on SO, I tried using AVAssetReader/AVAssetWriter to preform this 'export'. I create my reader/writer as such: NSString *exportPath = [NSHomeDirectory() stringByAppendingPathComponent:@"out.m4a

AVFoundation to reproduce a video loop

扶醉桌前 提交于 2019-12-02 03:31:28
I need to reproduce a video indefinitely (restarting the video when it ends) in my OpenGL application. To do so I'm trying to utilize AV foundation. I created an AVAssetReader and an AVAssetReaderTrackOutput and I utilize the copyNextSampleBuffer method to get CMSampleBufferRef and create an OpenGL texture for each frame. NSString *path = [[NSBundle mainBundle] pathForResource:videoFileName ofType:type]; _url = [NSURL fileURLWithPath:path]; //Create the AVAsset _asset = [AVURLAsset assetWithURL:_url]; //Get the asset AVAssetTrack NSArray *arrayAssetTrack = [_asset tracksWithMediaType

AVFoundation to reproduce a video loop

本秂侑毒 提交于 2019-12-02 02:06:02
问题 I need to reproduce a video indefinitely (restarting the video when it ends) in my OpenGL application. To do so I'm trying to utilize AV foundation. I created an AVAssetReader and an AVAssetReaderTrackOutput and I utilize the copyNextSampleBuffer method to get CMSampleBufferRef and create an OpenGL texture for each frame. NSString *path = [[NSBundle mainBundle] pathForResource:videoFileName ofType:type]; _url = [NSURL fileURLWithPath:path]; //Create the AVAsset _asset = [AVURLAsset

AVAssetReader to AudioQueueBuffer

白昼怎懂夜的黑 提交于 2019-12-01 11:15:33
Currently, I'm doing a little test project to see if I can get samples from an AVAssetReader to play back using an AudioQueue on iOS. I've read this: ( Play raw uncompressed sound with AudioQueue, no sound ) and this: ( How to correctly read decoded PCM samples on iOS using AVAssetReader -- currently incorrect decoding ), Which both actually did help. Before reading, I was getting no sound at all. Now, I'm getting sound, but the audio is playing SUPER fast. This is my first foray into audio programming, so any help is greatly appreciated. I initialize the reader thusly: NSDictionary *

AVAssetReader to AudioQueueBuffer

南楼画角 提交于 2019-12-01 08:42:37
问题 Currently, I'm doing a little test project to see if I can get samples from an AVAssetReader to play back using an AudioQueue on iOS. I've read this: ( Play raw uncompressed sound with AudioQueue, no sound ) and this: ( How to correctly read decoded PCM samples on iOS using AVAssetReader -- currently incorrect decoding ), Which both actually did help. Before reading, I was getting no sound at all. Now, I'm getting sound, but the audio is playing SUPER fast. This is my first foray into audio

How to correctly read decoded PCM samples on iOS using AVAssetReader — currently incorrect decoding

我怕爱的太早我们不能终老 提交于 2019-11-29 23:24:03
I am currently working on an application as part of my Bachelor in Computer Science. The application will correlate data from the iPhone hardware (accelerometer, gps) and music that is being played. The project is still in its infancy, having worked on it for only 2 months. The moment that I am right now, and where I need help, is reading PCM samples from songs from the itunes library, and playing them back using and audio unit. Currently the implementation I would like working does the following: chooses a random song from iTunes, and reads samples from it when required, and stores in a

Video Encoding using AVAssetWriter - CRASHES

霸气de小男生 提交于 2019-11-27 18:24:00
I have a function that is supposed to re-encode a video to a manageable bitrate on iphone/ipad. Here it is: * UPDATED WORKING CODE, NOW WITH AUDIO! :) * -(void)resizeVideo:(NSString*)pathy{ NSString *newName = [pathy stringByAppendingString:@".down.mov"]; NSURL *fullPath = [NSURL fileURLWithPath:newName]; NSURL *path = [NSURL fileURLWithPath:pathy]; NSLog(@"Write Started"); NSError *error = nil; AVAssetWriter *videoWriter = [[AVAssetWriter alloc] initWithURL:fullPath fileType:AVFileTypeQuickTimeMovie error:&error]; NSParameterAssert(videoWriter); AVAsset *avAsset = [[[AVURLAsset alloc]

Reading samples via AVAssetReader

柔情痞子 提交于 2019-11-27 06:50:54
How do you read samples via AVAssetReader? I've found examples of duplicating or mixing using AVAssetReader, but those loops are always controlled by the AVAssetWriter loop. Is it possible just to create an AVAssetReader and read through it, getting each sample? Thanks. It's unclear from your question whether you are talking about video samples or audio samples. To read video samples, you need to do the following: Construct an AVAssetReader: asset_reader = [[AVAssetReader alloc] initWithAsset:asset error:&error]; (error checking goes here) Get the video track(s) from your asset: NSArray* video

Reading samples via AVAssetReader

一世执手 提交于 2019-11-26 12:12:25
问题 How do you read samples via AVAssetReader? I\'ve found examples of duplicating or mixing using AVAssetReader, but those loops are always controlled by the AVAssetWriter loop. Is it possible just to create an AVAssetReader and read through it, getting each sample? Thanks. 回答1: It's unclear from your question whether you are talking about video samples or audio samples. To read video samples, you need to do the following: Construct an AVAssetReader: asset_reader = [[AVAssetReader alloc]