Skip to content

Instantly share code, notes, and snippets.

View klaxa's full-sized avatar

klaxa

  • Germany
View GitHub Profile
First generate a list of the timestamps of the I-frames:
mkvinfo -s input.mkv | grep track\ 1 | grep I\ frame | grep -o -E "[0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\.[0-9]{3}" > I-frames_stripped.txt
Now copy the timestamps you want into another file.
Then you can run:
mkvmerge --split timecodes:$(cat marks.txt) input.mkv -o input_split.mkv
where marks.txt contains your timestamps.
@klaxa
klaxa / pitch_down.bash
Last active January 8, 2022 16:34
Pitches a video's audio down with ffmpeg and sox
#!/bin/bash
FFMPEG="/usr/bin/ffmpeg"
SOX="/usr/bin/sox"
$FFMPEG -i "$1" -map 0:a -c flac -y temp.flac
$SOX temp.flac pitched.flac pitch -500
$FFMPEG -i "$1" -i pitched.flac -map 0:v -map 1:a "${1}"_pitched.mkv
rm temp.flac pitched.flac
@klaxa
klaxa / frame2ts
Created January 1, 2015 23:52
Converts from frames to timestamps for 24 fps
def frame2ts(self, ts):
new_ts = ts / 24
new_ts_str = time.strftime('%H:%M:%S', time.gmtime(int(new_ts)))[1:]
ms = new_ts % 1
ms = Decimal(ms).quantize(Decimal('.01'), rounding=ROUND_DOWN)
new_ts_str += str(ms)[1:]
return new_ts_str
[clickme]
full_text=Click me
command=echo hello $BLOCK_BUTTON
min_width=button=1 x=1280 y=800
align=left
[clickme2]
full_text=Click me!
command=notify-send "Button $BLOCK_BUTTON ($BLOCK_X, $BLOCK_Y)"
@klaxa
klaxa / nat.bash
Last active January 8, 2022 16:34
Shell script to set up an ssh vpn tunnel and set default routes.
#!/bin/bash
if [[ $# < 2 ]]
then
INTERNAL=tun0
EXTERNAL=eth0
else
INTERNAL=$1
EXTERNAL=$2
fi
#!/bin/bash
ping -c 1 -W 2 8.8.8.8 2> /dev/null > /dev/null
ret=$?
if [[ "$ret" -ne "0" ]]
then
#echo \'<span color=\"red\">Offline</span> \'
echo " Offline "
else
#echo \'<span color=\"green\">Online</span> \'
#!/bin/bash
if [[ "$(whoami)" != "root" ]]
then
echo "Start as root, fag"
exit 1
fi
echo -n "Starting in 3..."
sleep 1
[klaxa@localhost Development]$ cat cassy_tiles.c
#include <stdio.h>
int main() {
for(int x = 0; x < 800; x+=256) { for (int y = 0; y < 480; y+=256) { printf("%dx%d\n", x, y); } }
}
[klaxa@localhost Development]$ gcc cassy_tiles.c -std=c99 -o cassy_tiles
[klaxa@localhost Development]$ ./cassy_tiles
0x0
0x256
@klaxa
klaxa / extractFonts.bash
Created June 22, 2014 21:07
Extracts fonts from mkv files
DEBUG=0
while read line; do
mkvinfo "$line" > currentmkvinfo.info
currentFontName=""
currentFontDigit=1
while read info; do
currentLine=`echo $info | sed 's/|//g' | sed 's/+//g'`
currentLineText=`echo $currentLine | sed 's/[0-9]//g'`
currentLineDigit=`echo $currentLine | sed 's/[a-z]//g' | sed 's/[A-Z]//g' | sed 's/://g'`
if [ "$DEBUG" -gt "1" ]
Mangatrader Downloader (Centralized)
CTRL+C to end at any time
Traceback (most recent call last):
File "dlc.py", line 157, in <module>
url_request = (base64.b64decode("aHR0cDovLzE0Ni4xODUuMTM3LjE5NS9tdC9Eb3dubG9hZFJhbmRvbVNlcmllcw==")).decode("utf-8");
File "/usr/lib/python3.2/base64.py", line 83, in b64decode
raise TypeError("expected bytes, not %s" % s.__class__.__name__)
TypeError: expected bytes, not str