FFmpeg and SDL2 based library for audio and video playback, written in C99.
This library is still very much todo, but it's slowly getting there.
Features:
- Decoding video & audio via FFmpeg
- Dumping video data on SDL_textures
- Dumping audio data in the usual mono/stereo interleaved formats
- Automatic audio and video conversion to SDL2 friendly formats
- Synchronizing video & audio to clock
- Seeking forwards and backwards
- Bitmap & libass subtitle support. No text (srt, sub) support yet.
Build requirements:
- CMake (>=2.8)
- GCC (C99 support required)
Library requirements:
- SDL2 (>=2.0.3) (Note! Examples require 2.0.4!)
- FFmpeg (>=2.8)
- libass
- CUnit (optional, for unittests)
Note that Clang might work, but is not tested. Older SDL2 and FFmpeg library versions may or may not work; versions noted here are the only ones tested.
sudo apt-get install libsdl2-dev libavcodec-dev libavdevice-dev libavfilter-dev \
libavformat-dev libavresample-dev libavutil-dev libswresample-dev libswscale-dev \
libpostproc-dev libass-dev
These are for x86_64. For 32bit installation, just change the package names a bit .
pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-ffmpeg mingw-w64-x86_64-libass
By default, both static and dynamic libraries are built.
- Dynamic library is called libSDL_kitchensink.dll or .so
- Static library is called libSDL_kitchensink_static.a
- If you build in debug mode (
-DCMAKE_BUILD_TYPE=Debug
), libraries will be postfixed with 'd'.
Change CMAKE_INSTALL_PREFIX as necessary to change the installation path. The files will be installed to
- CMAKE_INSTALL_PREFIX/lib for libraries (.dll.a, .a, etc.)
- CMAKE_INSTALL_PREFIX/bin for binaries (.dll, .so)
- CMAKE_INSTALL_PREFIX/include for headers
mkdir build && cd build
cmake -DCMAKE_BULD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
make -j
sudo make install
mkdir build && cd build
cmake -G "MSYS Makefiles" -DCMAKE_BULD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
make
make install
Just add -DBUILD_EXAMPLES=1
to cmake arguments and rebuild.
Make sure CUnit is installed, then add -DBUILD_UNITTESTS=1
to the cmake arguments and rebuild.
You can run unittests by running make unittest
.
MIT. Please see LICENSE
for details.
Note that FFmpeg has a rather complex license. Please take a look at FFmpeg Legal page for details.
Because pulling major blob of library code like ffmpeg feels like bringing in a whole house with its kitchensink and everything to the project. Also, it sounded funny. Also, SDL_ffmpeg is already reserved :(
Please see examples directory. You can also take a look at unittests for some help. Note that examples are NOT meant for any kind of real life use; they are only meant to show simple use cases for the library.