Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

audio slow motion like default Slo-Mo Camera functionality using 240FPS

i want to implement Slowmotion Video like Defalut functionality of Slo-Mo in Camera and i used following code and it worked fine for video. but in Audio track of that video is not working properly.

   double videoScaleFactor =8.0;


 compositionAudioTrack scaleTimeRange:CMTimeRangeMake(kCMTimeZero, videoDuration)
                                     toDuration:CMTimeMake(videoDuration.value* videoScaleFactor,videoDuration.timescale)];
 [compositionVideoTrack scaleTimeRange:CMTimeRangeMake(kCMTimeZero, videoDuration)
   toDuration:CMTimeMake(videoDuration.value* videoScaleFactor, videoDuration.timescale)];

 this scenario is woking properly for video slowmotion.But in audio slow-motion it is not working...

Please help me..

like image 830
Developer Avatar asked Sep 20 '14 11:09

Developer


1 Answers

i found solution of Audio SlowMotion

double videoScaleFactor =8.0;

[compositionAudioTrack scaleTimeRange:CMTimeRangeMake(kCMTimeZero, videoDuration) toDuration:CMTimeMake(videoDuration.value* videoScaleFactor,videoDuration.timescale)];

its working properly but not working in AVPlayer so for that you have to set following property of AVPlayerItem

AVPlayerItem *playerItem = nil;

playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithmVarispeed;

like image 143
Developer Avatar answered Oct 24 '22 10:10

Developer