小编Leg*_*man的帖子

AVMutableAudioMixInputParameters:setVolume()不适用于音频文件iOS 9

我尝试将视频记录与设备的iPod库中的音频文件混合在一起.

我想设置每个音频的音量(视频和音频文件的音频).

我尝试使用AVMutableAudioMixInputParameters该方法的对象setVolume().

我对视频的音量没有任何问题,但最终记录中音频文件的音量总是设置为最大值.我尝试使用视频更改音频文件以进行测试,并仅拍摄此视频的音频轨道,并且工作正常.

import UIKit
import AVFoundation

class AVTools: NSObject {

    /**
    volume: between 1.0 and 0.0
    */
    class func mergeVideoAndMusicWithVolume(videoURL: NSURL, audioURL: NSURL, startAudioTime: Float64, volumeVideo: Float, volumeAudio: Float, complete: (NSURL?) -> Void) -> Void {

        //The goal is merging a video and a music from iPod library, and set it a volume

        //Get the path of App Document Directory
        let dirPaths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
        let docsDir = dirPaths[0] as String

        //Create Asset …
Run Code Online (Sandbox Code Playgroud)

iphone avfoundation ios swift

1
推荐指数
1
解决办法
1164
查看次数

标签 统计

avfoundation ×1

ios ×1

iphone ×1

swift ×1