Skip to content

Instantly share code, notes, and snippets.

Avatar

Werner Robitza slhck

View GitHub Profile
@slhck
slhck / capture_x11_ffmpeg.sh
Last active Aug 3, 2022
capture_x11_ffmpeg.sh
View capture_x11_ffmpeg.sh
#!/usr/bin/env bash
#
# Record the screen via x11grab and embed a timecode.
#
# Author: Werner Robitza
#
# License: MIT
#
# Version: 1.2.0
#
@slhck
slhck / black_split.sh
Last active Aug 1, 2022 — forked from davidwebca/gist:e26186b8f4c6795b19c043fffb6f9861
Detect black scenes and split with ffmpeg remux
View black_split.sh
#!/usr/bin/env bash
# Splits video to separate scenes files when full black frames are found in the video
#
# Author: Werner Robitza
#
# Forked from: https://gist.github.com/davidwebca/e26186b8f4c6795b19c043fffb6f9861
# Inspired by https://gist.github.com/achesco/4dc2ebf13378a0a61fc26c7fe01f539e
# Who got inspired by https://stackoverflow.com/a/38205105
@slhck
slhck / crx_download.sh
Created Jul 21, 2022
Download CRX file from Chrome Web Store
View crx_download.sh
#!/usr/bin/env bash
#
# Download a Chrome extension from the webstore.
# Extract it to a specified path.
#
# Author: Werner Robitza
set -e
CHROME_VERSION="101.0.4951.57"
@slhck
slhck / csv_to_ndjson.py
Created Jun 22, 2022
Convert CSV to NDJSON (LDJSON)
View csv_to_ndjson.py
#!/usr/bin/env python3
#
# csv_to_ndjson.py
#
# Author: Werner Robitza
#
# Convert CSV files to .ndjson.
# This assumes the same keys being used in every line of the input file.
# It works on a line-by-line basis, so it should be fast and memory-efficient.
@slhck
slhck / fft.py
Last active May 11, 2022
Code for calculating FFT and radial profile of an image
View fft.py
#!/usr/bin/env python3
#
# Code for calculating FFT and radial profile of an image
#
# Implements a method similar to:
# Katsavounidis, I., Aaron, A., & Ronca, D. (2015, October). Native resolution detection
# of video sequences. In SMPTE 2015 annual technical conference and exhibition (pp. 1-20).
# SMPTE.
#
# Author: Werner Robitza
View gist:7ca145663f5898b2a9018106cc0b0d6a
// Work in progress! Does not handle escapes within filter arguments.
FilterGraph =
head: FilterChain
tail:(";" @FilterChain)*
{ return [head, ...tail]; }
FilterChain =
head: Filter
tail:("," @Filter)*
@slhck
slhck / word-to-json-string.sh
Created Nov 12, 2020
Convert a Word document to a Markdown-formatted JSON-parsable string
View word-to-json-string.sh
#!/usr/bin/env bash
#
# Convert a Word document to a Markdown-formatted JSON-parsable string
pandoc "$1" -t gfm-raw_html --wrap=preserve -o - | python -c 'import json; import sys; print(json.dumps(sys.stdin.read()))'
@slhck
slhck / ffmpeg-progress.py
Last active Aug 2, 2022
Run an ffmpeg command and get the progress in percent
View ffmpeg-progress.py
#!/usr/bin/env python3
#
# Run an ffmpeg command with a progress iterator
# Author: Werner Robitza
# Based on: https://gist.github.com/Hellowlol/5f8545e999259b4371c91ac223409209
# For a library version, see https://pypi.org/project/ffmpeg-progress-yield/
# License: MIT
import subprocess
import re
@slhck
slhck / diagnostics.txt
Created Jul 15, 2020
RStudio diagnostics
View diagnostics.txt
RStudio Diagnostics Report
==========================
WARNING: This report may contain sensitive security information and / or
personally identifiable information. Please audit the below and redact any
sensitive information before submitting your diagnostics report.
Generated: Wed Jul 15 08:58:21 2020
View pyproject.toml
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Werner Robitza <werner.robitza@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.8"
ffmpeg_bitrate_stats = { git = "ssh://git@github.com:slhck/ffmpeg-bitrate-stats.git" }