Skip to content

Instantly share code, notes, and snippets.

View m1tk4's full-sized avatar

Dimitri Tarassenko m1tk4

View GitHub Profile
@m1tk4
m1tk4 / bars_w_text.bat
Created March 4, 2020 17:59
SMPTE HD Bars + Overlay Text as TS Loop suitable for Mux
@echo off
:: Set duration in seconds
set duration=20
:: Temporary loop TS file to create
set loopfile=svc%1.ts
set "overlaytext=ABC-%2 / LTN"
:: Create the loop file
ffmpeg.exe ^
@m1tk4
m1tk4 / hevc-test-pattern.bat
Last active July 30, 2022 19:11
HEVC Test Pattern to UDP Multicast
@echo off
:: Set duration in seconds
set duration=10
:: Temporary loop TS file to create
set loopfile=loop.mkv
:: Target mpegts URL (ESCAPE &s with ^!!! and add double quotes)
:: see https://www.ffmpeg.org/ffmpeg-protocols.html#udp for full syntax
set "target=udp://239.0.0.1:1234?ttl=13^&pkt_size=1316"
@m1tk4
m1tk4 / nc-proxy-readme.md
Last active August 9, 2024 13:17 — forked from ivan-loh/README.md
netcat tcp proxy, for mapping ports on a remote machine to a local machine

Helper script to map ports to other servers.

Use Case

had a database that was only accesible in the VPC on aws, so i created an dev intance and did a ssh tunnel to that dev instance with netcat mapping the port to the database

Sample Usage

Forward all request from local 5432 to remote host google.com port 80

./nc-proxy.sh 5432 google.com 80
@m1tk4
m1tk4 / semaphore.sh
Created November 8, 2018 00:02
Bash semaphore
( flock -xn 9 && echo 1 && sleep 20 && echo 2 ) 9>>/some/lock/file
@m1tk4
m1tk4 / semaphore.sh
Created November 8, 2018 00:02
Bash semaphore
( flock -xn 9 && echo 1 && sleep 20 && echo 2 ) 9>>/some/lock/file
@m1tk4
m1tk4 / embedded.mak
Last active January 2, 2018 17:21
Embedding PHP , Python and NodeJS code in makefiles
#
# Embedding languages in makefiles
#
# Try making targets in this makefile!
#
# Make variable for testing
MAKE_VARIABLE = 45678
all: php node python
ffmpeg -i udp://235.1.11.12:11112 -vcodec h264_qsv -init_hw_device qsv:hw -profile:v high -preset slow -b:v 5500k -minrate 6M -maxrate 6M -bufsize 1200k -ab 64k -look_ahead 0 -flags:v +ilme+ildct+cgop -mpv_flags +strict_gop -sc_threshold 1000000000 -acodec copy -f mpegts udp://235.1.11.3:11112
@m1tk4
m1tk4 / autologin-tty-centos6.md
Last active January 10, 2019 14:54
Creating a TTY on Centos6 with Automatic Login

Automatic Login TTY on Centos 6

  1. Copy /etc/init/tty.conf to /etc/init/tty-autologin.conf and edit the new file as follows ("myuser" is the user we want to end up logged in automatically on TTY1):
# tty - getty
#
# This service maintains a getty on the specified device.
#
# Do not edit this file directly. If you want to change the behaviour,
# please create a file tty.override and put your changes there.
@m1tk4
m1tk4 / smpte_bars_720.bat
Last active March 1, 2023 09:46
Create a test video file - SMPTE HD Bars with burn-in timecode and 1kHz sound
@echo off
:: Set duration in seconds
set duration=615
:: Note - this outputs 720p 59.94fps drop-frame sample
ffmpeg.exe ^
-f lavfi -i "smptebars=duration=%duration%:size=1280x720:rate=60000/1001" ^
-f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=%duration%" ^
-vf drawtext="fontfile=consola.ttf:\ timecode='00\:00\:00\;00':rate=60000/1001:fontsize=64:fontcolor='white':\ boxcolor=0x00000088:box=1:boxborderw=5:x=20:y=20" ^
-c:v mpeg2video -b:v 6000k ^
@m1tk4
m1tk4 / DFTimecodeFFmpeg.sh
Last active April 18, 2018 23:22
FFmpeg Drop-Frame Timecode Burn-in
# 59.94 drop frame timecodes
# NOTE: if you change ; in TC template to : it will produce 59.94 NDF!
ffmpeg -i input.ts vf drawtext="fontsize=15:fontfile=Roboto-Regular.ttf:\ timecode='00\:00\:00\;00':rate=60000/1001:text='TCR\:':fontsize=72:fontcolor='white':\ boxcolor=0x00000088:box=1:x=10:y=10" -r 60000/1001 output.ts