Latest 0.2.0
Homepage https://github.com/zangqilong198812/YGCVideoToolbox
License MIT
Platforms ios 10.0
Frameworks AVFoundation, Photos
Authors
YGCVideoToolbox

Swift 4.0Platform: iOSXCode 9+iOS 11Licence MIT

A series of video tools base on AVFoundation framework.

Features

  • [x] Resize video
  • [x] Crop video by timerange
  • [x] Reverse a video
  • [x] Slow motion video
  • [x] Repeat a video segment
  • [x] Pure Swift 4.

Todo

  • [ ] Add CoreImage filter to a video file
  • [ ] Add image on video
  • [ ] Add gif on video
  • [ ] Add text on video

Usage

This is the original video.
YGCVideoToolbox

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.
YGCVideoToolbox

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.
YGCVideoToolbox

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.

Latest podspec

{
    "name": "YGCVideoToolbox",
    "version": "0.2.0",
    "summary": "A collection of video edit tool",
    "description": "A collection of video edit tool.make you slow motion, resize, crop, repeat video easily.",
    "homepage": "https://github.com/zangqilong198812/YGCVideoToolbox",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "zangqilong": "[email protected]"
    },
    "source": {
        "git": "https://github.com/zangqilong198812/YGCVideoToolbox.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "YGCVideoToolbox/Classes/*.swift",
    "frameworks": [
        "AVFoundation",
        "Photos"
    ],
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "4.0"
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This