我想在相机中实现慢动作视频,例如Slo-Mo的Defalut功能,我使用了以下代码,并且对视频效果很好。
但在该视频的音频轨道中无法正常工作。
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...
请帮我..
最佳答案
我找到了Audio SlowMotion的解决方案
double videoScaleFactor = 8.0;
[compositionAudioTrack scaleTimeRange:CMTimeRangeMake(kCMTimeZero,videoDuration)
toDuration:CMTimeMake(videoDuration.value * videoScaleFactor,videoDuration.timescale)];
它可以正常工作,但不能在AVPlayer中工作
因此,您必须设置AVPlayerItem的以下属性
AVPlayerItem * playerItem = nil;
playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithmVarispeed;
关于ios - 音频慢动作,例如使用240FPS的默认Slo-Mo相机功能,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25948243/