Skip to content

Instantly share code, notes, and snippets.

@ajdungan
ajdungan / subs.sh
Created April 4, 2024 11:35 — forked from S-trace/subs.sh
A simple script to beautify and improve readability of .ass subtitles and converting subtitles .srt <=> .ass {\\bord3} - ASS subtitles outline width {\\blur14} - blur ratio (to create smooth transition between movie and subtitles)
#!/usr/bin/env sh
COMMAND=$1
case "$COMMAND" in
ass-outline)
# Add outline to all ASS subtitles in current directory
for file in *.ass; do
echo "$COMMAND: Processing $file"
perl -pe 's/(^Dialogue: ([^{]*?,){9})(?=[^{])/\1\{\\bord3}\{\\blur14}/g' <"$file" >temp
mv temp "$file"
@ajdungan
ajdungan / ffmpegtips.txt
Created June 17, 2022 05:12 — forked from rabssm/ffmpegtips.txt
ffmpeg tips
# Interpolate video frames for a higher frame rate
ffmpeg -i source.mp4 -filter:v minterpolate -r 25 result.mp4
ffmpeg -i source.mp4 -vf minterpolate=50,tblend=all_mode=average,framestep=2 result.mp4
# Crop a video to the bottom right quarter
ffmpeg -i in.mp4 -filter:v "crop=in_w/2:in_h/2:in_w/2:in_h/2" -c:a copy out.mp4
# Resize a video to half size
ffmpeg -i input.mkv -filter_complex "scale=in_w/2:in_h/2" output.mkv
@ajdungan
ajdungan / install_yay.bash
Last active July 20, 2021 00:53 — forked from macchaberrycream/install_yay.bash
[install yay shell script] #ArchLinux
#!/usr/bin/env bash
# yay
# Yet another Yogurt - An AUR Helper written in Go
# <https://github.com/Jguer/yay>
#make sure git is fully installed
sudo pacman -S git #improve automation of this step
@ajdungan
ajdungan / whatsappffmpeg_convert.md
Last active June 13, 2023 17:34
whatsapp friendly video ffmpeg convert

ffmpeg commands to encode whatsapp friendly videos

Using these can make videos be able to be played natively within whatsapp. Also very helpful to make videos to be a small file size that is still decent quality. For example: to fit as an email attachment to to share with persons who have limted internet bandwidth).

Really long videos may not work or need to be further compressed or split into multiple files (possible to write/find a script to control for this). Size restrictions might change over time currently they are ________?

Method 1 - more options and filters (best option, usually)

source: https://newspaint.wordpress.com/2020/05/17/using-ffmpeg-to-encode-a-video-for-whatsapp/

Note: Main setting you might want to adjust:

[UTC-12] Samoa Standard Time
[UTC-11] Hawaii-Aleutian Standard Time, Cook Island Time
[UTC-9] Alaska Standard Time
[UTC-9] Gambier Island Time
[UTC-8] Pacific Standard Time
[UTC-7] Mountain Standard Time
[UTC-6] Central Standard Time
[UTC-5] Eastern Standard Time
[UTC-4:30] Venezuelan Standard Time
[UTC-4] Atlantic Standard Time
@ajdungan
ajdungan / x11vnc.sh
Last active July 19, 2021 22:36
x11vnc starup script
############ x11vnc starup ################
#script to start x11vnc on system startup as a service
#goal is to have a persistent connection that works from system startup to shutdown/reboot
#WARNING: SECURITY IS NOT OF CONCERN
#single command
x11vnc -display :0 -bg -rfbport 5901 -shared -forever -nonap -q -repeat -skip_lockkeys
#NOTE: don't run as root/sudo, must run as current user logged in using the display (normally default setting, ie no extra commends/options needed)