avcomposition

AVPlayer and Progressive Video Downloads with AVURLAssets

烂漫一生 提交于 2019-12-03 07:28:26
问题 We've got an app we're working on that needs to provide playback of video files via AVPlayer. The files need to be stored on the user's device, but also must playback while downloading. At the moment we've built a download module that uses the ASIHTTPRequest library to get the video files via PHP (we don't want the media to be linkable via public URLs) and write them to disk asynchronously. We've then setup an AVPlayer as per the AV Foundation Programming Guide, getting the file with

How do I add a still image to an AVComposition?

筅森魡賤 提交于 2019-12-03 04:30:50
问题 I have an AVMutableComposition with a video track and I would like to add a still image into the video track, to be displayed for some given time. The still image is simply a PNG. I can load the image as an asset, but that’s about it, because the resulting asset does not have any tracks and therefore cannot be simply inserted using the insertTimeRange… methods. Is there a way to add still images to a composition? It looks like the answer is somewhere in Core Animation, but the whole thing

Compositing 2 videos on top of each other with alpha

社会主义新天地 提交于 2019-12-02 18:39:14
AVFoundation allows you to "compose" 2 assets (2 videos) as 2 "tracks", just like in Final Cut Pro, for example. The theory says I can have 2 videos on top of each other, with alpha, and see both. Either I'm doing something wrong, or there's a bug somewhere, because the following test code, although a bit messy, clearly states I should see 2 videos, and I only see one, as seen here: http://lockerz.com/s/172403384 -- the "blue" square is IMG_1388.m4v For whatever reason, IMG_1383.MOV is never shown. NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES]

How do I add a still image to an AVComposition?

半世苍凉 提交于 2019-12-02 17:43:11
I have an AVMutableComposition with a video track and I would like to add a still image into the video track, to be displayed for some given time. The still image is simply a PNG. I can load the image as an asset, but that’s about it, because the resulting asset does not have any tracks and therefore cannot be simply inserted using the insertTimeRange… methods. Is there a way to add still images to a composition? It looks like the answer is somewhere in Core Animation, but the whole thing seems to be a bit above my head and I would appreciate a code sample or some information pointers. OK.

Misaligned Sound Playback using AVPlayer and AVMutableComposition

大兔子大兔子 提交于 2019-12-01 07:30:23
问题 I'm trying to create a song from multiple instrument samples using AVComposition . When I play two sound assets at kCMTimeZero in an AVMutableComposition , I would expect them to play at the same time, but there is a very slight offset. This only happens on the first playthrough, so it would seem to be some kind of loading delay, but no matter what I try it doesn't go away. I've made sure to preload the sound asset tracks, preload the composition tracks, wait for the playerItem to be ready,

Inserting an HTTP stream into a AVMutableComposition

我们两清 提交于 2019-11-30 06:48:04
I am trying to insert an AVURLAsset of a AVPlayerItem that states AVPlayerItemStatusReadyToPlay into an AVMutableComposition like this: composition_ = [[AVMutableComposition alloc] init]; insertionPoint_ = kCMTimeZero; item_ = [[AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]] retain]; [item_ addObserver:self forKeyPath:@"status" options:0 context:nil]; player_ = [[AVPlayer playerWithPlayerItem:item_] retain]; [player_ addObserver:self forKeyPath:@"currentItem.duration" options:0 context:nil]; /** * append a player-item to

How to merge video and audio files?

£可爱£侵袭症+ 提交于 2019-11-29 23:06:26
问题 My question is: How to merge video and audio files that has almost the same duration? I searched and got some answers to this question. However when I try the code they gave, it just does not produce a "non-zero byte" movie. Could you take a look at it and see where it went wrong? -(void)putTogether { NSLog(@"Starting to put together all the files!"); AVMutableComposition *mixComposition = [AVMutableComposition composition]; NSString *audioPath = @"/Users/admin/Documents/Sound.caf"; NSURL

Inserting an HTTP stream into a AVMutableComposition

不问归期 提交于 2019-11-29 06:49:24
问题 I am trying to insert an AVURLAsset of a AVPlayerItem that states AVPlayerItemStatusReadyToPlay into an AVMutableComposition like this: composition_ = [[AVMutableComposition alloc] init]; insertionPoint_ = kCMTimeZero; item_ = [[AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]] retain]; [item_ addObserver:self forKeyPath:@"status" options:0 context:nil]; player_ = [[AVPlayer playerWithPlayerItem:item_] retain]; [player_