Giter Club home page Giter Club logo

merge's Introduction

Merge

Merge

Swift

What is it?

Overlay transparent PNG images on top of other images or videos. This is useful for apps that need to watermark videos, or apps where a user can draw on top of a video.

Used in https://itunes.apple.com/us/app/.gif/id1061699394?ls=1&mt=8 check it out!

Getting Started

Merge is initialized with a configuration struct that is open for extension. Simply extend Merge to have full control over frame rate, export directory, export quality and overlay placement.

struct MergeConfiguration {
  let frameRate: Int32
  let directory: String
  let quality: Quality
  let placement: Placement
}

extension MergeConfiguration {
  static var standard: MergeConfiguration {
    return MergeConfiguration(frameRate: 30, directory: NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0], quality: Quality.high, placement: Placement.stretchFit)
  }
}

Placement

  • stretchFit: Stretches the ovelay to cover the entire video frame. This is ideal for situations like adding drawing to a video.

  • custom: Custom coordinates for the ovelay and size for the overlay.

enum Placement {
  case stretchFit
  case custom(x: CGFloat, y: CGFloat, size: CGSize)
}
Overlay an image on a video.
  • Note: For performance reasons the progress closure is not called on the main thread.
let merge = Merge(config: .standard)

merge.overlayVideo(video: AVAsset, overlayImage: UIImage, completion: { url in

// Video done exporting
}) { progress in
// progress of video export
}
Installation

Just drag Merge.swift to the project tree

merge's People

Contributors

john-connolly avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.