Giter Club home page Giter Club logo

ffmpegexamples's Introduction

FFmpegExamples

Here are the official examples of FFmpeg that are rearranged into the individual CMake modules. The main goal is seamless importing of them into CLion IDE and other IDEs that support CMake. Building in terminal is also possible.

What exact examples are here?

All examples of FFmpeg 4.3.1 are integrated. However, a lower version of FFmpeg can be used to compile the examples. The original sources can be found here.

What OS are supported?

On Linux and macOS the project can be integrated into an IDE or used in terminal.

Windows wasn't tested, but the command line building should work in Linux subsystem installed using WSL.

Requirements

First of all you need to install cmake, make, both C and C++ compilers (gcc, g++ or clang will do). By default all examples are compiled using C99 standard, but using C++ is also available.

On macOS:

brew install cmake make llvm

On Ubuntu:

sudo apt-get install cmake make gcc g++

You also need all FFmpeg's shared libraries with their header files.

On macOS:

brew install ffmpeg

On Ubuntu:

sudo apt-get install ffmpeg libavutil-dev libavcodec-dev libavformat-dev libavfilter-dev libpostproc-dev libswscale-dev libswresample-dev

Different versions of Ubuntu will install different version of these packages. Specifically:

  • Ubuntu 16.05 - FFmpeg 2.8.x
  • Ubuntu 18.04 - FFmpeg 3.4.x
  • Ubuntu 20.04 - FFmpeg 4.2.x (currently)

Here are implications of using different version of FFmpeg:

  • FFmpeg 4.0 and above - all examples are compilable
  • FFmpeg 3.4 - hw_decode and transcode_aac aren't compilable, but the rest is
  • FFmpeg 3.3.x and 2.8.x aren't tested and are out of the focus

Certain examples require additional packages to be installed (see below).

How to import the project into CLion IDE?

This is pretty simple:

  • Make 'Open' or 'Open or Import' action
  • Select the root CMakeLists.txt of this project
  • Select 'Open as Project'

Now the project should be imported into CLion. You can easily switch between targets (examples) to build and execute. Beware that all examples require certain arguments like paths to media files or else. So just executing an example will not do any valuable job. You can customize build targets to pass these arguments. For that you need to specify Program arguments in a respective Run Configuration. See this link for more info. Also for simplicity you can hardcode such parameters inside the examples' source code.

How to build examples in terminal?

CMake doesn't support building inside the source code directory, so it is necessary to create a separate directory for that. From inside the root of this project execute the following commands:

mkdir build
cd build
cmake ..

That will prepare a directory that is capable of compiling the sources. From now you can build all example at once using one of the following commands from inside that build directory:

cmake --build .

or

make

If you wish to build only a specific target use one of the following commands (with necessary example name):

cmake --build . --target avio_reading

or

make avio_reading

After the compilation each example will be located at ${PROJECT_PATH}/build/examples/${EXAMPLE_NAME}/${EXAMPLE_NAME}. The first ${EXAMPLE_NAME} is a directory and the second one is a binary file name.

Notes about certain examples

qsvdec

The Intel Quick Sync Video (QSV) example will work if these conditions are met:

  • building happens NOT on macOS
  • the libmfx-dev package is installed (available on Ubuntu 19.10+)
  • there is a custom ffmpeg built with --enable-libmfx and installed

vaapi_encode and vaapi_transcode

The Video Acceleration API (VAAPI) examples will work if these conditions are met:

  • the libva-dev package is installed
  • there is a custom ffmpeg built with --enable-vaapi and installed

ffmpegexamples's People

Contributors

javernaut avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.