How to add example to ffmpeg project - dalmatele/ffmpeg-libav-tutorial GitHub Wiki

If you want to this example with FFmpeg directly you can follow this tutorial.

Step 1:

You need to clone FFmpeg project to your machine.

Step 2:

In FFmpeg project, you can file doc/examples directory.

Let's put your code to this folder.

Step 3:Modify FFmpeg config.

For example, you have an example with name hello_world.c

In configure file, you should add this line in example block:

hello_world_example_deps = "avformat" --> this will help load needed libraries for your example.

and add this to EXAMPLE_LIST

hello_world_example

In doc/example/Makefile, you must add:

EXAMPLES-${CONFIG_HELLO_WORLD_EXAMPLE} += hello_world

In doc/example/Makefile.example, you must add to EXAMPLE this line:

hello_world \

Step 4: Build your example

In the FFmpeg's root directory, you must run:

./configure

You can add some optionals for your need in this command.

With MacOS > 10.15, you must run:

/configure --extra-cflags="-fno-stack-check"

This is an example how to build it on Macos 10.15:

./configure --extra-cflags="-fno-stack-check" --enable-gpl --enable-libx264 --enable-libvpx --enable-libmp3lame

And build your example by this command:

make examples

You can clean your example by this command:

make examplesclean