|
avcpp
2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
|
Wrapper for the FFmpeg that simplify usage it from C++ projects.
Currently covered next functionality:
AVFrame → av::AudioSample & av::VideoFrame, AVRational → av::Rational and so on)AVStream → av::Stream)You can read the full documentation here.
[!NOTE] Oldest versions of the FFmpeg (at least >=2.0) may be successfully built and work but is it not checked for now. Same notes valid for the GCC version from 6.0.
[!NOTE]
Build verification done only for oldest Ubuntu version provided by the GitHub Flow. You can look it here. For now, it is 22.04.
You should install FFmpeg packages from the deb-multimedia.org site:
[!NOTE]
Note 1: I did not test building on Debian.
[!NOTE]
Note 2: Debian Wheezy repo contains only FFmpeg 1.0.8. I tested building only with ~2.x~ 4.0. So it is strongly recommended use Wheezy back-ports repo.
If you are on Ubuntu bionic or Linux Mint 19.x you should add ffmpeg-4 PPA:
After that just install the same packages as above.
If your Git version so old (refer to the SO for clarification) you can just replace --recurse-submodules with pair of git submodule init && git submodule update.
If FFmpeg located in non-standard place:
To point install prefix:
Install:
or (for packaging)
Refer to CMake documentation for more details that can cover some special cases.
AV_ENABLE_STATIC - Bool, enable static library build, On by default.AV_ENABLE_SHARED - Bool, enable shared library build, On by default.AV_BUILD_EXAMPLES - Bool, enable examples build, On by default.AV_BUILD_TESTS - Bool, enable tests build, On by default.AV_DISABLE_AVFORMAT - Bool, disable livavformat usage. libavformat enabled by default. As dependency disables libavfilter and libavdevice.AV_DISABLE_AVFILTER - Bool, disable libavfilter usage. libavfilter enabled by default. As dependency disables libavdevice.AV_DISABLE_AVDEVICE - Bool, disable libavdevice usage. libavdevice enabled by default.CMAKE_CXX_STANDARD - Can be defined globally to override default C++ version. C++17 required at least.FFMPEG_PKG_CONFIG_SUFFIX - String, TBDPC_<component>_LIBRARY_DIRS - Path, hint where FFmpeg component library lookingPC_FFMPEG_LIBRARY_DIRS - Path, hint where a whole FFmpeg libraries lookingPC_<component>_INCLUDE_DIRS - Path, hint where a FFmpeg component includes lookingPC_FFMPEG_INCLUDE_DIRS - Path, hint where a whole FFmpeg includes looking<component> are:AVCODECAVDEVICEAVFORMATAVFILTERAVUTILPOSTPROCSWSCALESWRESAMPLEAvCpp can be simple integrated into CMake-based project as Git submodule.
Just do something like:
And in the your CMakeLists.txt:
AvCpp detects that it included as non-root projects and skips some steps, like installation.
CMake parameters pointed above may be sets before add_subdirectory().
Than use via target_link_libraries:
Just do in your CMakeLists.txt:
Than use via target_link_libraries:
CMake arguments can be set before FetchContent_MakeAvailable call:
Just put into vcpkg.json:
Than in the your CMakeLists.txt:
[!CAUTION]
CMake usage strongly recommended. Meson build has no maintainer and broken for the last code. It is excluded from the CI builds.
Before you can begin with the building you have to clone the repository like this:
IDE Integration:
There are extentions for various IDEs like VS Code/Codium, Eclipse, Xcode, etc. Refer to the docs for more information.
Building the project:
If you don't have the dependencies installed, meson will download and compile them. Because ffmpeg is so large (~2000 c files), you should consider using your package manager to install them. You can then build the project with the following commands:
Configuring the project:
By default the sample projects and the test are compiled. If you don't want this you can disable it with the following commands:
You can set the install prefix using meson --prefix <your/own/prefix>. To see all of the available options just type meson configure and meson configure --help to get more information.
Installing the project:
Just type meson install and the project will be installed in the configured prefix (/usr/local by default).
Running the tests:
To run the test just use meson test. If you disabled the test this will do nothing.