Skip to content

Instantly share code, notes, and snippets.

View qruf's full-sized avatar

qruf qruf

  • Nice Boys & Sons
View GitHub Profile
@qruf
qruf / cropmode.lua
Last active October 14, 2017 15:29
mpv crop mode
local label = "crop_fb608e2f"
local max = math.max
local running = false
local params = { w = 0, h = 0, x = 0, y = 0 }
local binds = { l = "h", r = "l", t = "k", b = "j" }
local delete_filter = function()
local vf = mp.get_property_native("vf")
for i, v in ipairs(vf) do
@qruf
qruf / genloss.sh
Created May 26, 2017 00:47
audio generation loss simulator
#! /bin/sh
# generation loss demonstration script
# TODO:
# - output the concatenated encoded format
# (currently outputs pcm to avoid encoder-delay gaps)
# - better progress display
set -e
@qruf
qruf / auth.lua
Created May 15, 2017 23:25 — forked from fur-q/auth.lua
nginx rtmp/hls server setup
-- add users:
-- $ htpasswd -s -c /etc/nginx-rtmp/.htpasswd streamname
-- stream:
-- $ ffmpeg -i foo.mp4 -c copy -f flv rtmp://abc.de/streamname?auth=password
local users = {}
for line in io.lines("/etc/nginx-rtmp/.htpasswd") do
local user, pass = line:match("([^:]+):{SHA}([^\n]+)")
users[user] = pass
end
@qruf
qruf / progress.awk
Created September 3, 2016 08:42
ffmpeg progress
#! /usr/bin/env gawk
function seconds(h, m, s) {
return h * 3600 + m * 60 + s
}
BEGIN {
RS = "[\r\n]"
}
@qruf
qruf / dvdaspect.lua
Last active September 11, 2016 16:44
dvd->crop->encode DAR calculator
#! /usr/bin/env lua
local usage = [[
dvdaspect.lua [-pw] width height
returns the correct display aspect ratio of a dvd after cropping
options:
-p input is pal
-w input is widescreen
]]