SwiftFFmpeg alternatives and similar libraries
Based on the "Video" category.
Alternatively, view SwiftFFmpeg alternatives based on common mentions on social networks and blogs.
-
MobilePlayer
:iphone: :movie_camera: A powerful and completely customizable media player for iOS -
BMPlayer
A video player for iOS, based on AVPlayer, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, support subtitles. -
Cabbage
A video composition framework build on top of AVFoundation. It's simple to use and easy to extend. -
PryntTrimmerView
A set of tools to trim, crop and select frames inside a video -
MMPlayerView
Custom AVPlayerLayer on view and transition player with good effect like youtube and facebook -
VGPlayer
A simple iOS video player, support play local and network, background playback mode, automatic caching while playing. -
SwiftVideoBackground
📹 Framework to Play a Video in the Background of any UIView -
NextLevelSessionExporter
🔄 Export and transcode media in Swift -
Kitsunebi
Overlay alpha channel video animation player view using Metal. -
Swifty360Player
iOS 360-degree video player streaming from an AVPlayer. -
PlayerView
Player View is a delegated view using AVPlayer of Swift -
YiVideoEditor
YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SwiftFFmpeg or a related project?
README
SwiftFFmpeg
A Swift wrapper for the FFmpeg API.
Note: SwiftFFmpeg is still in development, and the API is not guaranteed to be stable. It's subject to change without warning.
Installation
You should install FFmpeg (Requires FFmpeg 4.0 or higher) before use this library, on macOS, you can:
brew install ffmpeg
Swift Package Manager
SwiftFFmpeg primarily uses SwiftPM as its build tool, so we recommend using that as well. If you want to depend on SwiftFFmpeg in your own project, it's as simple as adding a dependencies
clause to your Package.swift
:
dependencies: [
.package(url: "https://github.com/sunlubo/SwiftFFmpeg.git", from: "1.0.0")
]
Documentation
Usage
import Foundation
import SwiftFFmpeg
if CommandLine.argc < 2 {
print("Usage: \(CommandLine.arguments[0]) <input file>")
exit(1)
}
let input = CommandLine.arguments[1]
let fmtCtx = try AVFormatContext(url: input)
try fmtCtx.findStreamInfo()
fmtCtx.dumpFormat(isOutput: false)
guard let stream = fmtCtx.videoStream else {
fatalError("No video stream.")
}
guard let codec = AVCodec.findDecoderById(stream.codecParameters.codecId) else {
fatalError("Codec not found.")
}
let codecCtx = AVCodecContext(codec: codec)
codecCtx.setParameters(stream.codecParameters)
try codecCtx.openCodec()
let pkt = AVPacket()
let frame = AVFrame()
while let _ = try? fmtCtx.readFrame(into: pkt) {
defer { pkt.unref() }
if pkt.streamIndex != stream.index {
continue
}
try codecCtx.sendPacket(pkt)
while true {
do {
try codecCtx.receiveFrame(frame)
} catch let err as AVError where err == .tryAgain || err == .eof {
break
}
let str = String(
format: "Frame %3d (type=%@, size=%5d bytes) pts %4lld key_frame %d",
codecCtx.frameNumber,
frame.pictureType.description,
frame.pktSize,
frame.pts,
frame.isKeyFrame
)
print(str)
frame.unref()
}
}
print("Done.")