Skip to content

Instantly share code, notes, and snippets.

@shnhrrsn
shnhrrsn / plexDatabaseBackupScript.sh
Last active January 5, 2022 13:46 — forked from ssmereka/plexDatabaseBackupScript.sh
Plex Media Server database backup script.
#!/usr/bin/env bash
# Backup a Plex database.
# Author Scott Smereka
# Version 1.0
# Modified by Shaun Harrison
# Version 1.1
# Script Tested on:
func savePNG(_ frame: AVFrame, to url: String) throws {
let fmtCtx = try AVFormatContext(format: nil, filename: url)
guard let codec = AVCodec.findEncoderById(.PNG) else {
fatalError("png codec doesn't exist")
}
guard let codecCtx = AVCodecContext(codec: codec) else {
fatalError("Could not allocate video codec context")
}
codecCtx.width = frame.width