iOS-FFmpeg-从音频和图像文件组成视频

标签 ios audio ffmpeg video-streaming video-processing

我正在开发一个使用 FFmpeg 库进行视频处理的 iOS 项目。我收到了一项从音频文件和一组图像文件组成视频的任务。 有没有人经历过类似的任务? 请帮助我!

最佳答案

您可以使用SwiftVideoGenerator 使用Cocoapods安装SwiftVideoGenerator,需要导入模块:

import SwiftVideoGenerator

从多个图像和单个音频创建视频

if let audioURL1 = Bundle.main.url(forResource: Audio1, withExtension: Mp3Extension) {
  LoadingView.lockView()

  VideoGenerator.current.fileName = MultipleSingleMovieFileName
  VideoGenerator.current.shouldOptimiseImageForVideo = true

  VideoGenerator.current.generate(withImages: [#imageLiteral(resourceName: "image1"), #imageLiteral(resourceName: "image2"), #imageLiteral(resourceName: "image3"), #imageLiteral(resourceName: "image4")], andAudios: [audioURL1], andType: .singleAudioMultipleImage, { (progress) in
    print(progress)
  }, success: { (url) in
    LoadingView.unlockView()
    print(url)
    self.createAlertView(message: self.FnishedMultipleVideoGeneration)
  }, failure: { (error) in
    LoadingView.unlockView()
    print(error)
    self.createAlertView(message: error.localizedDescription)
  })
} else {
  self.createAlertView(message: MissingAudioFiles)
}

引用请访问:https://github.com/dev-labs-bg/swift-video-generator

关于iOS-FFmpeg-从音频和图像文件组成视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55797303/

相关文章:

php - Android 中录制和传输音频的设计

python - 用Qpython录制声音

java - Xuggler的IPacket如何与FLV标签或标签部分对应?

ios - iPhone慢动作视频转码

objective-c - 您可以缓存数据以便稍后离线查看吗?

ios - 从 .mobileconfig 获取设备 UDID

ios - 如何用 UIGravityBehavior 停止某些事情?

javascript - 如果用户的设备是 iOS,如何更改字体系列 css

c - 如何为 ffmpeg amix 过滤器指定多个输入

bash - 如何关闭 OS X bash 时间码中的冒号