avmutablecomposition

White video when opening AVMutableComposition in Instagram

若如初见. 提交于 2019-12-04 06:46:44
After I export an AVMutableComposition I use PHPhotoLibrary to save the video to the camera roll. In the creationRequestForAssetFromVideoAtFileURL: completion handler, I then open the saved video in Instagram, like so: __block PHObjectPlaceholder *videoAssetPlaceholder; [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ PHAssetChangeRequest *req = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:localVideoURL]; videoAssetPlaceholder = req.placeholderForCreatedAsset; } completionHandler:^(BOOL success, NSError *error) { if (success) { completion(YES); NSString *localID =

AVfoundation Reverse Video

我的梦境 提交于 2019-12-04 05:14:36
I tried to make video in reverse. While playing asset in AVPlayer i set the rate = -1 to make it work in reverse format. But how to export that video? I looked into docs. read about avassetwrite, sambuffers , compositions but didn't find any way to do this. Below links are refered by me http://www.raywenderlich.com/13418/how-to-play-record-edit-videos-in-ios Reverse video demo - https://github.com/mikaelhellqvist/ReverseClip Above example to no longer works in IOS 8. and even it is not reversing audio. If anyone give me little hint on it then i can do further. I am stuck up here from last 5

Merging two m4v Movie Files Using AVMutableComposition - Videos Will Not Merge

佐手、 提交于 2019-12-04 04:57:52
问题 I am using the below code to try and merge two m4v files stored in the documents folder : CMTime insertionPoint = kCMTimeZero; NSError * error = nil; AVMutableComposition *composition = [AVMutableComposition composition]; AVURLAsset* asset = [AVURLAsset URLAssetWithURL: [assetURLArray objectForKey:kIntroVideo] options:nil]; if (![composition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset.duration) ofAsset:asset atTime:insertionPoint error:&error]) { NSLog(@"error: %@",error); }

Transform not working in AVMutableVideoComposition while exporting

自作多情 提交于 2019-12-04 01:33:13
My goal is to compose a set of clips recorded from the camera and export them at a certain preferred size. Of course, the video orientation needs to be rotated before exporting. I'm doing this by composing an AVMutableComposition from an array of video clips, stored in avAssets below. I am able to compose them fine, and export it. However, the rotation transform I am setting on the AVMutableVideoComposition is not being honored. If I use the same transform and set it on the preferredTransform property of the video track, then it works. In both cases, the video renderSize is not being honored.

Composing video and audio using AVMutableComposition

倖福魔咒の 提交于 2019-12-03 12:53:33
I have a weird problem. In my app I am combining multiple audio and video files using the code below. The resulted video seems to work fine once I downloaded it from the device to the computer and play with Quick Time, but whenever I am trying to play the newly composed video using either UIWebView or AVPLayer I can only see first part of merged video files. Furthermore when I tried to use MPMoviePlayerController to play it hangs on "Loading". I can hear audio for all composition. To make it clear I have two arrays: 1- audioPieces with paths to audio files [song1, song2, song3]; 2- moviePieces

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

Merging audio and video Swift

自古美人都是妖i 提交于 2019-12-02 19:24:27
问题 Im trying to merge N audio tracks, to an video file. The video is in MP4 format, and all audios are m4a. All the preparation works well but when the export finishes, always fails. Heres my code : func mixAudioAndVideo() { self.player?.pause() let mixComposition = AVMutableComposition() let paths = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) let docsDirect = paths[0] for audioTrack in self.audioTracks { let musicFile = docsDirect

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.

Create video with AVVideoCompositionCoreAnimationTool and AVAssetExportSession SLOW

回眸只為那壹抹淺笑 提交于 2019-12-02 09:06:34
I create an animation with layers and I want to export a video with that animations. So I use AVAssetExportSession, but it take a long time to export. Maybe I can use another thing? I really need help! let videoURL = NSURL.init(fileURLWithPath: "/Users/Downloads/img_2040.mp4") let audioURL = NSURL.init(fileURLWithPath: "/Users/Downloads/music_10sm.m4a") let videoAsset = AVURLAsset.init(url: videoURL as URL) let audioAsset = AVURLAsset.init(url: audioURL as URL) let mixComposition = AVMutableComposition.init() let compositionVideoTrack = mixComposition.addMutableTrack(withMediaType:

Using AVMutableComposition iPhone

限于喜欢 提交于 2019-12-02 04:59:14
问题 I am using the below code, for streaming the two videos sequentially. But it is not showing any video in the simulator, its totally blank. Also how can I seek through these two videos. Like, if one video is of 2 minutes and the second is 3 minutes. Now I need to get the total time of these videos and seek through them. When I slide the slider bar to 4 minutes so the 2nd video should be played from minute 2 to onward. Is it possible? - (void)viewDidLoad { [super viewDidLoad]; // Do any