Skip to content

Instantly share code, notes, and snippets.

@johan149
johan149 / ffmpeg_optimized_videos.md
Last active December 25, 2021 01:44
Convert HQ image sequences to h264/mp4 h265/mp4 ogv/theora & vp9/webm For Cross-Browser Compatibility
  • H264 CRF 17
ffmpeg -y -r 30 -f image2 -i "C:\Users\server\Downloads\meetmo\meetmo_2.0\auth\animations\bg\login_bg.%04d.png" -c:v libx264 -crf 17 -profile:v high -preset veryslow -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart -an "C:\Users\server\Downloads\meetmo\meetmo_2.0\auth\animations\login_bg_h264_crf17.mp4"
  • H264 CRF 23
ffmpeg -y -r 30 -f image2 -i "C:\Users\server\Downloads\meetmo\meetmo_2.0\auth\animations\bg\login_bg.%04d.png" -c:v libx264 -crf 23 -profile:v high -preset veryslow -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart -an "C:\Users\server\Downloads\meetmo\meetmo_2.0\auth\animations\login_bg_h264_crf23.mp4"
  • H264 CRF 25
@johan149
johan149 / install_dev_srs.sh
Last active November 8, 2023 23:02
Install SRS dev docker
# run this on the clean CLI
# bash <(curl -sL https://gist.githubusercontent.com/johan149/8eba975312814db14155ba9e56010946/raw/d0b6eeaa14291d4395c059890eff04bff385f678/install_dev_srs.sh)
# install docker
sudo apt update
sudo apt -y install apt-transport-https ca-certificates curl software-properties-common aria2
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
# bash <(curl -sL https://gist.githubusercontent.com/johan149/dfbc121b2eacbf2f7044fa500aa8e518/raw/f9f8fcebddc7744504b3daf4fdf30b44b1649de5/install_cuda_12.1.1_ubuntu2024.sh)
# Remove current cuda version
sudo apt-get --purge remove -y "*cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*"
sudo apt-get --purge remove -y "*nvidia*" "libxnvctrl*"
sudo apt-get autoremove -y
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda-repo-ubuntu2004-12-1-local_12.1.1-530.30.02-1_amd64.deb
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
# SRT config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
# run this on the clean CLI
# bash <(curl -sL https://gist.githubusercontent.com/johan149/98604b831521a6c2435bfb74eacf075e/raw/7601555f22c12d8bce2854d4975d14a326dd16bd/install_docker.sh)
# install docker
sudo apt update
sudo apt -y install apt-transport-https ca-certificates curl software-properties-common aria2
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
@johan149
johan149 / inet
Last active January 25, 2023 07:34
#!/bin/sh
# get internal IP, mac address, and public ip
# To install run the following
# sudo wget -qO /usr/local/bin/inet https://gist.githubusercontent.com/johan149/0598c69f193f34058cf77fa3c3b68551/raw/efcdcc0e0a8862e7de68f244af2cb0a20e33e06a/inet && sudo chmod a+x /usr/local/bin/inet
#to run just type and hit enter 'inet'
echo 'eno1'
eth1=eno1
# This file is copied from: https://github.com/k4yt3x/simple-http-server/blob/master/Dockerfile
# LICENS: BSD 2-Clause "Simplified" License
# please see https://github.com/k4yt3x/simple-http-server/blob/master/LICENSE for more details
FROM rust:1.61-alpine3.15 as builder
# branch name or tag
ARG BRANCH
RUN apk add --no-cache --virtual .build-deps git make musl-dev openssl-dev perl pkgconfig \
&& git clone -b $BRANCH https://github.com/TheWaWaR/simple-http-server.git /simple-http-server \
&& RUSTFLAGS='-C link-arg=-s' cargo build \
@johan149
johan149 / cping
Last active January 26, 2023 09:07
#!/bin/bash
printf "Vultr/Choopa Ping Test:\n\n"
# https://www.vultr.com/resources/faq/#downloadspeedtests
for DC in NJ-US IL-US GA-US FL-US TX-US HON-HI-US SJO-CA-US LAX-CA-US MEX-MX WA-US TOR-CA FRA-DE AMS-NL PAR-FR LON-GB MEL-AU SYD-AU SGP HND-JP SEL-KOR JNB-ZA BLR-IN DEL-IN BOM-IN OSK-JP MAD-ES STO-SE WAW-PL SCL-CL SAO-BR
do
printf "$DC: \t$(ping -i .2 -c 10 -q $DC-ping.vultr.com | awk -F/ '/^round|^rtt/{print $5}') ms\n" | expand -t 20
done