yangKJ / Kakapos

๐ŸŒ€ High-performance and flexible video edit and export framework.
MIT License
24 stars 4 forks source link
either exporter filter metal video

Kakapos

CocoaPods Compatible Platform

Kakapos is a video add filter tool that supports network and local urls, as well as album videos.

High-performance and flexible video editing and exporting framework.

Add filter with CoreImage/Harbeth/GPUImage/MetalPetal/BBMetalImage and so on.


Used

let provider = VideoX.Provider.init(with: ``URL Link``)

Or

let provider = VideoX.Provider.init(with: ``AVAsset``)
let filters: [C7FilterProtocol] = [
    C7LookupTable(name: "lut_abao"),
    C7SplitScreen(type: .two),
]
let filters2: [C7FilterProtocol] = [
    C7Flip(horizontal: true, vertical: true),
    C7SoulOut(soul: 0.3),
]

let filtering = FilterInstruction { buffer, time, callback in
    if time >= 0, time < 10 {
        let dest = BoxxIO(element: buffer, filters: filters)
        dest.transmitOutput(success: callback)
    } else {
        let dest = BoxxIO(element: buffer, filters: filters2)
        dest.transmitOutput(success: callback)
    }
}
let exporter = VideoX.init(provider: provider)

/// Export the video.
/// - Parameters:
///   - options: Setup other parameters about export video.
///   - instructions: Operation procedure.
///   - complete: The conversion is complete, including success or failure.
exporter.export(options: [
    .OptimizeForNetworkUse: true,
    .ExportSessionTimeRange: TimeRangeType.range(5...28.0),
], instructions: [filtering], complete: { res in
    // do somthing..
}, progress: { pro in
    // progressing..
})

CocoaPods

pod 'Kakapos'
pod 'Harbeth'

Swift Package Manager

Swift Package Manager is a tool for managing the distribution of Swift code. Itโ€™s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

Xcode 11+ is required to build Kakapos using Swift Package Manager.

To integrate Harbeth into your Xcode project using Swift Package Manager, add it to the dependencies value of your Package.swift:

dependencies: [
    .package(url: "https://github.com/yangKJ/Kakapos.git", branch: "master"),
]

Remarks

The general process is almost like this, the Demo is also written in great detail, you can check it out for yourself.๐ŸŽท

KakaposDemo

Tip: If you find it helpful, please help me with a star. If you have any questions or needs, you can also issue.

Thanks.๐ŸŽ‡

About the author


License

Harbeth is available under the MIT license. See the LICENSE file for more info.