Build and install specified FFmpeg on the Ubuntu
Update Ubuntu FFmpeg to the specified version:
1. Enter root user
sudo -s
2. Connect the internet
Connect the network cable and make sure the network is unobstructed.
If no IP, please run dhclient -i eth0
.
3. Check the internet:
4. Setting up the compile environment:
apt update
apt install -y build-essential meson ninja-build python3-pip bison libglib2.0-dev flex libx264-dev
pip3 install --upgrade meson
5. Install extern packages:
apt install -y libopus-dev libasound2-dev libopenh264-dev libx264-dev libjpeg-dev
apt install -y libmp3lame-dev libv4l-dev libsdl2-dev
6. Build and install FFmpeg:
Get the FFmpeg source and build(Take version 4.4.2 for example):
The configuration file will turn on the corresponding function automatically based on the packages already installed on the system, and the target file will be installed in the directory specified by the option --prefix:
7. Check
8. Test:
9. Hardware video codec support
The C3V platform has hardware video codecs and provides a V4L2 interface. It currently supports FFmpeg 4.4.2, 4.4.4, and 6.1.1:
For Ubuntu 20.04 and Ubuntu 22.04, we recommend using version 4.4.4, which is the same as the version that buildroot 24 used default. It’s newer than the default versions of Ubuntu 20.04 and Ubuntu 22.04. And its patch can be found in the path: <C3V_code>/linux/rootfs/initramfs/buildroot/package/ffmpeg.
For Ubuntu 24.04, we recommend using version 6.1.1, which is the same as the version of Ubuntu 24.04 used default.
Since version 4.4.2 and 4.4.4 patch contents are almost identical, you can just use the same.
It is generally recommended that the version you built should be greater than or equal to the version that apt installed. Otherwise, when you apt install other packages(such as OpenCV) that depend on FFmpeg, the system will update the FFmepg automatically, it will overwrite your build, thus affecting the functionality of the video codec.
Reference
Compile and install FFmpeg 4.4.4 for C3V codec in the C3V Ubuntu environment