VideoCompressorSwift

A high-performance, flexible and easy to use Video compressor library written by Swift.

Version License Platform

Usage

Compress with quality param

Set VideoQuality to get different quality of video, beside:

VideoCompressorSwift().videoCompress(inputUrl: yourVideoPath, quality: .medium) { result in
            switch result {
            case .failure(let error):
            case .success(let url):
            }
        }

Compress with more customized

VideoCompressorSwift().videoCompress(inputUrl: url,
                                     outputFileType: .mov,
                                     videoSettings: VideoCompressorSwift().createVideoSettingsForPreset(.medium, 1000_000, size: CGSize(width: 640, height: 480)),
                                     audioSampleRate: 44100,
                                     audioBitrate: 128_000) { res in
            switch result {
            case .failure(let error):
            case .success(let url):
            }
        }

Installation

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding VideoCompressorSwift as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/ghafarzadeh/VideoCompressorSwift.git", .upToNextMajor(from: "0.0.1"))
]

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Habib Ghaffarzadeh – LinkedInTwitter[email protected]

GitHub

View Github