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

1

8

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..

Hillery answered 20/9, 2014 at 11:24 Comment(1)
First of All thanks, i am also try this feature, By Using MpmoviePlayerController to play video in slow motion but not got success please help me provide some code for that feature.Spikes
H
7

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;

Hillery answered 11/11, 2014 at 6:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.