Swiftpack.co - Ponyboy47/TranscodeVideo as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Ponyboy47.
Ponyboy47/TranscodeVideo 0.3.2
A Swift wrapper around the transcode-video command
⭐️ 2
🕓 4 years ago
.package(url: "https://github.com/Ponyboy47/TranscodeVideo.git", from: "0.3.2")

TranscodeVideo

A Swift wrapper around the transcode-video command.

Installation (SPM)

.package(url: "https://github.com/Ponyboy47/TranscodeVideo.git", from: "0.3.1")

NOTES: Due to the intricacies of supporting all the various command line options, each version of this library will be locked down to a version of the transcode-video utility. Version 0.3.1 is locked to version 0.25.x of transcode-video

Usage

import TranscodeVideo
import TrailBlazer

let videoFile = FilePath("/path/to/file.avi")!

let transcoder = Transcoder(for: videoFile)
// Begin transcoding asynchronously
transcoder.start()

// Check progress
let progress: Double = transcoder.progress

// Get ETA
let eta: (hours: Int, minutes: Int, seconds: Int) = transcoder.eta

// Forcefully stop transcoding
transcoder.stop()

// Gracefully stop transcoding
transcoder.interrupt()

// Pause transcoding
let succeeded = transcoder.suspend()

// Resume a paused transcoding
let succeeded = transcoder.resume()

// Block until transcoding completes
transcoder.wait()

// Also block until a transcoding completes, but includes exit code and termination reason
let finish: (exitcode: Int, reason: Process.TerminationReason) = transcoder.finish()

// Get transcoder output
let output: (stdout: ReadableStream, stderr: ReadableStream) = transcoder.output()
print(output.stdout.read())

License

MIT

GitHub

link
Stars: 2
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics