avassetexportsession

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

Exporting videos on iOS: understanding and setting frame duration property?

♀尐吖头ヾ 提交于 2019-12-02 10:07:43
In this tutorial on merging videos, the author sets the frame duration for the exported video to 30 FPS. 1) Instead of fixing the frame duration to 30 FPS, shouldn't the frame duration be tied to the frame duration of the videos getting merged? 2) When exporting videos, what are the pros/cons of using a different FPS for the exported video that differs from the source video(s)? Is this one way of speeding up export time at the expense of video quality? For instance, what if the source videos in the tutorial were captured at 24 FPS? We need to export videos on iOS, sometimes merging multiple

AVAssetExportSession using AVAssetExportPresetPassthrough breaking output

Deadly 提交于 2019-12-02 09:12:40
I'm using AVAssetExportSession in combination with AVAssetExportPresetPassthrough to stitch multiple videos together. Everything works quite fine, except after my first sub-clip should have finished, it's picture "freezes" on the last frame but the second is not going to play. I made sure to set the layer opacity to 0.0f once each clip has finished, if I use another Preset-Type everything works... Any hints? I got in touch with Apple, they told me this is a bug, please find the the bugreport here : https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/3/wo/zpx0I9jVzf8090ZICwg1GM/5.83.28

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:

iOS - Reversing video file (.mov)

戏子无情 提交于 2019-12-01 16:45:15
Requirement : It sounds like litte different but this is what I want to achieve. I want to make movie (.mov) file in reverse. Just like how we rewind the movie file. I also want maintain same frame rate as my video is containing. NOTE: I do not just want to play video file in reverse order. I want to generate new movie file playing in reverse order. My Exploration : I thought of below steps to perform to do the same. Make chunks of video files with specific frame rate using AVAssetExportSession Merge all these video chunks into single movie file using AVMutableComposition and

iOS - Reversing video file (.mov)

偶尔善良 提交于 2019-12-01 15:47:30
问题 Requirement : It sounds like litte different but this is what I want to achieve. I want to make movie (.mov) file in reverse. Just like how we rewind the movie file. I also want maintain same frame rate as my video is containing. NOTE: I do not just want to play video file in reverse order. I want to generate new movie file playing in reverse order. My Exploration : I thought of below steps to perform to do the same. Make chunks of video files with specific frame rate using

Simulate AVLayerVideoGravityResizeAspectFill: crop and center video to mimic preview without losing sharpness

感情迁移 提交于 2019-12-01 12:04:17
Based on this SO post , the code below rotates, centers, and crops a video captured live by the user. The capture session uses AVCaptureSessionPresetHigh for the preset value, and the preview layer uses AVLayerVideoGravityResizeAspectFill for video gravity. This preview is extremely sharp. The exported video, however, is not as sharp, ostensibly because scaling from the 1920x1080 resolution for the back camera on the 5S to 320x568 (target size for the exported video) introduces fuzziness from throwing away pixels? Assuming there is no way to scale from 1920x1080 to 320x568 without some

Writing ID3 tags via AVMetaDataItem

我们两清 提交于 2019-11-30 22:52:30
I'm writing ID3 tags to a file using AVMetaDataItem var soundFileMetadata = [AVMetadataItem]() soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyArtist, "MyArtist")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeySongName, "MySong")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyAlbum, "MyAlbum")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyUserGenre, "MyGenre")!) soundFileMetadata.append(createMetadata(AVMetadataiTunesMetadataKeyComposer, "MyComposer")!) Here is the createMetadata convenience method: func

Long delay before seeing video when AVPlayer created in exportAsynchronouslyWithCompletionHandler

微笑、不失礼 提交于 2019-11-30 18:48:36
问题 When playing a video exported from a AVAssetExportSession , you hear audio long before seeing video. Audio plays right away, but video only appears after the recording loops several times (i.e., starts and finishes). In other words, you hear audio from the video multiple times before seeing any images. We are using AutoLayout on iOS 8. Using the following test, we isolated the problem to exportAsynchronouslyWithCompletionHandler . In both code blocks, we play an existing video -- not one

Setting AVMutableComposition's frameDuration

我与影子孤独终老i 提交于 2019-11-30 09:54:45
I'm playing with the AVEditDemo project, from Apple's WWDC 2010 sample pack, and I'm trying to change the frame rate of the exported video. The video is exported using an AVMutableComposition on which the frameDuration is set like that: videoComposition.frameDuration = CMTimeMake(1, 30); // 30 fps For some reason, changing the 30 to 25 does not change the framerate of the video exported with the AVAssetExportSession . Does anyone have an idea why? MonsieurDart It seems that the AVAssetExportSession preset takes precedence over the AVVideoComposition frameDuration . I've opened a bug report: