Skip to content

Instantly share code, notes, and snippets.

@pituz
pituz / qcomp.zsh
Created April 20, 2015 02:12
Visual compare of VP8 and VP9 compression
#!/usr/bin/env zsh
setopt ERR_EXIT
if [[ -z $1 ]]
then
cat <<EOF
Usage: $0 /path/to/test-image.png
Warning: run script from empty directory, otherwise it may delete your files (e.g. q*.png).
EOF
false
#!/usr/bin/env zsh
f="${1-$$.mkv}"
rate=25
echo "Click a window to record.."
coords=( $(xwininfo | awk '/Absolute upper-left [XY]:/ {print $4} /Width:|Height:/ {print $2}') )
#aopts=(-f alsa -i live)
#aopts=(-f pulse -i default)
aopts=()
ffmpeg -s $((coords[3]/2*2))x$((coords[4]/2*2)) -r $rate -f x11grab -show_region 1 -i ${DISPLAY}+${coords[1]},${coords[2]} $aopts -c:v libx264 -pix_fmt yuv420p -qp 0 -tune zerolatency -preset ultrafast -y $f
@pituz
pituz / musicwebm.zsh
Last active August 29, 2015 14:04
converts currently playing audio track + picture from clipboard to webm video
#!/usr/bin/env zsh
# exit on errors
set -e
tempdir="/tmp"
if [[ -n $1 ]]
then
audio_file=$1
track_length="$(ffprobe $1 2>&1|sed -n 's/.*Duration: \([^,]\+\),.*/\1/p')"
elif pgrep mocp > /dev/null
@pituz
pituz / capture.lua
Last active December 13, 2016 07:33
--[[
usage: place script into $HOME/.mpv/lua/ directory (mpv 0.4 and later)
or run mpv --lua path/to/capture.lua
or add "lua=/absolute/path/to/capture.lua" to ~/.mpv/config
keybindings:
a - capture fragment: at first press script remembers start position, at second outputs command for encoding
c - crop: first press remembers mouse cursor coords, second outputs crop filter parameters.
]]
capture = {}
local gp
#!/usr/bin/env bash
############################################################################
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #