avcpp 3.2.1
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
avcpp

A C++17 wrapper for FFmpeg that turns its C API into types with constructors, destructors and error codes.

FFmpeg is a set of C libraries with manual memory management, out-parameters and integer error codes. avcpp keeps the same model — no hidden copies, no buffering you did not ask for — but wraps it into RAII types in the av namespace:

FFmpeg avcpp
AVFrame av::VideoFrame, av::AudioSamples, av::SubtitleFrame
AVPacket av::Packet
AVCodecContext av::CodecContext2 and its encoder/decoder subclasses
AVFormatContext av::FormatContext
AVStream av::Stream
AVFilterGraph av::FilterGraph
AVDictionary av::Dictionary, av::DictionaryArray
AVRational av::Rational
AVBufferRef av::BufferRef

What is covered

  • container formats and contexts: demuxing, muxing, seeking;
  • codecs and codec contexts: decoding and encoding, including the send/receive API;
  • frames, audio samples and subtitles, including text and ASS payloads and bitmap rectangles;
  • filter graphs: parsing from a string or building them by hand;
  • software video scaling and audio resampling;
  • hardware acceleration: devices, hardware frames, zero-copy decode/encode paths.

Requirements

  • FFmpeg >= 4.0 (libavformat, libavcodec, libavutil, libswscale, libswresample; libavfilter and libavdevice are optional at build time);
  • a compiler with C++17 support (GCC >= 9, Clang, MSVC);
  • CMake >= 3.19 for the recommended build.

Getting started

git clone https://github.com/h4tr3d/avcpp.git
cd avcpp
cmake -B build
cmake --build build -j

Call av::init() once before using anything else, then link against avcpp::avcpp. The rest of the setup — package managers, FetchContent, add_subdirectory, configuration options — is on the Building and installing page.

Where to go next

The groups of the API reference: Core utilities, Containers and I/O, Codecs, Frames and formats, Filtering, Hardware acceleration, Subtitles.

Example programs live in example/api2-samples/ in the repository; each one is a self-contained .cpp file that can be built and run on its own.