avassetexportsession

iOS : Crop video weird green line left and bottom side in video

做~自己de王妃 提交于 2019-12-04 14:07:00
问题 -How to remove green line on the video. when crop a video 2 or 3 times at that time show green or mix green-red blink line in the video, left or bottom or both left and bottom side in the video. video crop method. -(void)cropButton { CGRect cropFrame = self.cropView.croppedImageFrame; //load our movie Asset AVAsset *asset; asset = [AVAsset assetWithURL:[NSURL fileURLWithPath:[self.videoDataArr objectAtIndex:self.selectedIndex-1]]]; //create an avassetrack with our asset AVAssetTrack

AVAssetExportSession wrong orientation in front camera

三世轮回 提交于 2019-12-04 09:19:42
I'm encountering wrong orientation of video exported using AVAssetExportSession only in front Camera. I followed this tutorial https://stackoverflow.com/a/35368649/3764365 but I got this scenario. I think it's not wrong orientation the image is cut at half. I tried changing the video layer, render layer but got no luck. My code looks like this. let composition = AVMutableComposition() let vidAsset = AVURLAsset(url: path) // get video track let vtrack = vidAsset.tracks(withMediaType: AVMediaTypeVideo) // get audi trac let videoTrack:AVAssetTrack = vtrack[0] _ = videoTrack.timeRange.duration let

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 =

How can I export an mp3 file from an iOS device's iPod library?

為{幸葍}努か 提交于 2019-12-04 04:43:36
In my iOS application I'm trying to export an mp3 file from the iPod library to the app's documents directory on the device. Currently I'm trying to use AVAssetExportSession but it's not working for mp3 files. It works well for m4a files. Is exporting an mp3 file possible using AVAssetExportSession? What is the appropriate outputFileType for AVAssetExportSession? ( AVFileTypeAppleM4A works for m4a files) Thanks! urish I am facing the same problem. Unfortunately, non of the iOS frameworks (AVFoundation, CoreMedia, etc) support encoding to MP3. An answer to a similar question suggest using the

How can I export a AVPlayer audio mp3 file using AVAssetExportSession?

一曲冷凌霜 提交于 2019-12-03 16:53:24
I am now trying to export an mp3 file that has been player using AVPlayer (using an url) so it doesn't have to be downloaded twice. This is my sample code: I've tried every outputFileType... self.exporter = [[AVAssetExportSession alloc] initWithAsset:self.asset presetName:AVAssetExportPresetPassthrough]; } NSError *error; NSLog(@"export.supportedFileTypes : %@",self.exporter.supportedFileTypes); // "com.apple.quicktime-movie", // "com.apple.m4a-audio", // "public.mpeg-4", // "com.apple.m4v-video", // "public.3gpp", // "org.3gpp.adaptive-multi-rate-audio", // "com.microsoft.waveform-audio", //

Swift: UnsafeMutablePointer.deinitialize fatal error with negative count when appending to array

家住魔仙堡 提交于 2019-12-03 15:20:21
问题 The code below generates this error (appending to exporters ): fatal error: UnsafeMutablePointer.deinitialize with negative count var exporters = [AVAssetExportSession]() let exporter = AVAssetExportSession(asset: mainComposition, presetName: AVAssetExportPresetHighestQuality)! exporter.videoComposition = videoComposition exporter.outputFileType = AVFileTypeMPEG4 exporter.outputURL = exportURL exporter.shouldOptimizeForNetworkUse = true exporters.append(exporter) The other posts on

Exporting mp4 through AVAssetExportSession fails

北慕城南 提交于 2019-12-03 15:14:58
I start saying that I spent a lot of time searching through documentation, posts here and somewhere else, but I can't figure out the solution for this problem. I'm using AVAssetExportSession for exporting an .mp4 file stored in a AVAsset instance. What I do is: I check the isExportable property of AVAsset I then get an array of exportPresets compatible with the AVAsset instance I take the AVAssetExportPreset1920x1080 , or, if not existing I try to export the media with AVAssetExportPresetPassthrough (FYI, 100% of times, the preset I need is always contained in the list, but I tried also the

iOS 5: Error merging 3 videos with AVAssetExportSession

依然范特西╮ 提交于 2019-12-03 13:33:18
I'm trying to merge (append) 3 videos using AVAssetExportSession, but I keep getting this error. Weirdly for 1 or 2 videos it worked. Error Domain=AVFoundationErrorDomain Code=-11820 "Cannot Complete Export" UserInfo=0x458120 {NSLocalizedRecoverySuggestion=Try exporting again., NSLocalizedDescription=Cannot Complete Export} I even tried to redo the function in case of error but what I got is only infinite error message. This is the snippet of my code. AVMutableComposition *mixComposition = [AVMutableComposition composition]; AVMutableCompositionTrack *compositionTrack = [mixComposition

AVAssetExportSession fails every time (error -12780)

孤人 提交于 2019-12-03 12:22:36
I'm trying to merge some audio files (picked via MPMediaPickerController), but the export always fails with error code -12780. When I try to play my composition with an AVPlayer object, it plays correctly. Just the export fails. What am I doing wrong? This is my code: AVAssetExportSession *exportSession; AVPlayer *player; - (void)mergeAudiofiles { // self.mediaItems is an NSArray of MPMediaItems if (self.mediaItems.count == 0) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"No Tracks selected." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert

iOS : Crop video weird green line left and bottom side in video

孤街浪徒 提交于 2019-12-03 09:42:33
-How to remove green line on the video. when crop a video 2 or 3 times at that time show green or mix green-red blink line in the video, left or bottom or both left and bottom side in the video. video crop method. -(void)cropButton { CGRect cropFrame = self.cropView.croppedImageFrame; //load our movie Asset AVAsset *asset; asset = [AVAsset assetWithURL:[NSURL fileURLWithPath:[self.videoDataArr objectAtIndex:self.selectedIndex-1]]]; //create an avassetrack with our asset AVAssetTrack *clipVideoTrack = [[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; //create a video composition