Hasan Samir Hashem Hasan Samir Hashem - 9 months ago 65
Objective-C Question

CMTimeMake User Picker

have been working on the AVMutableComposition to mix audio file with video,

For the part of insert the audio at video time 0, am using this

AVMutableCompositionTrack *a_compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
[a_compositionVideoTrack insertTimeRange:video_timeRange ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:kCMTimeZero error:nil];

My challenge now is to let the user pick the video time range he want the audio in !! have no idea how this works with the CMTimeMake and if there is any smoothy picker already done

Thanks for helping !!

Answer Source

value - as usual, amount of quantums (for example, seconds) timescale - length of this quantum in seconds

CMTimeMake(1,30) // one interval of 30 sec
CMTimeMake(30,1) // 30 intervals of 1 sec

In fact it is the same absolute time, But it has different granularity, which is important when you deal with audio and video file processing.