Skip to content

Instantly share code, notes, and snippets.

View DevStefIt's full-sized avatar
👨‍💻

Stef DevStefIt

👨‍💻
View GitHub Profile
@DevStefIt
DevStefIt / ffmpeg_compile_debug.sh
Last active February 8, 2025 17:08
Statically compiling FFmpeg on Windows with MSVC
# Make sure you opened the x64 Native Tools Command Prompt for VS 2022 and then opened MSYS2 shell command
echo Compiling ffmpeg...
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ../build
mkdir ffmpeg
cd ffmpeg
CC=cl \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:../../installed/x264/lib/pkgconfig:../../installed/x265/lib/pkgconfig:../../installed/SDL/lib/pkgconfig" \
../../sources/ffmpeg/configure \
--prefix=../../installed/ffmpeg \
@DevStefIt
DevStefIt / sdl_compile_debug.sh
Last active February 8, 2025 17:06
Compiling SDL (Simple DirectMedia Layer) statically on Windows
# Make sure you opened the x64 Native Tools Command Prompt for VS 2022 and then opened MSYS2 shell command
echo Getting SDL...
git clone https://github.com/libsdl-org/SDL.git -b SDL2
cd ../build
mkdir SDL
cd SDL
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX="../../installed/SDL" -DSDL_STATIC=ON -DSDL_SHARED=OFF ../../sources/SDL
cmake --build . --config Debug --target install
@DevStefIt
DevStefIt / libxvpx_compile.sh
Last active February 8, 2025 17:05
Statically compiling libvpx on Windows
# Make sure you opened the x64 Native Tools Command Prompt for VS 2022 and then opened MSYS2 shell command
echo Getting libvpx...
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
cd ../build
mkdir libvpx
cd libvpx
../../sources/libvpx/configure --target=x86_64-win64-vs17 --enable-static --enable-static-msvcrt --disable-examples --disable-tools --disable-docs --disable-unit-tests --prefix="../../installed/libvpx"
make
make install
mv ../../installed/libvpx/lib/x64/vpxmt.lib ../../installed/libvpx/lib/x64/vpx.lib
@DevStefIt
DevStefIt / libx265_compile_debug.sh
Last active October 12, 2024 22:56
libx265 compiling on Windows
# Make sure you opened the x64 Native Tools Command Prompt for VS 2022 and then opened MSYS2 shell command
git clone https://bitbucket.org/multicoreware/x265_git
mv x265_git x265
# Modify "ffmpeg_build/sources/x265/source/CMakeLists.txt with the following edit
#
# add_definitions(/Ob2) # always inline
#
# To:
# if(CMAKE_BUILD_TYPE STREQUAL "Release")
# add_definitions(/Ob2) # always inline, only for release
@DevStefIt
DevStefIt / libx264_compile_debug.sh
Last active October 12, 2024 22:48
libx264 compiling on Windows
# Make sure you opened the x64 Native Tools Command Prompt for VS 2022 and then opened MSYS2 shell command
git clone https://code.videolan.org/videolan/x264.git
cd x264
cd ../../build
mkdir x264
cd x264
CC=cl ../../sources/x264/configure --prefix=../../installed/x264 --enable-static --disable-cli --enable-debug --extra-cflags="-MTd -Od -Zi -RTC1 -W4" --extra-ldflags="-DEBUG"
make
make install
@DevStefIt
DevStefIt / wav_creator.py
Created January 1, 2024 13:06
WAV file creator and parser as explained in the related video
import wave
import struct
import math
# Audio parameters
sample_width = 2
sample_rate = 44100
duration = 5
# Define the melody
@DevStefIt
DevStefIt / bmp_creator.py
Created June 2, 2023 14:08
BMP File Format programs used in the video
import random
from PIL import Image
def create_random_image(width, height):
# Create a new blank image with RGB mode
image = Image.new('RGB', (width, height))
# Create a pixel map
pixels = image.load()
@DevStefIt
DevStefIt / pyav_copystream.ipynb
Last active May 27, 2023 16:51
PyAV - first approach
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from tkinter import Tk
from tkinter.filedialog import askopenfilename
from pathlib import Path
import subprocess
Tk().withdraw()
input_file = Path(askopenfilename(title='Load video file', initialdir=f"{Path.home()}"))
input_projection = 'equirect'
output_projection = ['c3x2', 'c6x1', 'c1x6',
'eac',
@DevStefIt
DevStefIt / ffmpeg_dash.sh
Last active July 5, 2025 07:47
HLS and DASH guide on an Nginx server with RTMP mode enabled, with FFmpeg as support
ffmpeg -re -i INPUT -c:v libx264 -c:a aac -preset slower -f dash ARBITRARY_NAME.mpd