Note that there are some explanatory texts on larger screens.

plurals
  1. POVideo recorded from EAGLView is flipped when uploaded to youtube
    primarykey
    data
    text
    <p>In my ios app, I am trying to record video of the content of EAGLView(There is no Camera involvement). I have no problem recording the video. After recording I have to add few sound tracks to the video and then have to share this video to Youtube and facebook. My problem is that the video is okay when I play it on iphone or on mac but when I upload this video to youtube (using Youtube Data Api v3), the video is vertically inverted or upside down.</p> <p>I guess I need to rotate the frame in video before uploading but I don't know how to do that.</p> <p>Any help will be highly appreciated.</p> <p>The code I am using to add audio tracks to the video is below:</p> <pre><code>-(void)prepareVideoForPath:(NSString *)videoPath usingAudio:(NSArray *)audioArray andOutputPath:(NSString *)exportPath{ NSDictionary *optionsDictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:AVURLAssetPreferPreciseDurationAndTimingKey]; NSURL *videoUrl=[NSURL fileURLWithPath:videoPath]; AVURLAsset* videoAsset = [AVURLAsset URLAssetWithURL:videoUrl options:optionsDictionary]; AVAssetTrack *FirstAssetTrack = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; CGAffineTransform firstTransform = FirstAssetTrack.preferredTransform; AVMutableComposition* mixComposition = [AVMutableComposition composition]; //VideoTrack AVMutableCompositionTrack *compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; [compositionVideoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:FirstAssetTrack atTime:kCMTimeZero error:nil]; [compositionVideoTrack setPreferredTransform:firstTransform]; //Audio Track AVMutableCompositionTrack *audioTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; CMTime audioStartTime = kCMTimeZero; for (NSURL *audioURL in audioArray) { AVURLAsset *audioAsset = [AVURLAsset URLAssetWithURL:audioURL options:optionsDictionary]; [audioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset.duration) ofTrack:[[audioAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0] atTime:audioStartTime error:nil]; audioStartTime = CMTimeAdd(audioStartTime, audioAsset.duration); } AVAssetExportSession* _assetExport = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPresetPassthrough]; NSURL *exportUrl = [NSURL fileURLWithPath:exportPath]; _assetExport.outputFileType = AVFileTypeQuickTimeMovie; NSLog(@"file type %@",_assetExport.outputFileType); _assetExport.outputURL = exportUrl; _assetExport.shouldOptimizeForNetworkUse = YES; [_assetExport exportAsynchronouslyWithCompletionHandler: ^(void ) { // your completion code here dispatch_async(dispatch_get_main_queue(), ^{ NSLog(@"Mixing complete"); }); } ]; </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload