avassetexportsession

AVFoundation exporting orientation wrong

大兔子大兔子 提交于 2019-12-03 06:54:43
I'm attempting to combine an image and a video. I have them combining and exporting however it's rotated side ways. Sorry for the bulk code paste. I've seen answers about applying a transform to compositionVideoTrack.preferredTransform however that does nothing. Adding to AVMutableVideoCompositionInstruction does nothing also. I feel like this area is where things start to go wrong. here here: // I feel like this loading here is the problem let videoTrack = videoAsset.tracksWithMediaType(AVMediaTypeVideo)[0] // because it makes our parentLayer and videoLayer sizes wrong let videoSize =

What does shouldOptimizeForNetworkUse actually do?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 04:54:18
问题 From the Apple documentation it just says: When the value of this property is YES, the output file will be written in such a way that playback can start after only a small amount of the file is downloaded. But what is actually happening? 回答1: When shouldOptimizeForNetworkUse is set to YES calling finishWriting will move the MP4 moov atom (movie atom) from the end of the file to the beginning of the file. The moov atom contains information about the movie file like timescale and duration. The

AVVideoCompositionCoreAnimationTool and CALayer in portrait mode?

烂漫一生 提交于 2019-12-03 03:44:05
问题 I'm trying to bake a CALayer into portrait-mode video (on export) using an AVMutableComposition, an AVMutableVideoComposition and a AVVideoCompositionCoreAnimationTool on iOS 4.3. This all works in landscape. If I capture video in portrait, however, the AVVideoCompositionCoreAnimationTool is ignoring the transform on the video track. That is, for portrait-mode video, I am setting AVMutableCompositionTrack.preferredTransform to the preferredTransform value from the original asset video track.

How do make a reduced size video using AVAssetWriter?

白昼怎懂夜的黑 提交于 2019-12-03 02:04:47
问题 I would make reduced size video, maybe 50 pixel across and 75 pixels for length. Those are the physical dimension. How do you set that? in the videosettings? I think AVVideoWidthKey and AVVideoHeightKey are more for resolution not for physically dimension which what I needed. NSDictionary *videoSettings = [NSDictionary dictionaryWithObjectsAndKeys: AVVideoCodecH264, AVVideoCodecKey, [NSNumber numberWithInt: 320], AVVideoWidthKey, [NSNumber numberWithInt:480], AVVideoHeightKey, nil];

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

杀马特。学长 韩版系。学妹 提交于 2019-12-02 21:26:22
问题 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

Progress bar for AVAssetExportSession

橙三吉。 提交于 2019-12-02 20:38:14
I've got an app that exports an AVMutableComposition into a .mov file, and I'd like for the user to see the status of the export with a progress bar the same way that you would if you sent a text message or uploaded a file. I know how to create a progress bar when I know the duration of a task (such as playing an audio file), but since there's no set duration for the export I'm unsure how to proceed. I've got an activity indicator currently but it doesn't provide the best user experience. Does anyone have any pointers? Orpheus Mercury I came up with an answer a while back so I'll post it in

What does shouldOptimizeForNetworkUse actually do?

心不动则不痛 提交于 2019-12-02 18:13:35
From the Apple documentation it just says: When the value of this property is YES, the output file will be written in such a way that playback can start after only a small amount of the file is downloaded. But what is actually happening? Matti Savolainen When shouldOptimizeForNetworkUse is set to YES calling finishWriting will move the MP4 moov atom (movie atom) from the end of the file to the beginning of the file. The moov atom contains information about the movie file like timescale and duration. The moov also contains "subatoms" which contain information like the tracks, the data offsets

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

AVAssetExportSession using AVAssetExportPresetPassthrough breaking output

浪尽此生 提交于 2019-12-02 16:59:37
问题 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? 回答1: I got in touch with Apple, they told me this is a bug, please find the the

AVVideoCompositionCoreAnimationTool and CALayer in portrait mode?

点点圈 提交于 2019-12-02 15:59:44
I'm trying to bake a CALayer into portrait-mode video (on export) using an AVMutableComposition, an AVMutableVideoComposition and a AVVideoCompositionCoreAnimationTool on iOS 4.3. This all works in landscape. If I capture video in portrait, however, the AVVideoCompositionCoreAnimationTool is ignoring the transform on the video track. That is, for portrait-mode video, I am setting AVMutableCompositionTrack.preferredTransform to the preferredTransform value from the original asset video track. As long as I don't use a AVVideoCompositionCoreAnimationTool, this works, and the video comes out in