Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Sign up
Compiling FFMPEG on Windows 11 may seem daunting, but it’s actually quite simple if you follow the proper steps. Here’s how:
Prerequisites
Download and install Microsoft Visual Studio 2022. You can download the latest version of Visual Studio from the Microsoft website.
Download and install MSYS2: https://www.msys2.org/
Once the installation is complete, an MSYS2 console will be opened. Install the following prerequisites in this console:
pacman -S make
pacman -S yasm
pacman -S diffutils
pacman -S pkg-config
pacman -S git
Open a Windows terminal, then run:
(the path might change according to visual studio version)
"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
C:\msys64\msys2_shell.cmd -full-path
An MSYS terminal will be opened. In this new console:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg_x64
cd ffmpeg_x64
make clean
./configure --target-os=win64 --arch=x86_64 --toolchain=msvc --disable-everything --enable-shared --enable-decoders --enable-protocols --enable-demuxers --enable-hwaccels --enable-parsers --enable-bsfs --enable-indevs --enable-outdevs --enable-filters
make
make install
The FFmpeg output will be located in C:\msys64\home\<user>\ffmpeg_x64
This is the compilation of FFMPEG with basic functions. For advanced compilation with x264 support, follow this article: x264 and FFMPEG compilation for Windows
Prerequisites
- Windows 10 or greater
- Windows Terminal
- git
Open the Windows Terminal application, go to C:/
, then
run:
git clone https://github.com/m-ab-s/media-autobuild_suite
Since Windows has a strict filename length limit, we’ll need to
shorten the directory name.
mv media-autobuild_suite ab-suite
then, we’ll cd
into the directory.
The Questionnaire
Run ./media-autobuild_suite.bat
, the script will prompt
you questions which you will answer with typing a number, then pressing
enter.
For a light-weight ffmpeg, I recommend saying no to including
third-party libraries except libmp3lame, libopen264, and maybe rav1e and
dav1d (The av1 encoder and decoder respectively).
Don’t worry about choosing an answer you’ll regret later. You can
change your answers after by editing the
./build/media-autobuild_suite.ini
file.
Compiling Options
Before installing all tools and compiling, the script will give you a
chance to edit ./build/ffmpeg_options.txt
. Delete
everything in that file and put:
--disable-autodetect # Don't automatically add libraries
--enable-small # Reduce filesize in final binaries
--enable-version3 # Use the LGPLv3 License
--enable-libopenh264
--enable-librav1e
--disable-debug
--disable-doc
--disable-shared # Keep everything self-contained
--disable-network # Disables the ability to use http/other network protocols
--disable-indevs # Disables ffmpeg's (rather sketchy) recording capabilities
--disable-outdevs # Don't include any output devices
--disable-ffplay # Also disables the sdl library
These are the most important options for building a light-weight,
copyright-compliant ffmpeg and ffprobe binaries.
After you finish answering, the script will install all the compiling
tools needed. It will take a while to install everything, but you’ll
only need to do it once. You’ll find the output at
./local64/bin-video
Blog Index
This is easier said than done, and has taken me over a month to figure out how to do without any issues, but I’ve spent enough time on it that I decided I’d document the process well enough to be completed virtually seamlessly by anyone following me.
Unfortunately, Cygwin’s default toolchain (i.e. the gcc-core
package included with the Cygwin installer) is inherently broken for cross-compiling purposes, and there doesn’t seem to be any intent from the Cygwin maintainers to fix this, so currently, the only way to compile software for Windows with Cygwin is to set up a MinGW-w64 toolchain under it. Thankfully, this is as easy as installing a few packages. After this, we’ll be compiling the remaining packages, before using a combination of both to compile FFmpeg itself.
Using this Guide
Following this guide in its entirety will build a static FFmpeg installation with external libraries such as fdk-aac
, libopus
, x265
and the SOX resampler. I may consider adding instructions for compiling specific external libraries to the guide if I get enough requests to do so for a particular library.
The dependencies used by this guide — made up of the MinGW-w64 cross-compile toolchain itself, all packages installed by apt-cyg
and all packages compiled from source — will consume up to 2.8GB of disk space, although the guide also includes commands to clean up everything but the FFmpeg installation once done. The installation itself, made up of the binaries and documentation, occupies just over 200MB of disk space.
This guide will create a folder in your Home directory called ffmpeg_sources
, where it will download and compile all of the packages being built from source. FFmpeg will be installed to /usr/local
, where the FHS standard recommends that software compiled by the user is installed to. This location also has the secondary advantage of being on the system PATH
by default in Cygwin, and so doesn’t require the $PATH
environment variable to be updated.
Install package manager dependencies
To begin with, download the latest version of the Cygwin installer to install the wget
, tar
, gawk
and git
packages. The good news is that these packages are dependencies for a tool that can prevent you from ever needing to use the Cygwin installer again.
Install the apt-cyg
package manager
Next, install kou1okada’s fork of the apt-cyg package manager. If you don’t currently use a package manager for Cygwin, this step will not only make the rest of the guide a breeze, but will also make your Cygwin experience rival that of any Linux distribution.
Even if you already use a package manager for Cygwin, such as a different fork of the original apt-cyg
, I highly recommend you replace it with this one, which is a much more fully-fledged piece of software compared to the original, as well as the only package manager for Cygwin that is currently in active development.
To install kou1okada’s apt-cyg
:
mkdir -p /usr/local/src &&
cd /usr/local/src &&
git clone https://github.com/kou1okada/apt-cyg.git &&
ln -s "$(realpath apt-cyg/apt-cyg)" /usr/local/bin/
Install build tools and set up the MinGW-w64 cross-compiler
apt-cyg install \
autoconf \
automake \
binutils \
cmake \
doxygen \
git \
libtool \
make \
mercurial \
mingw64-x86_64-SDL2 \
mingw64-x86_64-binutils \
mingw64-x86_64-fribidi \
mingw64-x86_64-gcc-core \
mingw64-x86_64-gcc-g++ \
mingw64-x86_64-headers \
mingw64-x86_64-libtheora \
mingw64-x86_64-libvpx \
mingw64-x86_64-runtime \
mingw64-x86_64-win-iconv \
mingw64-x86_64-windows-default-manifest \
mingw64-x86_64-zlib \
nasm \
pkg-config \
subversion \
texinfo \
yasm
Compile the dependencies
Each section below compiles an external library that will allow you to compile FFmpeg with support for that library enabled. Copy and paste the whole of each command into your shell.
If you decide you don’t require your build of FFmpeg to support a given library, skip its section and remove the corresponding --enable-package
line when compiling FFmpeg in the final stage of this guide.
Create a directory at the root of your Cygwin installation with the following:
rm -rf /ffmpeg_sources &&
mkdir -p /ffmpeg_sources
This is the directory we’ll be downloading our source code to, and compiling it from.
libmp3lame
To compile the LAME audio codec for MP3:
cd /ffmpeg_sources && rm -rf lame-svn &&
svn checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame-svn &&
cd lame-svn &&
./configure --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install
libx264
To compile the x264 video codec:
cd /ffmpeg_sources && rm -rf x264 &&
git clone --depth 1 https://code.videolan.org/videolan/x264.git &&
cd x264 &&
./configure --cross-prefix=x86_64-w64-mingw32- --host=x86_64-w64-mingw32 \
--prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" --enable-static &&
make -j$(nproc) &&
make install
libx265
To compile the x265 video codec:
cd /ffmpeg_sources && rm -rf x265 &&
hg clone https://bitbucket.org/multicoreware/x265 &&
cd x265/build/linux &&
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw" \
-DENABLE_SHARED=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" ../../source \
-DCMAKE_TOOLCHAIN_FILE="/ffmpeg_sources/x265/build/msys/toolchain-x86_64-w64-mingw32.cmake" &&
make -j$(nproc) &&
make install
libogg/libvorbis
The Ogg format is a dependency for the Vorbis audio codec, so will need to be compiled before it:
cd /ffmpeg_sources && rm -rf ogg &&
git clone --depth 1 https://gitlab.xiph.org/xiph/ogg.git &&
cd ogg && ./autogen.sh &&
./configure --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install
Then compile Vorbis as normal:
cd /ffmpeg_sources && rm -rf vorbis &&
git clone --depth 1 https://gitlab.xiph.org/xiph/vorbis.git &&
cd vorbis && ./autogen.sh &&
./configure --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install
libaom
To compile the AV1 video encoder:
cd /ffmpeg_sources && rm -rf aom &&
git clone --depth 1 https://aomedia.googlesource.com/aom &&
mkdir -p /ffmpeg_sources/aom/build && cd /ffmpeg_sources/aom/build &&
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw" \
-DCMAKE_EXE_LINKER_FLAGS="-static" .. \
-DCMAKE_TOOLCHAIN_FILE="/ffmpeg_sources/aom/build/cmake/toolchains/x86_64-mingw-gcc.cmake" &&
make -j$(nproc) &&
make install
libopus
To compile the Opus audio encoder:
cd /ffmpeg_sources && rm -rf opus &&
git clone --depth 1 https://github.com/xiph/opus.git &&
cd opus && ./autogen.sh &&
./configure CFLAGS="-I/usr/local/llsp" --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install
libfdk-aac
To compile the Fraunhofer FDK encoder for AAC:
cd /ffmpeg_sources && rm -rf fdk-aac &&
git clone --depth 1 https://github.com/mstorsjo/fdk-aac &&
cd fdk-aac && autoreconf -fiv &&
./configure --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install
libsoxr
To compile the SOX resampler library, you’ll first need to create a CMAKE toolchain file for the MinGW-w64 toolchain as the project doesn’t include one by default.
Create a new file in the Cygwin root directory, and call it toolchain-x86_64-mingw32.cmake
(make sure Windows is showing extensions, and that the extension is .cmake
).
Copy and paste the following into the file:
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres)
SET(CMAKE_Fortran_COMPILER /usr/bin/x86_64-w64-mingw32-gfortran)
SET(CMAKE_AR:FILEPATH /usr/bin/x86_64-w64-mingw32-ar)
SET(CMAKE_RANLIB:FILEPATH /usr/bin/x86_64-w64-mingw32-ranlib)
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(QT_BINARY_DIR /usr/x86_64-w64-mingw32/bin /usr/bin)
SET(Boost_COMPILER -gcc47)
Now you can compile the SOX resampler as normal:
cd /ffmpeg_sources && rm -rf soxr &&
git clone --depth 1 https://git.code.sf.net/p/soxr/code soxr &&
mkdir -p soxr/build && cd soxr/build &&
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw" \
-DBUILD_SHARED_LIBS=OFF .. -DCMAKE_TOOLCHAIN_FILE="/toolchain-x86_64-mingw32.cmake" &&
make -j$(nproc) &&
make install
Compile the FFmpeg binary
The only thing that’s left to is compile FFmpeg itself, using the libraries downloaded or compiled above:
cd /ffmpeg_sources && rm -rf ffmpeg &&
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 &&
tar xvf ffmpeg-snapshot.tar.bz2 && rm -f ffmpeg-snapshot.tar.bz2 && cd ffmpeg &&
CFLAGS=-I/usr/x86_64-w64-mingw32/sys-root/mingw/include &&
LDFLAGS=-L/usr/x86_64-w64-mingw32/sys-root/mingw/lib &&
export PKG_CONFIG_PATH= &&
export PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig &&
./configure \
--arch=x86_64 \
--target-os=mingw32 \
--cross-prefix=x86_64-w64-mingw32- \
--prefix=/usr/local \
--pkg-config=pkg-config \
--pkg-config-flags=--static \
--extra-cflags=-static \
--extra-ldflags=-static \
--extra-libs="-lm -lz -fopenmp" \
--enable-static \
--disable-shared \
--enable-nonfree \
--enable-gpl \
--enable-avisynth \
--enable-libaom \
--enable-libfdk-aac \
--enable-libfribidi \
--enable-libmp3lame \
--enable-libopus \
--enable-libsoxr \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 &&
make -j$(nproc) &&
make install
Remember to remove --enable-\*package\*
lines for each package in the list above that you didn’t download or compile a library for.
Compiling FFmpeg will take much longer than compilation of the external libraries, but once it’s done, you should have a fully working binary enabled with all of the libraries you compiled it with. To run it, simply run ffmpeg
in the Cygwin terminal.
Clean up/uninstall
By this point in the guide, you will have taken up around 2.8 GB of disk space with downloading, installing and compiling. The majority of this is now redundant, and should be cleaned up. More than 2.6 GB of it can be safely purged, which brings the total footprint of our FFmpeg installation down to as little as 200MB.
Post-install clean up
Running the following will free up more than 2.3GB of disk space:
apt-cyg remove \
cmake \
doxygen \
git \
mercurial \
subversion \
texinfo \
yasm &&
rm -rf /ffmpeg_sources &&
rm -rf /usr/local/lib/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/lib/pkgconfig/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/include/{libav*,libpost*,libsw*} &&
rm -rf /toolchain-x86_64-mingw32.cmake
As well as removing the ffmpeg_sources
directory and unneeded static libraries, this will also remove any packages installed earlier that are no longer needed, except for those that are commonly needed for building tools on Cygwin/Linux.
Remove the cross-compiler
If you no longer intend to compile any other programs using the MinGW-w64 cross-compiling toolchain built earlier in this guide, you can safely uninstall it, as well as all the remaining packages installed earlier:
apt-cyg remove \
autotools \
autoconf \
automake \
gcc-core \
gcc-g++ \
pkg-config \
libtool \
make \
nasm \
mingw64-x86_64-SDL2 \
mingw64-x86_64-binutils \
mingw64-x86_64-fribidi \
mingw64-x86_64-gcc-core \
mingw64-x86_64-gcc-g++ \
mingw64-x86_64-headers \
mingw64-x86_64-libtheora \
mingw64-x86_64-libvpx \
mingw64-x86_64-runtime \
mingw64-x86_64-win-iconv \
mingw64-x86_64-windows-default-manifest \
mingw64-x86_64-zlib &&
rm -rf /usr/x86_64-w64-mingw32
This will free up an additional ~450 MB of space.
Uninstalling FFmpeg
If you ever need to reverse all of the steps in this guide and purge the FFmpeg binaries from your system, simply run the following:
apt-cyg remove \
autotools \
autoconf \
automake \
binutils \
cmake \
doxygen \
gcc-core \
gcc-g++ \
git \
libtool \
make \
mercurial \
mingw64-x86_64-SDL2 \
mingw64-x86_64-binutils \
mingw64-x86_64-fribidi \
mingw64-x86_64-gcc-core \
mingw64-x86_64-gcc-g++ \
mingw64-x86_64-headers \
mingw64-x86_64-libtheora \
mingw64-x86_64-libvpx \
mingw64-x86_64-runtime \
mingw64-x86_64-win-iconv \
mingw64-x86_64-windows-default-manifest \
mingw64-x86_64-zlib \
nasm \
pkg-config \
subversion \
texinfo \
yasm &&
rm -rf /ffmpeg_sources &&
rm -rf /usr/local/bin{ffmpeg,ffprobe,ffplay} &&
rm -rf /usr/local/lib/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/lib/pkgconfig/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/include/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/share/doc/ffmpeg &&
rm -rf /usr/local/share/ffmpeg &&
rm -rf /usr/local/share/man/man1/ff* &&
rm -rf /usr/local/share/man/man3/{libav*,libpost*,libsw*} &&
rm -rf /usr/x86_64-w64-mingw32/ &&
rm -rf /toolchain-x86_64-mingw32.cmake
This will remove everything installed during the process of this guide, and revert your system to exactly how it was before starting it.
Instead of doing everything manually, you can use the media-autobuild_suite
for Windows, which builds FFmpeg with almost all of its dependencies:
This Windows Batchscript setups a MinGW/GCC compiler environment for building ffmpeg and other media tools under Windows. After building the environment it retrieves and compiles all tools. All tools get static compiled, no external .dlls needed (with some optional exceptions)
The script gets continuously updated, and for most users, it will be the preferred way to get FFmpeg compiled under Windows.
I’m a big fan of the FFmpeg builds by Kyle Schwarz
though recently the website was down and I had to compile FFmpeg
manually. Although compiling FFmpg on Windows is simple, once
you’ve figured out the details, it will still take you some time
to get it right.
Therefore I’m providing these instructions that you can follow
step-by-step and will build a shared library for FFmpeg with X264.
Note that at the time of writing you can’t link
statically with X264, see the X264_API_IMPORTS
define in
FFmpegs source. I’ve tried to keep things as short as possible.
Hit me up on Twitter when you have
any questions. Thanks Matthias C. M. Troffaes for
providing fixes that allow us to compile X264 with MSVC with MSYS2.
You can download the shell script containing all the steps
from this gist
1. Install MSYS2
- Download MSYS2, msys2-x86_64-{date}.exe
- Install into
c:/msys64
- Edit
c:/msys64/msys2_shell.cmd
and removerem
from the line withrem MSYS2_PATH_TYPE=inherit
- Open a
x64 Native Tools Command Prompt for VS 2019
- Run
c:/msys64/msys2_shell.cmd
- Use the
MSYS2 shell for the next steps
and enter:
pacman -Syu pacman -S make pacman -S diffutils pacman -S yasm pacman -S nasm mv /usr/bin/link.exe /usr/bin/link.exe.bak
2. Get the sources for x264 and ffmpeg
mkdir tmp cd tmp mkdir sources mkdir build cd sources git clone --depth 1 https://code.videolan.org/videolan/x264.git git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git
3. Fix the build scripts for x264
cd tmp/sources/x264 curl "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" > config.guess sed -i 's/host_os = mingw/host_os = msys/' configure
4. Compile X264
- Open
x64 Native Tools Command Prompt for VS2019
- Run
c:/msys64/msys2_shell.cmd
- Use the
MSYS2 shell for the next steps
cd tmp/build mkdir x264 cd x264 CC=cl ./../../sources/x264/configure --prefix=./../../installed --enable-shared make -j 8 make install mv ./../../installed/lib/libx264.dll.lib ./../../installed/lib/libx264.lib
5. Compile FFmpeg
- Open
x64 Native Tools Command Prompt for VS2019
- Run
c:/msys64/msys2_shell.cmd
- Use the
MSYS2 shell for the next steps
cd tmp/build mkdir ffmpeg cd ffmpeg export CC=cl ./../../sources/ffmpeg/configure \ --prefix=./../../installed \ --toolchain=msvc \ --arch=x86_64 \ --enable-yasm \ --enable-asm \ --enable-shared \ --disable-static \ --disable-programs \ --enable-avresample \ --enable-libx264 \ --enable-gpl \ --extra-ldflags="-LIBPATH:./../../installed/lib/" \ --extra-cflags="-I./../../installed/include/" make V=1 -j 8 make install
..or as a oneliner
CC=cl ./../../sources/ffmpeg/configure --prefix=./../../installed --toolchain=msvc --arch=x86_64 --enable-yasm --enable-asm --enable-shared --disable-static --disable-programs --enable-avresample --enable-libx264 --enable-gpl --extra-ldflags="-LIBPATH:./../../installed/lib" --extra-cflags="-I./../../installed/include/"
NAT Types
This is so exciting, in this article I dive into some of the different ways a NAT device translates addresses which is important for peer-to-peer connections.
Building Cabinets
In this post I dive into the design and construction of a cabinet with an interact LED strip. I also explain how I dynamically change the colors of the LEDs over TCP/UDP.
Compiling GStreamer from source on Windows
How to compile GStreamer on Windows from Source using Visual Studio 2019 and the meson build system.
Debugging CMake Issues
In this post I explain a process you can follow to debug issues with CMake by focusing on a specific target and making the output verbose.
Dual Boot Arch Linux and Windows 10
How to install Arch Linux and Windows 10 Pro as dual boot. A step by step tutorial how to create bootable installers, partition and setup a dual boot menu.
Mindset Updated Edition, Carol S. Dweck (Book Notes)
Paragraphs I marked from the book «Mindset» from Carol S. Dweck.
How to setup a self-hosted Unifi NVR with Arch Linux
A step by step HOW-TO that explain show to setup a Unifi Video Controller with an NFS share with Arch Linux.
Blender 2.8 How to use Transparent Textures
Follow this node setup when you want to use an image with transparency as a «sticker».
Compiling FFmpeg with X264 on Windows 10 using MSVC
A couple of steps to compile FFmpeg on Windows using MSVC.
Blender 2.8 OpenGL Buffer Exporter
The following Blender script creates a [name].h and [name].cpp for the selected object and stores the positions, normals and UVs.
Blender 2.8 Baking lightmaps
Light maps are a cheap way to add a lot of realism to you static scenes and have been used forever.
Blender 2.8 Tips and Tricks
Use Environment Map only for reflections; create a floor plane for a Product Render, diffuse texture for roughness and more!
Setting up a Bluetooth Headset on Arch Linux
Learn how to setup a Sennheiser PXC 550 Bluetooth headset on Arch Linux.
Compiling x264 on Windows with MSVC
Compile the excellent x264 source on Windows using MSYS2 and MSVC.
C/C++ Snippets
Is a number divisible by four?
Reading Chunks from a Buffer
Some thoughts on reading bytes from a file; handy for reading NALs.
Handy Bash Commands
Bash scripts: removing white space, lowercase filenames, backup using tar, etc.
Building a zero copy parser
Simple solution to parse data in a pretty performant way. Used this for a RTSP protocol parser.
Kalman Filter
A very simple yet powerful filter which works great when you have to smooth noisy data. Used for the Nike Rise 2.0 project.
Saving pixel data using libpng
Do you have raw RGBA data that you want to save? Use this snippet to save it into a PNG file.
Compile Apache, PHP and MySQL on Mac 10.10
Setup you own PHP, MySQL and Apache and with virtual document roots.
Fast Pixel Transfers with Pixel Buffer Objects
Using Pixel Buffer Objects (PBO) for fast asynchronous data transfers and OpenGL.
High Resolution Timer function in C/C++
Wait…… wait.. fast high resolution timer funtions (Windows, Linux, Mac)
Rendering text with Pango, Cairo and Freetype
My never ending obsession with font rendering. A complex beast to do well. Use Pango and FreeType for the heavy lifting.
Fast OpenGL blur shader
Make things look blurry … and fast using this OpenGL blur shader.
Spherical Environment Mapping with OpenGL
An old trick to get great lighting effects using Environment Maps and OpenGL.
Using OpenSSL with memory BIOs
OpenSSL is a great library with lots of abstractions. In this post I discuss how to break some of these abstractions and use your own memory buffers.
Attributeless Vertex Shader with OpenGL
A simple way to render a fullscreen quad without a vertex buffer with OpenGL.
Circular Image Selector
Some thoughts on a different way to select images from a huge collection in a compact UI.
Decoding H264 and YUV420P playback
Using libav to demux and playback with OpenGL.
Fast Fourier Transform
Analyse your audio using the Fastest Fourier Transform in the West.
OpenGL Rim Shader
Pretty glowy edges using a GLSL rim shader.
Rendering The Depth Buffer
Render the non-linear OpenGL Depth Buffer.
Delaunay Triangulation
Do you need to triangulate some shape: use the “Triangle” library.
RapidXML
RapidXML is a versatile and fast XML parser with a simple API. Check out these examples.
Git Snippets
Some simple GIT snippets; added here to remind myself.
Basic Shading With OpenGL
A couple of basic GLSL shaders with explanation.
Open Source Libraries For Creative Coding
Collection of great open source libraries for you creative programming projects.
Bouncing particle effect
Snippet that can be used to create a bouncy particle effect; basic, effective, simple but nice.
OpenGL Instanced Rendering
Want to render thousands and thousands of objects? Use OpenGL instanced rendering. The solution…the only solution.
Mapping a texture on a disc
Ever heard about projective interpolation related to texture mapping? Learn about this intertesting issue with OpenGL and texture mapping.
Download HTML page using CURL
When you want a quick solution to perform a HTTP(S) request CURL is always a quick an simple solution. Check out this example code.
Height Field Simulation on GPU
Although not a Navier-Stokes implementation … still a very nice and enjoyable effect.
OpenCV
Optical Flow: when doing anything with tracking you’ve probably heard of it. See this simple example code using OpenCV and OpenGL.
Some notes on OpenGL
FBOs and Depth Testing, using different Attachment Points, a YUV420p shader, …
Math
Meaning of the Dot Product in 3D graphics, calculating a perpendicular vector using Sam Hocevar’s solution, orientation matrix and more.
Gists to remember
Some gists that I want to remember, often use, etc…
Reverse SSH
Do you want to login, into a remote PC but the remote PC is behind a firewall? Then use this simple reverse SSH trick which doesn’t require changing your firewall rules.
Working Set
Having issues with your compiler? Or during linking? Check these common issues and their solutions. I also list several tools that you can use to get a some useful info.
Consumer + Producer model with libuv
Example of a common Multi Threaded Consumer/Producer Model using LibUV.
Parsing binary data
Learn about the basic of a binary protocol and how to create one easily yourself.
C++ file operation snippets
Reading a file into a string, vector, checking the file size, change to a position, etc. A collection of C++ file operation snippets.
Importance of blur with image gradients
Do you want to experiment with OpenGL and aligning Brush Strokes along Image Gradients? Then check out this post about the importance of blurring.
Real-time oil painting with openGL
Code snippet for fake «oil painting» effect with OpenGL using instanced rendering.
x264 encoder
Basic example on how to use libx264 to encode image data using libav
Generative helix with openGL
Screenshots of a project I worked on with that generates a DNA helix.
Mini test with vector field
Screenshots while experimenting with a vector field; nothing much to see here.
Protractor gesture recognizer
Testing the amazing One Dollar $1 gesture recognizer. The simplest and very good gesture recognizer.
Hair simulation
Example code that implements the «Fast Simulation of Inextensible Hair and Fur» paper from M. Müller, T.Y. Kim and N.Chentanez.
Some glitch screenshots
Glitch screenshots.
Working on video installation
Screenshots of some experiments of a video installation.
Generative meshes
I enjoy creating physics based simulations and render them on high res. Here are some experiments I did a time ago.
Converting video/audio using avconv
Examples that show you how to use avconv to manipulate video and audio files.
Auto start terminal app on mac
Automatically start you application whe Mac boots and make sure that it restarts your app when it exists. Handy for interactive installations.
Export blender object to simple file format
Export the selected object in Blender into a .h and .cpp file that prepresents the buffer.