Skip to content

Instantly share code, notes, and snippets.

View krzemienski's full-sized avatar
💭
📼

Nick Krzemienski krzemienski

💭
📼
View GitHub Profile
@krzemienski
krzemienski / sd-webui-txt2img-img2img-api-example.py
Created August 29, 2024 13:19 — forked from w-e-w/sd-webui-txt2img-img2img-api-example.py
Stable Diffusion web UI txt2img img2img api example script
from datetime import datetime
import urllib.request
import base64
import json
import time
import os
webui_server_url = 'http://127.0.0.1:7860'
out_dir = 'api_out'
@krzemienski
krzemienski / cuda_11.8_installation_on_Ubuntu_22.04
Created August 21, 2024 03:51 — forked from MihailCosmin/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@krzemienski
krzemienski / awesome-list-static-site-multi-frameworks.sh
Created May 23, 2024 15:14
A shell script to test out multiple static site generators for awesome lists
#!/bin/bash
# Function to check if a port is available
check_port() {
local port=$1
if ! lsof -i:$port > /dev/null; then
echo $port
else
while lsof -i:$port > /dev/null; do
port=$((port+1))
@krzemienski
krzemienski / ffmpeg.go
Created February 8, 2024 22:21 — forked from aperture147/ffmpeg.go
fix make buffer
package main
import (
"bytes"
"io/ioutil"
"log"
"os"
"os/exec"
)
@krzemienski
krzemienski / main.go
Created January 25, 2024 15:48 — forked from tehmoon/main.go
Download from s3 in a streaming fashion
package main
import (
"net/url"
"fmt"
"github.com/tehmoon/errors"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/aws/aws-sdk-go/service/s3"
"io"
@krzemienski
krzemienski / install-nginx-rtmp-module.sh
Created December 31, 2023 22:04 — forked from afriza/install-nginx-rtmp-module.sh
Install NGINX RTMP module with HLS support on Ubuntu 18.04
sudo apt install curl gnupg2 ca-certificates lsb-release
echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
sudo apt update
NGINX_VERSION=$(apt show nginx | grep "^Version" | cut -d " " -f 2 | cut -d "-" -f 1)
# take note of the nginx version in the "stable" release. e.g. 1.14.2
echo NGINX version $NGINX_VERSION
wget https://hg.nginx.org/pkg-oss/raw-file/default/build_module.sh
chmod a+x build_module.sh
@krzemienski
krzemienski / install-nginx-rtmp-module.sh
Created December 31, 2023 22:04 — forked from afriza/install-nginx-rtmp-module.sh
Install NGINX RTMP module with HLS support on Ubuntu 18.04
sudo apt install curl gnupg2 ca-certificates lsb-release
echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
sudo apt update
NGINX_VERSION=$(apt show nginx | grep "^Version" | cut -d " " -f 2 | cut -d "-" -f 1)
# take note of the nginx version in the "stable" release. e.g. 1.14.2
echo NGINX version $NGINX_VERSION
wget https://hg.nginx.org/pkg-oss/raw-file/default/build_module.sh
chmod a+x build_module.sh
@krzemienski
krzemienski / encoding.txt
Created September 14, 2023 19:29 — forked from Andrey2G/encoding.txt
Video Encoding with multiple resolutions
ffmpeg -i "c:/videos/sample.mp4
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0
-c:v libx264 -crf 22 -c:a aac -ar 48000
-filter:v:0 scale=w=480:h=360 -maxrate:v:0 600k -b:a:0 64k
-filter:v:1 scale=w=640:h=480 -maxrate:v:1 900k -b:a:1 128k
-filter:v:2 scale=w=1280:h=720 -maxrate:v:2 900k -b:a:2 128k
-var_stream_map "v:0,a:0,name:360p v:1,a:1,name:480p v:2,a:2,name:720p"
-preset slow -hls_list_size 0 -threads 0 -f hls -hls_playlist_type event -hls_time 3
-hls_flags independent_segments -master_pl_name "name-pl.m3u8"
"c:/videos/encoded/name-%v.m3u8"
@krzemienski
krzemienski / ffmpeg-gnu-parallel-snippets.md
Created June 11, 2023 19:16 — forked from Brainiarc7/ffmpeg-gnu-parallel-snippets.md
Some snippets you can quickly adapt for use with FFmpeg and GNU Parallel for use for standard tasks.

Useful Examples of ffmpeg and GNU parallel on the command-line:

Transcoding FLAC music to Opus:

ffmpeg is a highly useful application for converting music and videos. However, audio transcoding is limited to a a single core. If you have a large FLAC archive and you wanted to compress it into the efficient Opus codec, it would take forever with the fastest processor to complete, unless you were to take advantage of all cores in your CPU.

parallel 'ffmpeg -v 0 -i "{}" -c:a libopus -b:a 128k "{.}.opus"' ::: $(find -type f -name '*.flac')

Transcoding Videos to VP9:

@krzemienski
krzemienski / nvenc-capabilities-ffmpeg.md
Created June 11, 2023 19:16 — forked from Brainiarc7/nvenc-capabilities-ffmpeg.md
See the supported NVENC and NPP capabilities in your FFmpeg build

Quickly check for supported NVENC and NPP hardware acceleration capabilities in FFmpeg on your platform:

Depending on how you built ffmpeg, you may want to check the supported NVENC-based hardware acceleration capabilities in ffmpeg by running:

$ for i in encoders decoders filters; do
    echo $i:; ffmpeg -hide_banner -${i} | egrep -i "npp|cuvid|nvenc|cuda|nvdec"
done

Sample output (as on my testbed):