iOS-FFmpeg-Compose видео из аудио и графических файлов - PullRequest
0 голосов
/ 22 апреля 2019

Я работаю в проекте для iOS, который использует библиотеку FFmpeg для обработки видео.И я получил задание для создания видео из аудио файла и набора файлов изображений.Кто-нибудь сталкивался с подобной задачей?Помогите мне, пожалуйста!

1 Ответ

0 голосов
/ 22 апреля 2019

Вы можете использовать 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

...