Skip to main content
Version: Next

Installation for Linux

This guide contains steps for installing or compiling the mpegCoder module manually. We recommend users who need to use mpegCoder in a project locally to install the package by this way.

Install the pre-compiled module

Download mpegCoder

First, users need to download the single module. We provide the downloading links in the following table. Please check the correct version according to your environment.

mpegCoderFFMpegNumpyPythonGCC/G++OS
3.2.05.01.22.33.10.410.2.1Debian 11
3.2.05.01.22.33.9.1210.2.1Debian 11
3.2.05.01.22.33.8.1310.2.1Debian 11
3.2.05.01.21.53.7.1310.2.1Debian 11
3.2.05.01.19.53.6.1510.2.1Debian 11

After extracting the tarball, we could get mpegCoder.so.

info

Note that the above versions only show the environment when building mpegCoder. It does not mean that they are the dependencies of running mpegCoder. For example, users could use python 3.9.5 and numpy 1.22.0 to run mpegCoder.

Install Numpy

To run mpegCoder, you are required to install Numpy with the correct version first. The best version for each mpegCoder release has been listed before. If your Numpy version is differnt from the best version too much, mpegCoder may not work. Here is the command for installation.

python -m pip install numpy==<version>

Download dependencies

The pre-compiled dependencies are available on our release page. The dependencies contain several .so files. Users also need to download the tarball with the correct FFMpeg version, and extract the files.

FFMpegGCC/G++OS
5.010.2.1Debian 11

These files are compiled by myself, because FFMpeg has not released the fully built shared libraries for Linux. To learn how to compile the FFMpeg, please check the compilation section.

Import

Running the pre-compiled mpegCoder requires users to add the required dynamic libraries to your library path. The extracted dependency files should contain two folders:

.
|---lib
`---lib-fix

We recommend users to place the two folders in a global domain, for example,

/opt/ffmpeg/
|---lib
`---lib-fix

After that, users could add the following lines to your ~/.bashrc

export LD_LIBRARY_PATH=/opt/ffmpeg/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_LIBDIR=/opt/ffmpeg/lib/:$PKG_CONFIG_LIBDIR

To make the configurations take effects instantly, please run

source ~/.bashrc

Running the module requires users to install glibc>=2.29. Please check the following table and find whether the requirements are fulfilled in your case:

OSGLibCFulfilled
Ubuntu bionic (18.04)2.27
Ubuntu focal (20.04)2.31
Debian buster (10)2.28
Debian bullseye (11)2.31

If the glibc>=2.29 is not provided by your OS, we recommend users to compile and install GLibC by themselves. However, if users want a faster hotfix. Please check the extracted dependencies.

Take the above steps as an example, then users could link the provided GLibC to your /lib folder.

ln -sf /opt/ffmpeg/lib-fix/libm-2.31.so /lib/x86_64-linux-gnu/libm.so.6

After all, users could place mpegCoder.so in your project folder, and import the module by

import mpegCoder

Compile the module

Compile mpegCoder

If users need to compile the module by themselves, please follow the instructions on Github:

Compile with GCC/G++

Compile FFMpeg

info

Users are not required for compiling FFMpeg by themselves, because mpegCoder could be compiled with our provided pre-compiled FFMpeg. But in some cases, user may need to built mpegCoder with a specified FFMpeg version.

If users are using their own FFMpeg to compile mpegCoder, please check the configuration in the setup file and the macros in the source codes.

We have provided some scripts for compiling FFMpeg. Please check the following branch:

Scripts for compilation

For example, if users want to compile FFMpeg 5.0, they could run

curl -O https://raw.githubusercontent.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/deps/install-ffmpeg-5_0.sh
chmod +rwx install-ffmpeg-5_0.sh
./install-ffmpeg-5_0.sh --all --nvcuda
info

Note that users may need to modify the scripts according to their own cases. Our script has been only and successfully tested on Ubuntu 22.04+GCC 11.2.0 and Debian 11+GCC 10.2.1.