ios – 使用240FPS的默认Slo-Mo相机功能的音频慢动作

前端之家收集整理的这篇文章主要介绍了ios – 使用240FPS的默认Slo-Mo相机功能的音频慢动作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想实现慢动作视频像Slo-Mo相机的Defalut功能,我使用下面的代码,它适用于视频.
但在音频轨道中该视频无法正常工作. @H_502_3@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相关文章