Skip to content

FFmpeg Development Environment

1.Introduction

Build a FFmpeg developing environment on Ubuntu-22.04-LTS with Qt and SDL.

2.Applications

3.Install

(0).Pre-Install

Update all repositories.

sudo apt update && apt upgrade

(1).Depedencies

Resolved in Ubuntu 22.04.2 LTS

On Video decoding/encoding with FFmpeg - x264 - libavcodec58 - libavcodec-extra58 - libavformat58 - libavformat-extra58 - libavutil56 - libc6 - libffms2-5 - libgpac11 - libswscale5 - libx264-163

  • x265

    • libc6
    • libstdc++6
    • libx265-199
    • libx265-199
  • libx264-dev

    • libx264-163
  • libx265-dev

    • libx265-199
  • libass-dev

    • libass9
    • libfontconfig1-dev
    • libfontconfig-dev
    • libfreetype-dev
    • libfribidi-dev
    • libharfbuzz-dev
  • libfdk-aac-dev

    • libfdk-aac2
    • pkg-config
    • pkg-config:i386
    • pkgconf
  • libfreetype-dev

    • libfreetype6
    • libbrotli-dev
    • libc6-dev
    • libc-dev
    • libc6-dev
    • zlib1g-dev
    • libz-dev
    • zlib1g-dev
  • libmp3lame-dev

    • libmp3lame0
  • libopus-dev

    • libopus0
  • libvorbis-dev

    • libogg-dev
    • libvorbis0a
    • libvorbisenc2
    • libvorbisfile3
  • libvpx-dev

    • libvpx7

On Audio decoding/encoding with SDL2: - libsdl2-dev - libasound2-dev - libdbus-1-dev - libdecor-0-dev - libdrm-dev - libegl1-mesa-dev - libgbm-dev - libgl-dev - libgles-dev - libglu1-mesa-dev - libibus-1.0-dev - libpulse-dev - libsdl2-2.0-0 - libsndio-dev - libudev-dev - libwayland-dev - libx11-dev - libxcursor-dev - libxext-dev - libxfixes-dev - libxi-dev - libxinerama-dev - libxkbcommon-dev - libxrandr-dev - libxss-dev - libxt-dev - libxv-dev - libxxf86vm-dev - libc6 - libopengl0 - libx11-6

On configuring FFmpeg: - yasm - libc6

Install all dependencies with following command:

sudo apt install yasm gcc g++ cmake make \
    x264 x265 libx264-dev libx265-dev \
    libass-dev libfdk-aac-dev libvorbis-dev \
    libfreetype-dev libmp3lame-dev libopus-dev \
     libvpx-dev libsdl2-dev

(2).Qt

Install Qt with Qt Online Installer.

It's better to install Qt with USTC's mirror.

Install with commands: .\qt-unified-windows-x86-online.exe --mirror https://mirrors.ustc.edu.cn/qtproject

DO NOT install Qt with sudo command nor with user ROOT.

If you prefer Qt Online Installer, libxcb-xinerama.so.0 is needed. To install this dependency, run following command sudo apt install libxcb-xinerama0.

It's possible to install Qt from source. Follow the instruction, and the script is available here.

(3).FFmpeg

Download FFmpeg from Offical Web Site, install with compile commands below:

wget http://ffmpeg.org/releases/ffmpeg-4.2.9.tar.xz
tar -xvf ffmpeg-4.2.9.tar.xz
cd ffmpeg-4.2.9
sudo ./configure --enable-gpl --enable-libass --enable-libfdk-aac \
    --enable-libfreetype --enable-libmp3lame --enable-libopus \
    --enable-libvorbis --enable-libvpx --enable-libx264 \
    --enable-libx265 --enable-pic --enable-shared  --enable-nonfree \
    --prefix=/usr/local/ffmpeg-4.2.9
make -j8
sudo make install

(4).SDL2

SDL2 has installed with system, headers installed when dependencies installed.

4.Environment Installing Script

One-key environment installing script is provided: - INSTALLENV.sh - install_denendency.sh - install_ffmpeg.sh - install_qt.sh

Qt Framework will be installed via local compile, and downloaded opensource from USTC Mirror.

Qt will be installed in path: /usr/local/qt-5.15.2

5.Config Qt Project

  • Add FFmpeg to INCLUDEPATH in .pro file.

    • Add dynamic link -lavfilter -lavformat -lavdevice -lavcodec -lpostproc -lswscale -lavutil -lswresample to LIBS in .pro file for FFmpeg;
  • Add -lSDL2main -lSDL2 for SDL.

REF

[1].https://qt.io

[2].http://mirrors.ustc.edu.cn/help/qtproject.html

[3].http://ffmpeg.org

[4].https://libsdl.org/

[5].https://blog.csdn.net/a1367666195/article/details/126055594

[6].https://askubuntu.com/questions/1298645/shared-library-not-found-for-pyqt5-libxcb-xinerama-so-0-not-found