avassetwriter

Record video with AVAssetWriter

孤街醉人 提交于 2019-12-09 04:06:26
I'm trying to record video with AVAssetwriter but I keep getting NO when checking AVAssetWriterInput property readyForMoreMediaData before appending data. I saw related posts that mentioned similar problem when trying to record audio + video so I took out the audio recording part but the problem still occurs ( readyForMoreMediaData is always NO). My code: - (void)startRecordingWithAssetWriter { NSLog(@"Setting up capture session"); captureSession = [[AVCaptureSession alloc] init]; //----- ADD INPUTS ----- NSLog(@"Adding video input"); //ADD VIDEO INPUT AVCaptureDevice *videoCaptureDevice =

application crashed when make video from images

久未见 提交于 2019-12-08 05:52:32
问题 Please find the below code. -(void) writeImagesAsMovie:(NSArray *)array toPath:(NSString*)path numPhoto:(NSInteger)totPics { ALAsset *asset = [assets objectAtIndex:0]; ALAssetRepresentation *assetRepresentation = [asset defaultRepresentation]; UIImage *getImage = [UIImage imageWithCGImage:[assetRepresentation fullScreenImage] scale:[assetRepresentation scale] orientation:(UIImageOrientation)[assetRepresentation orientation]]; UIImage *first = [getImage imageByScalingAndCroppingForSize

Avmutable composition , lost orientation when adding audio to a video made with frames

怎甘沉沦 提交于 2019-12-08 04:44:58
问题 I've been working on a project of video processing. Until now I succeeded in filtering live camera feeds, capturing still images, recording video from frames, recording audio, and lately succeeded in adding audio to the video capture. But it seems like the video has lost its orientation - it should be rotated by 90 degrees clockwise. I tried to use the AVmutablevideocomposition, but whatever I do, I keep getting the following error: [__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty

how to use AVAssetWriter to write h264 strem into video?

孤人 提交于 2019-12-07 14:29:41
问题 I want to make the h.264 stream from server to a video file, but when I used assetwrite.finishwrite , the XCode reports Video /var/mobile/Applications/DE4196F1-BB77-4B7D-8C20-7A5D6223C64D/Documents/test.mov cannot be saved to the saved photos album: Error Domain=NSOSStatusErrorDomain Code=-12847 "This movie format is not supported." UserInfo=0x5334830 {NSLocalizedDescription=This movie format is not supported.}" Below is my code: data is the h.264 frame, just one frame, it might be i frame or

Memory Management issue with AVAssetWriter in iPhone?

北城以北 提交于 2019-12-07 08:08:36
问题 I have successfully created video from uiimages using AVAssetWriter. But as soon as the writer starts writing video theres a sudden rise in the memory allocation in the instruments. The spike in the memory allocation changes from 3-4 MB to 120MB and then cools off. I have used the following code for this... -(void)writeImageAsMovie:(NSArray *)array toPath:(NSString*)path size:(CGSize)size { NSMutableDictionary *attributes = [[NSMutableDictionary alloc]init]; [attributes setObject:[NSNumber

AVAssetWriter startWriting Problem

纵然是瞬间 提交于 2019-12-06 10:57:19
AVAssetWriter startWriting is returning BOOL False value when i'm writing movie on 2G device, but for all other devices its returning TRUE value and working fine.Anyone faced this problem or do you have any clue why its happening,help me please I am receiving false on startWriting on an iPad, when it works on both my iPhone3 and 4 (all have iOS 4.2). The status of the writer is failed, with the NSError as: "The operation couldn't be completed. (AVFoundationErrorDomain error -11800)." Creation of the writer yielded no error when creating with file type: AVFileTypeQuickTimeMovie, and the file

How to control video frame rate with AVAssetReader and AVAssetWriter?

一世执手 提交于 2019-12-06 08:28:51
问题 We are trying to understand how to control/specify the frame rate for videos that we are encoding with AVAssetReader and AVAssetWriter . Specifically, we are are using AVAssetReader and AVAssetWriter to transcode/encode/compress a video that we have accessed from the photo/video gallery. We are able to control things like bit rate, aspect ratio changes, etc., but cannot figure out how to control the frame rate. To be specific, we'd like to be able to take as input a 30 FPS video that's 5

iOS how to correctly handle orientation when capturing video using AVAssetWriter

爱⌒轻易说出口 提交于 2019-12-06 07:16:57
I am making a sample application that utilizes AVFoundation to record video. The whole point is so I can have more control over how the video is recorded. In my sample project I have the video capturing but am struggling with handling orientation correctly. I have done a lot of searching around the web and found that others are suggesting that I should NOT allow my capture view or capture session to rotate based on orientation, but rather set a transformation to rotate the video during playback. I have this working fine on iOS and Mac devices, but am wondering if I will have issues on other

Output Video Size Huge Using HEVC Encoder on iOS

时光毁灭记忆、已成空白 提交于 2019-12-06 04:57:21
I have a project that currently uses the H.264 encoder to record video on iOS. I wanted to try using the new HEVC encoder in iOS 11 to reduce file sizes, but have found that using the HEVC encoder causes file sizes to balloon enormously. Here's a project on GitHub that shows the issue - it simultaneously writes frames from the camera to files using the H.264 and H.265 (HEVC) encoders, and the resulting file sizes are printed to the console. The AVFoundation classes are setup like this: class VideoWriter { var avAssetWriterInput: AVAssetWriterInput var avAssetWriter: AVassetWriter init() { if

iOS reverse audio through AVAssetWriter

烈酒焚心 提交于 2019-12-06 03:41:35
问题 I'm trying to reverse audio in iOS with AVAsset and AVAssetWriter. The following code is working, but the output file is shorter than input. For example, input file has 1:59 duration, but output 1:50 with the same audio content. - (void)reverse:(AVAsset *)asset { AVAssetReader* reader = [[AVAssetReader alloc] initWithAsset:asset error:nil]; AVAssetTrack* audioTrack = [[asset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]; NSMutableDictionary* audioReadSettings = [NSMutableDictionary