avasset

Processing all frames in an AVAsset

我怕爱的太早我们不能终老 提交于 2019-12-05 19:10:54
I am trying to go through each frame in an AVAsset and process each frame as if it were an image. I have not been able to find anything from my searches. The task I am trying to accomplish would look like this in pseudo-code for each frame in asset take the frame as an image and convert to a cvMat Process and store data of center points Store center points in array The only part in that pseudo-code I do not know how to write is the going though each frame and capturing it in an image. Can anyone help? One answer is to use AVAssetImageGenerator . 1) Load the movie file into an AVAsset object. 2

iOS- how to get the duration of .mp4 file by using AVAsset or AVURLAsset

左心房为你撑大大i 提交于 2019-12-05 10:49:53
i know duration of video type questions have been answered before but i am facing real trouble in getting duration of an .mp4 file by using AVAsset and by AVURLAsset . i am using Following code NSString *itemPathString = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0] stringByAppendingPathComponent:obmodel.actualname]; NSURL *itemPathURL = [NSURL URLWithString:itemPathString]; if([[NSFileManager defaultManager] fileExistsAtPath:itemPathString]){ NSLog(@"File Exists"); } AVAsset *videoAsset = (AVAsset *)[AVAsset assetWithURL:itemPathURL];

Get a particular frame by time value using AVAssetReader

六眼飞鱼酱① 提交于 2019-12-05 09:52:02
问题 I have checked this http://www.7twenty7.com/blog/2010/11/video-processing-with-av-foundation to get a video frame by frame. But my real requirement is to get a frame at particular time. I know that it should be possible by AVAssetReader , I wonder is there any direct method for this in AVAssetReader . Please give any guidance on how can I get frame at particular time. I checked the AVAssetImageGenerator but this is not the thing I really wanted. Finally I found the answer, you have to use

AVAsset “tracksWithMediaType” returns an empty array

雨燕双飞 提交于 2019-12-05 04:34:52
These is the beginning o a method I am using to merge videos together -(void) mergeVideosAndAudio:(AVAsset *)audioAsset{ //Load Video Assets NSError *error; NSArray *dirFiles; if ((dirFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:[self documentsDirectory] error:&error]) == nil) { // handle the error }; // find all the temp files NSArray *movFiles = [dirFiles filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self BEGINSWITH 'temp'"]]; NSLog(@"The are %i temp files",movFiles.count); //Create assets array NSMutableArray *assets = [[NSMutableArray alloc]init]; for

Extract video portion from Live Photo

非 Y 不嫁゛ 提交于 2019-12-04 09:48:02
问题 Has anyone figured out how to extract the video portion from a Live Photo? I'm working on an app to convert Live Photos into a GIF, and the first step is to get the video file from the Live Photo. It seems like it should be possible, because if you plug in your phone to a Mac you can see the separate image and video files. I've kinda run into a brick wall in the extraction process, and I've tried many ways to do it and they all fail. The first thing I did was obtain a PHAsset for what I think

Reloading keys in AVAsset when status is AVKeyValueStatusFailed

依然范特西╮ 提交于 2019-12-04 07:15:23
I'm doing the following: Create a new AVAsset with a given URL. That URL points to a video on a remote web server. Attempt to load the tracks property by calling loadValuesAsynchronouslyForKeys:completionHandler: The initial request fails, because no internet connection exists I notice that the request failed by calling statusOfValueForKey:error: I then wait for the connection to re-appear (using some reachability code). As soon as it does, I call loadValuesAsynchronouslyForKeys:completionHandler: again. Here's where the problems begin. I would imagine that the AVAsset goes ahead and attempts

Crop area different than Selected Area in iOS?

若如初见. 提交于 2019-12-03 16:10:10
Here is link on github https://github.com/spennyf/cropVid/tree/master to try it out your self and see what I am talking about it would take 1 minute to test. Thanks! I am taking a video with a square to show what part of vid will be cropped. Like this: Right now I am doing this of a piece of paper with 4 lines in the square, and half a line difference on top and bottom. And then I crop the video using code I will post, but then when I display the video I see this (Ignore background and green circle): As you can see there are more than four lines, so I am setting it to crop a certain part but

SWIFT - Is it possible to save audio from AVAudioEngine, or from AudioPlayerNode? If yes, how?

可紊 提交于 2019-12-03 07:50:41
问题 I've been looking around Swift documentation to save an audio output from AVAudioEngine but I couldn't find any useful tip. Any suggestion? Solution I found a way around thanks to matt's answer. Here a sample code of how to save an audio after passing it through an AVAudioEngine (i think that technically it's before) newAudio = AVAudioFile(forWriting: newAudio.url, settings: nil, error: NSErrorPointer()) //Your new file on which you want to save some changed audio, and prepared to be bufferd

Trimming video with Monotouch fails with “The operation could not be completed”

冷暖自知 提交于 2019-12-02 17:07:26
问题 I am trying to trim a video to 5 seconds programmatically. Here is my implementation. AVAssetExportSession exportSession= new AVAssetExportSession(videoAsset,AVAssetExportSession.PresetLowQuality.ToString()); int SystemVersion = Convert.ToInt16(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]); string filename; if (SystemVersion >= 8) { var documents = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User)[0].Path; filename = Path.Combine

Trimming video with Monotouch fails with “The operation could not be completed”

主宰稳场 提交于 2019-12-02 10:13:23
I am trying to trim a video to 5 seconds programmatically. Here is my implementation. AVAssetExportSession exportSession= new AVAssetExportSession(videoAsset,AVAssetExportSession.PresetLowQuality.ToString()); int SystemVersion = Convert.ToInt16(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]); string filename; if (SystemVersion >= 8) { var documents = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User)[0].Path; filename = Path.Combine(documents, "trimmed.mov"); } else { var documents = Environment.GetFolderPath(Environment.SpecialFolder