• Stars
    star
    106
  • Rank 325,871 (Top 7 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a video tool box help you edit video easily

Swift 4.0 Platform: iOS XCode 9+ iOS 11 Licence MIT

YGCVideoToolbox

A series of video tools base on AVFoundation framework.

Features

  • Resize video
  • Crop video by timerange
  • Slow motion video
  • Repeat a video segment
  • Add image on video
  • Add text on video
  • Pure Swift 4.

Todo

  • Add CoreImage filter to a video file
  • Add gif on video
  • Reverse a video

Usage

This is the original video.

Slowmotion

 let videoAsset = AVURLAsset(url: URL(fileURLWithPath: path!))
    composition = try! slowMotion(videoAsset: videoAsset, slowTimeRange: YGCTimeRange.secondsRange(2, 4), slowMotionRate: 8)

it means I want to slow motion the 2s - 4s, and I want to make it slow to 1/8 speed. This is the slowmotion video.

Repeat

let videoAsset = AVURLAsset(url: URL(fileURLWithPath: path!))
    composition = try! repeatVideo(videoAsset: videoAsset, insertAtSeconds: 2, repeatTimeRange: YGCTimeRange.secondsRange(2, 4), repeatCount: 2)

the demo code means i will repeat the 2s - 4s video segment, and I want to repeat twice.
This is the repeat video.

Resize

let videoAsset = AVURLAsset(url: URL(fileURLWithPath: path!))
    result = try! resizeVideo(videoAsset: videoAsset, targetSize: CGSize(width: 300, height: 300), isKeepAspectRatio: true, isCutBlackEdge: false)

the demo code means I want to resize the video size to (300, 300). and I want to the video scale AspectFit. and Want to the black edge.

Cut Video

let videoAsset = AVURLAsset(url: URL(fileURLWithPath: path!))
    composition = try! cutTime(videoAsset: videoAsset, cutTimeRange: YGCTimeRange.secondsRange(2, 4))

the demo code means I want the 2s - 4s time range video. And crop it to me .

Installing

Cocoapods

pod 'YGCVideoToolbox'

Requirements

  • Swift 4
  • iOS 11 or higher

Authors

Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

License

This project is licensed under the MIT License.