avasset

iOS: bug in AVPlayerItem when receiving `304 Not Modified` response

只谈情不闲聊 提交于 2019-12-10 21:50:47
问题 This is a very weird bug. I have a tableView with each cell using an AVPlayer to stream a video from a remote server (think a Vine-like timeline). So when I scroll, the cells that get reused reconfigure their player with the new video. The problem is: if I scroll back and forth very fast, getting the same video in and out of the screen, the request sent by the AVPlayer eventually changes, to include the HTTP Headers If-None-Match and If-Modified-Since , which are not there the rest of the

AVURLAsset Not Loading (.mov file)

守給你的承諾、 提交于 2019-12-10 14:51:40
问题 I am attempting to load a file called output.mov (created on the iPhone) as an AVURLAsset using the following code: NSURL *outputURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@%@", NSTemporaryDirectory(), @"output.mov"]]; AVURLAsset *videoAsset = [AVURLAsset URLAssetWithURL:outputURL options:nil]; The file is located in the tmp directory of the app. No errors appear, but it seems that the asset is not loaded as no metadata is available (i.e. calling NSLog(@"%@", [videoAsset

AVFoundation decode prores4444 movie with alpha channel

我怕爱的太早我们不能终老 提交于 2019-12-09 04:30:33
I'm trying to decode a prores4444 video with alpha channel on iOS with Swift to overlay as a complex animation over a user video and to export it to his library. The AVFoundation documentation is not that great and I'm struggling to find any code examples. When I try to use the code below with AVAssetReaderTrackOutput to decode the video I get an "AVAssetReaderOutput does not currently support compressed output" error. let avAssetReaderVideoCompositionOutput = AVAssetReaderVideoCompositionOutput(videoTracks: [videoOverlayAssetTrack], videoSettings: outputSettings: [AVVideoCodecKey:

AVFoundation - combine videos only one the first is displayed

风格不统一 提交于 2019-12-08 05:44:10
问题 I am trying to take a different approach at combining videos. I am creating a new track for each transformation. The problem with this code is that the first video is shown and all others are black. The audio overlay is correct for the entire segment. It looks like the video is not brought in to the composition because the size of the file is 5 M when it should be about 25M. The 5M size correlates to the size of the first clip and the audio track. All of the AVAssets appear to be valid. The

How to merge multiple videos using AVAsset in iOS?

允我心安 提交于 2019-12-07 23:41:28
I want to merge multiple videos into one. But i don't know how to do this so please help me for this issue. Below is my code but its not working for me. AVMutableComposition* mixComposition = [AVMutableComposition composition]; AVMutableCompositionTrack *compositionCommentaryTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; [compositionCommentaryTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset.duration) ofTrack:[[audioAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0] atTime:kCMTimeZero error:nil];

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

試著忘記壹切 提交于 2019-12-07 06:14:01
问题 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]

AVAsset “tracksWithMediaType” returns an empty array

余生颓废 提交于 2019-12-07 01:09:18
问题 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

iOS rotate video AVAsset avfoundation

别等时光非礼了梦想. 提交于 2019-12-06 22:36:24
Example Hi, Struggling to rotate this video to show in the proper orientation and fill the entire screen. I cannot get the avasset with videocompisition but cannot get it to work correctly. let videoAsset: AVAsset = AVAsset(URL: outputFileURL) as AVAsset let clipVideoTrack = videoAsset.tracksWithMediaType(AVMediaTypeVideo).first! as AVAssetTrack let newHeight = CGFloat(clipVideoTrack.naturalSize.height/3*4) let composition = AVMutableComposition() composition.addMutableTrackWithMediaType(AVMediaTypeVideo, preferredTrackID: CMPersistentTrackID()) let videoComposition = AVMutableVideoComposition

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

Reloading keys in AVAsset when status is AVKeyValueStatusFailed

旧街凉风 提交于 2019-12-06 03:40:25
问题 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