Skip to content

Vodolazkyi/VAVideoCompressor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VAVideoCompressor

Video compressor written in swift

Usage

  let audioSettings = [
      AVFormatIDKey: kAudioFormatMPEG4AAC,
      AVNumberOfChannelsKey: 2,
      AVSampleRateKey: 44100,
      AVEncoderBitRateKey: 128000
  ]
  let asset = AVAsset(url: URL(string: "video_path")!)
  let outputPath = URL(string: "output_video_path")!

  VAVideoCompressor.exportAsynchronously(
      with: asset,
      outputFileType: AVFileType.mp4,
      outputURL: outputPath,
      videoSettings: VAVideoCompressor.videoSettingsForPreset(.medium, size: asset.videoSize()),
      audioSettings: audioSettings,
      completion: { error in
          if let error = error {
              print(error)
          } else {
              print("success")
          }
  })

About

Video compressor written in swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages