Note that there are some explanatory texts on larger screens.

plurals
  1. POMerge video is not working in iOS app
    primarykey
    data
    text
    <p>I have working on merge video functionality.</p> <p>In my application I have one video with multiple tracks (total 10 tracks 9 video tracks and one audio track is common ). Now I want to get 3 video from this multiple Tracks. First video is combine with 1,4,7 track and Second video is combine with 2,5,8 track and Third video is combine with 3,6,9 track and and Audio track is common for this three video.</p> <p>I want to do this using following code.</p> <pre><code> AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:[NSURL fileURLWithPath:urlSubItem.path]]; NSLog(@"%@",playerItem); NSArray* arrTracks = [playerItem.asset tracksWithMediaType:AVMediaTypeVideo]; NSLog(@"%@",arrTracks); NSArray* arrTracksText = [playerItem.asset tracksWithMediaType:AVMediaTypeText]; NSArray* arrTracksAudio = [playerItem.asset tracksWithMediaType:AVMediaTypeAudio]; NSLog(@"%@:%@",arrTracks,arrTracksAudio); for (int i=0; i&lt;3; i++) { AVMutableComposition* mixComposition = [AVMutableComposition composition]; AVMutableCompositionTrack *compositionCommentaryTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; [compositionCommentaryTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, playerItem.asset.duration) ofTrack:[[playerItem.asset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0] atTime:kCMTimeZero error:nil]; CMTime currentTime = kCMTimeZero; for (int k=0;k&lt;[arrTracks count];k++) { NSLog(@"%d",k%3); if(k%3==i){ AVAssetTrack* trackCombineVideo = [arrTracks objectAtIndex:k]; AVMutableCompositionTrack *compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; NSError* errors; [compositionVideoTrack insertTimeRange:CMTimeRangeMake(currentTime, trackCombineVideo.timeRange.duration) ofTrack:[arrTracks objectAtIndex:k] atTime:currentTime error:&amp;errors]; if (errors) { NSLog(@"wait error:%@",errors); } currentTime = trackCombineVideo.timeRange.duration; } } AVAssetExportSession* _assetExport = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPresetPassthrough]; _assetExport.outputFileType = @"com.apple.quicktime-movie"; NSLog(@"file type %@",_assetExport.outputFileType); _assetExport.outputURL = exportUrl // Document Directory Path; _assetExport.shouldOptimizeForNetworkUse = YES; </code></pre> <p>Using this code 3 separate video is create but each video have a 3 different track. Now, my question is how to create video with only one track ?</p>
    singulars
    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