Open-source project
Raveler/ffmpeg-cpp avatar
Raveler/ffmpeg-cpp

ffmpeg-cpp, a thin C++ wrapper so you never shell out to the ffmpeg binary

A clean, easy-to-use C++ wrapper around the ffmpeg libraries

632 stars136 forksC++License varies

At a glance

What is it?
ffmpeg-cpp is a C++ wrapper around the FFmpeg libraries, aimed at applications that want to transcode in process rather than spawn an external executable, with a full object API and a simplified C interface for .NET callers through DllImport. It suits Windows and Visual Studio users, and its own documentation says only Windows builds are supported, with Linux and macOS left on the roadmap.
Who is it for?
Adopt ffmpeg-cpp when your application must transcode media in process and cannot afford to launch the ffmpeg executable, since antivirus software blocking child processes is the concrete problem the project was written to solve, and the C interface with DllImport is the only clean way to reach it from C#.
Can I use it commercially?
Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
Is it still maintained?
Yes. The repository last received commits 21 days ago.
What is it written in?
Mainly C++, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Why link the libraries instead of running the binary

The project description calls ffmpeg-cpp a clean, easy-to-use C++ wrapper around the ffmpeg libraries, usable in any C++ project or C# project with DllImport or CLR. The README makes the same pitch in stronger terms: the full power of FFmpeg compacted in 10 lines of C++ code.

The motivation is stated plainly in the Why section. The author developed it to integrate FFmpeg into their program without having to call the executable to do an operation, and says this is important because starting up an external executable tends to be blocked by antivirus software and can cause issues with users.

That is a narrow, credible reason. Shipping a desktop or server application that spawns ffmpeg as a child process runs into a specific and well-known class of problem: the antivirus heuristic flags a program that launches an interpreter or a media tool and writes files. Linking the libraries removes the child process entirely, and with it the scan.

The project also says it has been tested for the most common functionality, and that some of the examples from the FFmpeg documentation examples are mirrored in the repository, which is a reasonable way to judge coverage.

The object API: muxer, codec, encoder, filter, demuxer

The full C++ interface mirrors the FFmpeg pipeline as a set of cooperating objects, and the README example loads a video stream, filters it and writes it to another container.

The shape of the code is worth reading even if you never use the library. A Muxer is created for the output file, a VideoCodec is created for the encoder, and a VideoEncoder is created from the codec and tied to the muxer so its output is written to the file. A Filter is created with a filter string and given the encoder, so the chain is filter to encoder to muxer. A Demuxer is created for the input file, and DecodeBestVideoStream sends the best video stream in the container to the filter.

Then two calls do the work. PreparePipeline prepares the output pipeline, and the README notes that this decodes a small amount of frames so the pipeline can configure itself. The remaining frames are pushed with a loop that calls Step while the demuxer is not done, and the muxer is closed at the end to save everything to disk.

The design point is that the filter string is passed straight through, so anything expressible in FFmpeg's own filter syntax is available. The example uses a chain of scale, transpose and vignette, and the C# example uses a crop and a transpose, which tells you the wrapper does not restrict the filter graph to a fixed set of operations.

The simplified C interface for .NET and other foreign callers

For a language that cannot consume C++ objects directly, the project ships a simplified interface library, and the README says it supports only a subset of the full library.

The C entry points are plain functions over an opaque handle:

cpp
#include "SimpleInterface.h"

int main()
{
	void* handle = ffmpegCppCreate("out.mp4");
	ffmpegCppAddVideoStream(handle, "samples/big_buck_bunny.mp4");
	ffmpegCppAddVideoFilter(handle, "transpose=cclock[middle];[middle]vignette");
	ffmpegCppAddAudioStream(handle, "samples/big_buck_bunny.mp4");
	ffmpegCppGenerate(handle);
	ffmpegCppClose(handle);
}

The C# example shows the intended consumption pattern. A DllImport declaration on simple_interface.dll with the Cdecl calling convention exposes each function, and the wrapper class calls them in sequence, checking the handle after every call with ffmpegCppIsError and throwing an InvalidOperationException with the message from ffmpegCppGetError when something went wrong.

The error checking pattern is the part to copy even if you write the C++ side. The simple interface returns errors through the handle rather than through exceptions or return codes, so a caller that forgets to check after ffmpegCppGenerate will silently produce a broken file.

Windows only today, and the FFmpeg build is on you

The installation section is Windows-only, and the README is direct about why: currently, only a Windows environment with Visual Studio is supported, because the author says they do not have experience with cmake and Linux projects, and asks anyone willing to help with configuring cmake to get in touch. The project itself is described as fully platform-independent, so the limitation is in the build setup rather than the code.

The Windows install is four steps. Clone the repository. Download a build of FFmpeg and extract the dev version, which provides the .h and .lib files, and the shared version, which provides the .dll, into the ffmpeg directory in the repository, with more detail in the ffmpeg/readme.txt file. Then open the Visual Studio solution in the source directory and build everything.

The result is a .lib file usable from your own C++ projects, and an include folder generated in the repository root that you add to your own include folders.

One detail is a time bomb: the project was last tested with FFmpeg 4.1. The FFmpeg libraries change their public API between major versions, so a wrapper written against 4.1 is not a wrapper you can point at a current FFmpeg without checking. The reference to the build downloads site is also to a well-known third-party build repository, and the linked domain is one that has changed hands, so treat the exact URL as something to verify rather than something to trust.

The licence story has two layers, and FFmpeg is the tricky one

The README states that the library is licensed under the LGPL. The repository metadata for the project, however, shows the licence field as unknown, so the file in the checkout is what counts.

The more important point is the second layer, and the README flags it directly: FFmpeg, which you will need to build this library, is not LGPL. Depending on how you build it, it is either LGPL or GPL. So if you use the GPL version of FFmpeg, the terms you inherited from that choice apply to your application, not just to the wrapper.

This is the practical trap for anyone embedding the library in a closed-source product. The wrapper being LGPL does not neutralise the licence of the FFmpeg build you link against, and a GPL FFmpeg build pulls the copyleft obligations outward.

The repository layout is small and matches the described structure. There is a source/ directory, an ffmpeg/ directory where the FFmpeg distribution is placed, and a samples/ directory holding the media files the examples read, including big_buck_bunny.mp4, bla.mp4, bla.wav, a couple of Vivaldi samples and raw files such as carphone.h264 and carphone_qcif.y4m. There is no package manifest, no CI directory and no test directory in the listing, which is consistent with the roadmap.

The roadmap says what is missing: Linux, macOS and tests

The project publishes a three item roadmap, and it reads like an honest list of what a user will run into.

Add Linux and Mac build support. Add proper unit tests. Test with more codecs and containers.

Taken together, those three lines define the current state. The library targets a Windows and Visual Studio workflow, its own automated test coverage is not there yet, and the set of codecs and containers it has been exercised against is the most common functionality rather than the full range of FFmpeg.

The demo projects in the solution are the practical substitute for the missing tests. The README points at the demo-project for a thorough exploration of the features, covering demuxing, decoding, filtering, encoding and muxing, and at the other examples for simpler cases to follow.

On the release side, the repository has no GitHub releases, so there is no published artefact to pin a build to, and the last push to the master branch was on 2026-10-02. For a library whose main selling point is avoiding a subprocess, the trade-off a buyer accepts is that they are building a small dependency from source against a specific FFmpeg version, and they are relying on the author's own manual testing rather than on a CI matrix.

Editorial conclusion

Adopt ffmpeg-cpp when your application must transcode media in process and cannot afford to launch the ffmpeg executable, since antivirus software blocking child processes is the concrete problem the project was written to solve, and the C interface with DllImport is the only clean way to reach it from C#. Do not adopt it for a Linux or macOS deployment today, because the README states only a Windows environment with Visual Studio is supported and the author is asking for help with cmake configuration, and do not expect a packaged dependency manager entry, since the install is a clone plus a manually downloaded FFmpeg build. Before you commit, check that the FFmpeg build you supply matches what the wrapper was tested against, that its licence is compatible with yours, since the README is explicit that FFmpeg itself is LGPL or GPL depending on how you build it, and that you are prepared to own the error handling, since the wrapper is thin and the roadmap still lists proper unit tests.

Frequently asked questions

What does the ffmpeg-cpp library do?

It is a C++ wrapper around the FFmpeg libraries that makes the most commonly used functionality available through an object interface with a muxer, codec, encoder, filter and demuxer, plus a simplified C interface. The full FFmpeg pipeline is described as being compacted into 10 lines of C++ code.

Why use ffmpeg-cpp instead of calling the ffmpeg executable?

The README says the project was developed to integrate FFmpeg into a program without calling the executable, because starting up an external executable tends to be blocked by antivirus software and can cause issues with users.

Can I use ffmpeg-cpp from a C# project?

Yes, through a simplified interface library that supports only a subset of the full library. The README says it is made so it can be easily called using DllImport from any C# project, with an example showing DllImport declarations against simple_interface.dll and the Cdecl calling convention.

Is ffmpeg-cpp supported on Linux and macOS?

Not yet. The README states that currently only a Windows environment with Visual Studio is supported, because the author does not have experience with cmake and Linux projects, while noting the project itself is fully platform-independent and asking for help with cmake configuration.

What licence applies to ffmpeg-cpp and to FFmpeg itself?

The README says the library is licensed under the LGPL, and notes that FFmpeg, which you need to build the library, is either LGPL or GPL depending on how you build it. That second point determines the obligations of your own application.

Official sources

  1. Issues
  2. Raveler/ffmpeg-cpp on GitHub
  3. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/raveler-ffmpeg-cpp.svg)](https://hysenlabs.com/projects/raveler-ffmpeg-cpp)

Was this useful?