avassetwriter

create video from array of UIImages and save the video to iPhone library. AVAssetLibrary +AVFoundation

强颜欢笑 提交于 2019-12-03 04:04:32
问题 Problem in saving video to iPhone Library. i have an array of UIImages,and two buttons ,"convertToVideo"&"saveToiPhoneLib" -(IBAction) convertToVideo { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; NSString *savedVideoPath = [documentsDirectory stringByAppendingPathComponent:@"videoOutput"]; printf(" \n\n\n-Video file == %s--\n\n\n",[savedVideoPath UTF8String])

.wav to any compressed form from AVAssetWritter ios

南笙酒味 提交于 2019-12-03 03:59:20
Well the problem I am facing right now is a size issue problem. I am allowing the user to to choose a song from their library and then chop it up into pieces and then be able to use the .wav or .mp3 file on their computer with file sharing enabled. Basically I am using the following AVAssetWritter options and I keep getting a giant huge audio file. E.G. 5 minutes of music is about 50MB. I am looking to try and cut that down to an industry given standard size. I have a feeling it has to do with the fact I am using LinearPCM as one of my options but when I change that or any of the Audio Options

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

Using AVAssetWriter to create a movie from images is not working as expected on a 3GS device

ぃ、小莉子 提交于 2019-12-03 00:46:08
The call to appendPixelBuffer is returning NO on 3GS device (IOS 4.1), but is working well on iPhone 4 devices. The following call to appendPixelBuffer is the source of the problem: CVPixelBufferRef buffer = NULL; buffer = [self pixelBufferFromCGImage:[[UIImage imageNamed:@"frame1.png"] CGImage]]; BOOL result = [adaptor appendPixelBuffer:buffer withPresentationTime:kCMTimeZero]; if (result == NO) //failes on 3GS, but works on iphone 4 NSLog(@"failed to append buffer"); } Full Code: -(void)writeImagesAsMovie:(NSArray *)array toPath:(NSString*)path { NSLog(path); NSError *error = nil;

AVAssetWriter multiple sessions and the status property

时间秒杀一切 提交于 2019-12-03 00:24:52
I am attempting to create multiple, serial writing sessions with AVAssetWriter. Once I've completed one successfully (after calling finishWriting) the status is set to 2 (AVAssetWriterStatusCompleted). Trying to create another session, I call startWriting, but I get the error: [AVAssetWriter startWriting] cannot call method when status is 2 Seems I cannot create a writing session unless I configure something. Do I have to recreate the AVAssetWriter again? I must be missing something, and the docs aren't helping. Thanks. After the writer has completed it is no longer usable. You must create a

How to write a movie with video AND audio using AVAssetWriter?

…衆ロ難τιáo~ 提交于 2019-12-02 18:39:53
I want to export a movie with AVAssetWriter and can't figure out how to include video and audio tracks in sync. Exporting only video works fine, but when I add audio the resulting movie looks like this: First I see the video (without audio), then the video freezes (showing the last image frame until the end) and after some seconds I hear the audio. I tried some things with CMSampleBufferSetOutputPresentationTimeStamp (subtracting the first CMSampleBufferGetPresentationTimeStamp from the current) for the audio, but it all didn't work and I don't think it is the right direction, since video &

What does shouldOptimizeForNetworkUse actually do?

心不动则不痛 提交于 2019-12-02 18:13:35
From the Apple documentation it just says: When the value of this property is YES, the output file will be written in such a way that playback can start after only a small amount of the file is downloaded. But what is actually happening? Matti Savolainen When shouldOptimizeForNetworkUse is set to YES calling finishWriting will move the MP4 moov atom (movie atom) from the end of the file to the beginning of the file. The moov atom contains information about the movie file like timescale and duration. The moov also contains "subatoms" which contain information like the tracks, the data offsets

Filtering video with GPUImage

半腔热情 提交于 2019-12-02 09:25:29
问题 I'm using GPUImage in my application and trying to filter video. Live video filtering is working well. The trouble comes up when I try to read a video into memory from the filesystem and apply filters using the code posted on the sunsetlakessoftware tutorial page and in the SimpleVideoFileFilter demo. EDIT : I realized that my original post may not have been posing a specific enough question. What I am asking is: How exactly can I read a video from disk into memory, apply a GPUImageFilter,

Filtering video with GPUImage

爷,独闯天下 提交于 2019-12-02 08:21:58
I'm using GPUImage in my application and trying to filter video. Live video filtering is working well. The trouble comes up when I try to read a video into memory from the filesystem and apply filters using the code posted on the sunsetlakessoftware tutorial page and in the SimpleVideoFileFilter demo. EDIT : I realized that my original post may not have been posing a specific enough question. What I am asking is: How exactly can I read a video from disk into memory, apply a GPUImageFilter, and then overwrite the original with the filtered version? The application is crashing with the following

Record and play audio with AVAssetWriter

荒凉一梦 提交于 2019-12-02 04:49:21
I have reduced this question quite a bit and am hoping for some help. Basically this class has two methods, one to start recording audio ( -recordMode ) and the other to play audio ( playMode ). I currently have this class in a project with a single view controller with two buttons that call the corresponding methods (rec, play). There are no other variables, the class is self-contained. However it will not play/rec anything and I cannot figure out why. When I try to play the file I get a file size of 0 and an error because you cant init the AVAudioPlayer with a nil reference of course. But I