FFmpeg 6.x compilation

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
t42
Level 11
Level 11
Posts: 3747
Joined: Mon Jan 20, 2014 6:48 pm

FFmpeg 6.x compilation

Post by t42 »

FFmpeg 6.1 was released several days ago with many changes.
If you need newer version instead of current ffmpeg 4.x from the repositories, you can compile it from source. Below you will find the guide to compilation of the latest release based on the official Compilation Guide with some errors corrected. Please note that you will find extended and updated guide in my comment below: viewtopic.php?p=2395392#p2395392
If you have ffmpeg installed from the distribution repository, you can leave it as is - new version will not interfere with the distribution package.

Code: Select all

#1. Get the Dependencies
sudo apt-get update -qq && sudo apt-get -y install autoconf automake build-essential cmake git libass-dev libfreetype6-dev libgnutls28-dev libmp3lame-dev libsdl2-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev meson ninja-build pkg-config texinfo wget yasm zlib1g-dev

Code: Select all

#2. directories to put all of the source code and binaries
mkdir -p ~/ffmpeg_sources ~/bin ~/ffmpeg_build

Code: Select all

#3. NASM
sudo apt-get install nasm 

Code: Select all

#4. libx264
cd ~/ffmpeg_sources && git -C x264 pull 2> /dev/null || git clone --depth 1 https://code.videolan.org/videolan/x264.git && cd x264 && PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --enable-pic && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install

Code: Select all

#5. libx265
sudo apt-get install libnuma-dev && cd ~/ffmpeg_sources && wget -O x265.tar.bz2 https://bitbucket.org/multicoreware/x265_git/get/master.tar.bz2 && tar xjvf x265.tar.bz2 && cd multicoreware*/build/linux && PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off ../../source && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install

Code: Select all

#6. libvpx
cd ~/ffmpeg_sources && git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && cd libvpx && PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install

Code: Select all

#7. libfdk-aac
cd ~/ffmpeg_sources && git -C fdk-aac pull 2> /dev/null || git clone --depth 1 https://github.com/mstorsjo/fdk-aac && cd fdk-aac && autoreconf -fiv && ./configure --prefix="$HOME/ffmpeg_build" --disable-shared && make -j$(nproc) && make -j$(nproc) install

Code: Select all

#8. libopus
cd ~/ffmpeg_sources && git -C opus pull 2> /dev/null || git clone --depth 1 https://github.com/xiph/opus.git && cd opus && ./autogen.sh && ./configure --prefix="$HOME/ffmpeg_build" --disable-shared && make -j$(nproc) && make -j$(nproc) install

Code: Select all

#9. libaom
cd ~/ffmpeg_sources && git -C aom pull 2> /dev/null || git clone --depth 1 https://aomedia.googlesource.com/aom && mkdir -p aom_build && cd aom_build && PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_TESTS=OFF -DENABLE_NASM=on ../aom && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install

Code: Select all

#10. libsvtav1
cd ~/ffmpeg_sources && git -C SVT-AV1 pull 2> /dev/null || git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git && mkdir -p SVT-AV1/build && cd SVT-AV1/build && PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install

Code: Select all

#11. libdav1d
cd ~/ffmpeg_sources && git -C dav1d pull 2> /dev/null || git clone --depth 1 https://code.videolan.org/videolan/dav1d.git && mkdir -p dav1d/build && cd dav1d/build && meson setup -Denable_tools=false -Denable_tests=false --default-library=static .. --prefix "$HOME/ffmpeg_build" --libdir="$HOME/ffmpeg_build/lib" && ninja -j$(nproc) && ninja -j$(nproc) install

Code: Select all

#12. libvmaf
cd ~/ffmpeg_sources && wget https://github.com/Netflix/vmaf/archive/v2.1.1.tar.gz && tar xvf v2.1.1.tar.gz && mkdir -p vmaf-2.1.1/libvmaf/build && cd vmaf-2.1.1/libvmaf/build && meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static .. --prefix "$HOME/ffmpeg_build" --bindir="$HOME/ffmpeg_build/bin" --libdir="$HOME/ffmpeg_build/lib" && ninja -j$(nproc) && ninja -j$(nproc) install

Code: Select all

#13. openssl
sudo apt install openssl libssl-dev

Code: Select all

#14. FFmpeg
cd ~/ffmpeg_sources && wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && tar xjvf ffmpeg-snapshot.tar.bz2 && cd ffmpeg && PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --pkg-config-flags="--static" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --extra-libs="-lpthread -lm" --ld="g++" --bindir="$HOME/bin" --enable-gpl --enable-openssl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install && hash -r
Make sure that /home/USER/bin is in your $PATH, then re-login or run
source ~/.profile

Local documentation is in ~/ffmpeg_build/share/doc/ffmpeg, online documentation is in FFmpeg Documentation If you want to add some libraries to the compilation refer to ~/ffmpeg_sources/ffmpeg/configure --help
Last edited by t42 on Wed Feb 07, 2024 8:25 pm, edited 5 times in total.
-=t42=-
User avatar
spamegg
Level 14
Level 14
Posts: 5118
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: FFmpeg 6.0 compilation

Post by spamegg »

Best to move this to the Tutorials subforum, otherwise this will get closed in 6 months and the useful information will be lost.
User avatar
SMG
Level 25
Level 25
Posts: 32007
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: FFmpeg 6.0 compilation

Post by SMG »

spamegg wrote: Sun Mar 05, 2023 4:02 pm Best to move this to the Tutorials subforum, otherwise this will get closed in 6 months and the useful information will be lost.
The only difference between a Tutorial and a topic in the Support forums is Tutorials can continue to be updated or receive new posts after six months. While locked topics can not be edited, all topics still exist even if they are locked. No information is "lost".

If OP wants their topic to be a tutorial, they can click the ! button, select the last option, and request it be moved.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
t42
Level 11
Level 11
Posts: 3747
Joined: Mon Jan 20, 2014 6:48 pm

Re: FFmpeg 6.0 compilation

Post by t42 »

Changed git-core to git in #1. Get the Dependencies
-=t42=-
t42
Level 11
Level 11
Posts: 3747
Joined: Mon Jan 20, 2014 6:48 pm

Re: FFmpeg 6.x compilation

Post by t42 »

FFmpeg 6.1 was released several days ago. Below is a compilation guide of the latest release in more extended configuration than in the first comment of this post. If you have ffmpeg installed from the distribution repository, you can leave it as is - new version will not interfere with the distribution package.

Code: Select all

#1. Get the Dependencies
sudo apt-get update -qq && sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libmp3lame-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
meson \
ninja-build \
pkg-config \
texinfo \
wget \
yasm \
zlib1g-dev	

Code: Select all

#2. directories to put all of the source code and binaries
mkdir -p ~/ffmpeg_sources ~/bin ~/ffmpeg_build

Code: Select all

#3. NASM
sudo apt-get install nasm 

Code: Select all

#4. libx264
cd ~/ffmpeg_sources && git -C x264 pull 2> /dev/null || git clone --depth 1 https://code.videolan.org/videolan/x264.git && cd x264 && PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --enable-pic && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install
#5 Compiling libx265 - H.265/HEVC video encoder
It is based on scjet45's findings and original input of Dan4t.
Before compiling open text editor and paste into it the code of new_multilib.sh, then save it to /home/user/new_multilib.sh

Code: Select all

nano ~/new_multilib.sh
Code of new_multilib.sh to paste into the file:

Code: Select all

#!/bin/sh
# new_multilib.sh
mkdir -p 8bit 10bit 12bit
cd 12bit
cmake ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON
make -j$(nproc)
cd ../10bit
cmake ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF
make -j$(nproc)
cd ../8bit
ln -sf ../10bit/libx265.a libx265_main10.a
ln -sf ../12bit/libx265.a libx265_main12.a
cmake ../../../source -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off
make -j$(nproc)
# rename the 8bit library and combine all three static libraries into libx265.a
mv libx265.a libx265_main.a
ar -M <<EOF
CREATE libx265.a
ADDLIB libx265_main.a
ADDLIB libx265_main10.a
ADDLIB libx265_main12.a
SAVE
END
EOF
make -j$(nproc) install

Code: Select all

#5. libx265
sudo apt-get install libnuma-dev && \
cd ~/ffmpeg_sources && \
git -C x265_git pull 2> /dev/null || git clone https://bitbucket.org/multicoreware/x265_git && \
cd ~/ffmpeg_sources/x265_git/build/linux && \
mv -v multilib.sh multilib.sh.orig && \
cp -vf ~/new_multilib.sh ~/ffmpeg_sources/x265_git/build/linux/multilib.sh && \
cd ~/ffmpeg_sources/x265_git/build/linux/ && \
chmod 775 multilib.sh && \
./multilib.sh

Code: Select all

#6. libvpx
cd ~/ffmpeg_sources && git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && cd libvpx && PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install

Code: Select all

#7. libfdk-aac
cd ~/ffmpeg_sources && git -C fdk-aac pull 2> /dev/null || git clone --depth 1 https://github.com/mstorsjo/fdk-aac && cd fdk-aac && autoreconf -fiv && ./configure --prefix="$HOME/ffmpeg_build" --disable-shared && make -j$(nproc) && make -j$(nproc) install

Code: Select all

#8. libopus
cd ~/ffmpeg_sources && git -C opus pull 2> /dev/null || git clone --depth 1 https://github.com/xiph/opus.git && cd opus && ./autogen.sh && ./configure --prefix="$HOME/ffmpeg_build" --disable-shared && make -j$(nproc) && make -j$(nproc) install

Code: Select all

#9. libaom
cd ~/ffmpeg_sources && git -C aom pull 2> /dev/null || git clone --depth 1 https://aomedia.googlesource.com/aom && mkdir -p aom_build && cd aom_build && PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_TESTS=OFF -DENABLE_NASM=on ../aom && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install

Code: Select all

#10. libsvtav1
cd ~/ffmpeg_sources && git -C SVT-AV1 pull 2> /dev/null || git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git && mkdir -p SVT-AV1/build && cd SVT-AV1/build && PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF .. && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install

Code: Select all

#11. libdav1d
cd ~/ffmpeg_sources && git -C dav1d pull 2> /dev/null || git clone --depth 1 https://code.videolan.org/videolan/dav1d.git && mkdir -p dav1d/build && cd dav1d/build && meson setup -Denable_tools=false -Denable_tests=false --default-library=static .. --prefix "$HOME/ffmpeg_build" --libdir="$HOME/ffmpeg_build/lib" && ninja -j$(nproc) && ninja -j$(nproc) install

Code: Select all

#12. libvmaf
cd ~/ffmpeg_sources && wget https://github.com/Netflix/vmaf/archive/v2.1.1.tar.gz && tar xvf v2.1.1.tar.gz && mkdir -p vmaf-2.1.1/libvmaf/build && cd vmaf-2.1.1/libvmaf/build && meson setup -Denable_tests=false -Denable_docs=false --buildtype=release --default-library=static .. --prefix "$HOME/ffmpeg_build" --bindir="$HOME/ffmpeg_build/bin" --libdir="$HOME/ffmpeg_build/lib" && ninja -j$(nproc) && ninja -j$(nproc) install

Code: Select all

#13. openssl
sudo apt install openssl libssl-dev

Code: Select all

#14. installing additional libraries
sudo apt install \
frei0r-plugins-dev \
libchromaprint-dev \
libgme-dev \
flite1-dev \
libcaca-dev \
libbs2b-dev \
libopenjp2-7-dev \
libopencore-amrnb-dev \
librubberband-dev \
libopenmpt-dev \
libshine-dev \
libsnappy-dev \
libsoxr-dev \
libspeex-dev \
libtheora-dev \
libtwolame-dev \
libv4l-dev \
libvidstab-dev \
libvo-amrwbenc-dev \
libxvidcore-dev \
liblzma-dev \
libbluray-dev \
libcdparanoia-dev \
libcdio-dev \
libcdio-paranoia-dev \
ladspa-sdk

Code: Select all

#15. getting FFmpeg
cd ~/ffmpeg_sources && wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && tar xjvf ffmpeg-snapshot.tar.bz2 && cd ffmpeg

Code: Select all

#16. correcting release and version
echo "6.1.git">RELEASE && cp VERSION VERSION.bak && echo -e "$(cat VERSION.bak) [$(date +%Y-%m-%d)] [$(cat RELEASE)] " > VERSION

Code: Select all

#17. compiling FFmpeg

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --pkg-config-flags="--static" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --extra-libs="-lpthread -lm" --ld="g++" --bindir="$HOME/bin" --enable-gpl --enable-openssl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-libopenjpeg --enable-libpulse --enable-chromaprint --enable-frei0r --enable-libbluray --enable-libbs2b --enable-libcdio --enable-librubberband --enable-libspeex --enable-libtheora --enable-libfontconfig --enable-libfribidi --enable-libxml2 --enable-libxvid --enable-version3 --enable-libvidstab --enable-libcaca --enable-libopenmpt --enable-libgme  --enable-opengl --enable-libsnappy --enable-libshine --enable-libtwolame --enable-libvo-amrwbenc --enable-libflite --enable-libsoxr --enable-ladspa && PATH="$HOME/bin:$PATH" make -j$(nproc) && make -j$(nproc) install && hash -r

Code: Select all

#18. Make sure that /home/USER/bin is in your $PATH, then re-login or run
source ~/.profile
Local documentation is in ~/ffmpeg_build/share/doc/ffmpeg, online documentation is in FFmpeg Documentation If you want to add some libraries to the compilation, please refer to ~/ffmpeg_sources/ffmpeg/configure --help
Last edited by t42 on Wed Feb 07, 2024 8:10 pm, edited 2 times in total.
-=t42=-
scjet45
Level 4
Level 4
Posts: 335
Joined: Sat May 07, 2016 12:50 am
Location: Canada

Re: FFmpeg 6.x compilation

Post by scjet45 »

First of all, thankyou @t42 for this ffmpeg compilation tutorial, it's very helpful. 👍️
I've had issues with "-map_metadata -1" not stripping all the metadata with my build, but with your build it now works fine.
However, I did have problems with libx265 10-bit encoding with your build:

Two examples encoding a video stream to libx265 (Main10) 10-bit using:
ffmpeg -i input.mkv -map 0:0 -map 0:1 -map 0:2 -c:v libx265 -pix_fmt yuv420p10le -c:a copy -c:s copy output.mkv
----------------------------------------------------------
Example 1./
With Your ffmpeg build: (#5. libx265)
ffmpeg -h encoder=libx265
"Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p gbrp gray"
"Error when trying to encode a video stream to libx265 (Main10) 10bit stream:"
"Incompatible pixel format 'yuv420p10le' for codec 'libx265', auto-selecting format 'yuv420p'"

Example 2./
With My ffmpeg build: (see below)
ffmpeg -h encoder=libx265
"Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p gbrp yuv420p10le yuv422p10le yuv444p10le gbrp10le yuv420p12le yuv422p12le yuv444p12le gbrp12le gray gray10le gray12le"
It encoded to 10-bit fine.
-------------------------------------------------------------

So, using your viewtopic.php?p=2395392&sid=e0eb688dd36 ... a#p2395392 build, I successfully did all your other steps, except for "#5. libx265".
When I got to that step I simply modified that with:

Code: Select all

sudo apt-get install libnuma-dev && \
cd ~/ffmpeg_sources && \
git -C x265_git pull 2> /dev/null || git clone https://bitbucket.org/multicoreware/x265_git && \
cd ~/ffmpeg_sources/x265_git/build/linux && \
mv -v multilib.sh multilib.sh.orig && \
cp -vf ~/new_multilib.sh ~/ffmpeg_sources/x265_git/build/linux/multilib.sh && \
cd ~/ffmpeg_sources/x265_git/build/linux/ && \
chmod 775 multilib.sh && \
./multilib.sh
Where ~/new_multilib.sh is:

Code: Select all

#!/bin/sh

mkdir -p 8bit 10bit 12bit

cd 12bit
cmake ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON
make -j$(nproc)

cd ../10bit
cmake ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF
make -j$(nproc)

cd ../8bit
ln -sf ../10bit/libx265.a libx265_main10.a
ln -sf ../12bit/libx265.a libx265_main12.a
cmake ../../../source -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off
make -j$(nproc)

# rename the 8bit library, then combine all three into libx265.a
mv libx265.a libx265_main.a

# On Linux, we use GNU ar to combine the static libraries together
ar -M <<EOF
CREATE libx265.a
ADDLIB libx265_main.a
ADDLIB libx265_main10.a
ADDLIB libx265_main12.a
SAVE
END
EOF

pwd

make install
Personally, I would like nothing better than to see AV1-(an open source and royalty-free video codec) keep taking the lead over a patent/license encumbered non-free h265/hevc, and "libsvtav1" is doing just that, and getting better and faster.
Cheers. :)
Last edited by scjet45 on Tue Jan 23, 2024 8:55 am, edited 1 time in total.
MATE 21.3 | Lenovo Legion 5 17ACH6
t42
Level 11
Level 11
Posts: 3747
Joined: Mon Jan 20, 2014 6:48 pm

Re: FFmpeg 6.x compilation

Post by t42 »

scjet45 wrote: Mon Jan 22, 2024 10:57 am I successfully did all your other steps, except for "#5. libx265".
Excellent findings, @scjet45. After this modification I've got as well yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p gbrp yuv420p10le yuv422p10le yuv444p10le gbrp10le yuv420p12le yuv422p12le yuv444p12le gbrp12le gray gray10le gray12le pixel formats and encoding works as expected.

For those who want to compile libx265 in such a way, please do not forget to change the line in code cd /home/duh/ffmpeg_sources/x265_git/build/linux/ && \ to cd ~/ffmpeg_sources/x265_git/build/linux/ && \
-=t42=-
scjet45
Level 4
Level 4
Posts: 335
Joined: Sat May 07, 2016 12:50 am
Location: Canada

Re: FFmpeg 6.x compilation

Post by scjet45 »

t42 wrote: Mon Jan 22, 2024 6:26 pm
scjet45 wrote: Mon Jan 22, 2024 10:57 am I successfully did all your other steps, except for "#5. libx265".
For those who want to compile libx265 in such a way, please do not forget to change the line in code cd /home/duh/ffmpeg_sources/x265_git/build/linux/ && \ to cd ~/ffmpeg_sources/x265_git/build/linux/ && \
Thanks, nice catch, I've since fixed it.

The main difference between ~/new_multilib.sh and (the original)~/ffmpeg_sources/x265_git/build/linux/multilib.sh is:
1./ On the "cmake .." line #16, I added the -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off switches,
(so later, when building ffmpeg it'll find what it needs for libx265 in ~/ffmpeg_build/...).
2./ (optionally) I removed the "# Mac/BSD libtool" stuff from the "if then else" loop, although you could just leave that in.

- Alternatively, in "1./" above, it may be less awkward to just modify bitbucket's (x265_git) original multilib.sh file directly with a quck n' dirty sed:

Code: Select all

sed -i '16s/$/ -DCMAKE_INSTALL_PREFIX="$HOME\/ffmpeg_build" -DENABLE_SHARED:bool=off/' ~/ffmpeg_sources/x265_git/build/linux/multilib.sh
...then just continue with "./multilib.sh" ...
(But obviously if the x265_git devs modify their "multilib.sh" file in the future then line #16 may become invalid. (a better line search n' add would be required).
Any scripters out there that can help make this less awkward are welcome to chime in. ;)

(As a sidenote and for the sake of brevity, I found those x265 "multilib" build tips from an old post on reddit: https://www.reddit.com/r/ffmpeg/comment ... ilib_x265/
So thanks also goes to "Dan4t" for that.)

Additionally, you might want to include the nscd package as an ffmpeg dependency: "A limitation of statically linking glibc is the loss of DNS resolution. Installing nscd through your package manager will fix this." -excerpt from https://johnvansickle.com/ffmpeg/release-readme.txt
"nscd is relevant if using ffmpeg to relay to an RTMP server via domain name." -excerpt from https://webinstall.dev/ffmpeg/

Anyway, feel free to modify "#5. libx265" of your nice and compact tutorial if you want, as you see fit, so as to keep your main "FFmpeg 6.x compilation" post a one stop shop.

ok, sorry for rambling on, but again, thanx for the compilation tutorial and keeping it up-to-date with the latest (extended) 6.1.* release compilations. Keep it up. :D
Last edited by scjet45 on Tue Apr 02, 2024 12:23 pm, edited 1 time in total.
MATE 21.3 | Lenovo Legion 5 17ACH6
t42
Level 11
Level 11
Posts: 3747
Joined: Mon Jan 20, 2014 6:48 pm

Re: FFmpeg 6.x compilation

Post by t42 »

Updated FFmpeg compilation guide is located here . Thanks to scjet45's findings it now has support for x265 10 and 12 bit encoding. Compilation is always based on the latest ffmpeg snapshot.
-=t42=-
User avatar
MikeNovember
Level 7
Level 7
Posts: 1856
Joined: Fri Feb 28, 2020 7:37 am
Location: Nice, Paris, France

Re: FFmpeg 6.x compilation

Post by MikeNovember »

Hi,

For users of Linux Mint 21.x, based on Ubuntu Jammy, FFmpeg 6.1 is available from this PPA:https://launchpad.net/~ubuntuhandbook1/ ... tu/ffmpeg6
...without the need to compile anything.

Read this page 1st, https://ubuntuhandbook.org/index.php/20 ... untu-2204/

Regards,

MN
_____________________________
Linux Mint 21.3 Mate host with Ubuntu Pro enabled, VMware Workstation Player with Windows 10 Pro guest, ASUS G74SX (i7-2670QM, 16 GB RAM, GTX560M with 3GB RAM, 1TB SSD).
scjet45
Level 4
Level 4
Posts: 335
Joined: Sat May 07, 2016 12:50 am
Location: Canada

Re: FFmpeg 6.x compilation

Post by scjet45 »

MikeNovember wrote: Tue Feb 13, 2024 12:39 pm Hi,

For users of Linux Mint 21.x, based on Ubuntu Jammy, FFmpeg 6.1 is available from this PPA:https://launchpad.net/~ubuntuhandbook1/ ... tu/ffmpeg6
...without the need to compile anything.
...
I've seen a lot of ffmpeg PPA's come n' go over the years, mostly due to lack of consistent maintenance. I'm not a big fan of 3rd-party PPAs. They can be messy, and can cause problems by interfering with the package management system(s), upgrades, updates, security, ..., as the comment section of that PPA shows.

Hence why this tutorial is exactly where it belongs.

Also, with ffmpeg compilations, they will not interfere with any system files or other packages. Just throw your compiled ffmpeg into your favorite path, such as "$HOME/bin/", ..., and you can have both the convenience of the system/distro-supplied ffmpeg, AND, your compiled version, without the need for a PPA. To uninstall your compiled ffmpeg version, simply delete the ffmpeg file from your path.
And/Or,
simply download an already compiled ffmpeg from https://johnvansickle.com/ffmpeg/ , and place that in your favorite path, -(everything included, and that's what it's there for, except for libfdk_aac). :( )

That said, certain niche app PPAs that are consistently maintained and kept safely uptodate can be a great mainstay for specific app needs, but we'll see if this one stands the test of time, somewhat.?
MATE 21.3 | Lenovo Legion 5 17ACH6
User avatar
MikeNovember
Level 7
Level 7
Posts: 1856
Joined: Fri Feb 28, 2020 7:37 am
Location: Nice, Paris, France

Re: FFmpeg 6.x compilation

Post by MikeNovember »

Hi,

J Im, aka Panda Jim, is the maintainer of several PPAs, and has a blog dedicated to Linux and Ubuntu. He has a very good reputation.

Of course, I understand that you prefer to compile from source.

[I would add that, for people just needing ffmpeg6 executable, a statically compiled binary (including all its dependencies) is available from ffmpeg website. Once installed, you just have the ffmpeg6 executable, not all the libraries that you would have when compiling from source or installing from a PPA.] OK, same as the link you gave.

Regards,

MN
Last edited by MikeNovember on Wed Mar 06, 2024 11:45 am, edited 1 time in total.
_____________________________
Linux Mint 21.3 Mate host with Ubuntu Pro enabled, VMware Workstation Player with Windows 10 Pro guest, ASUS G74SX (i7-2670QM, 16 GB RAM, GTX560M with 3GB RAM, 1TB SSD).
t42
Level 11
Level 11
Posts: 3747
Joined: Mon Jan 20, 2014 6:48 pm

Re: FFmpeg 6.x compilation

Post by t42 »

scjet45 wrote: Tue Mar 05, 2024 1:16 pm I've seen a lot of ffmpeg PPA's come n' go over the years, mostly due to lack of consistent maintenance.
That's true, ppas come and go often leaving it's users without warning on their own. This particular ppa already done that for its Ubuntu 20.4 incarnation, when owner stop updated it and for some reason many users had botched sound. When asked for help the owner replied that he knows nothing about ffmpeg and it outside of his competence. But now we have again his 22.04+ ffmpeg ppa.
-=t42=-
t42
Level 11
Level 11
Posts: 3747
Joined: Mon Jan 20, 2014 6:48 pm

Re: FFmpeg 6.x compilation

Post by t42 »

MikeNovember wrote: Wed Mar 06, 2024 4:11 am MikeNovember » 06 Mar 2024 09:11

J Im, aka Panda Jim, is the maintainer of several PPAs
It seems you don't understand that it is the tutorial section of the Forum and there is no need to discuss anything not related to the ffmpeg compilation per se. If you don't have anything constrictive about particular compilation process please stop pollute the topic.
-=t42=-
scjet45
Level 4
Level 4
Posts: 335
Joined: Sat May 07, 2016 12:50 am
Location: Canada

Re: FFmpeg 6.x compilation

Post by scjet45 »

@t42 Regarding your Step #16 below:

Code: Select all

#16. correcting release and version
echo "6.1.git">RELEASE && cp VERSION VERSION.bak && echo -e "$(cat VERSION.bak) [$(date +%Y-%m-%d)] [$(cat RELEASE)] " > VERSION
Question:

I noiced that the newest
https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
has a "RELEASE" version of "5.1.git" , with a date of 2024-04-01 (for example),

whereas,

https://ffmpeg.org/releases/ffmpeg-6.1.1.tar.bz2
has a "RELEASE" version of "6.1.1.git", with an older date of 2023-12-31.

The ffmpeg-snapshot's obviously seem to be their newest releases, but, is there a reason why the ffmpeg devs would name their latest snapshot with an old "RELEASE" name of "5.1.git" instead of "6.1.*.git". ?
sorry, but I'm just curious why we would have to modify the "RELEASE" and "VERSION" files on newest (daily) ffmpeg-snapshot's, and thanks ahead for any explanation.
MATE 21.3 | Lenovo Legion 5 17ACH6
t42
Level 11
Level 11
Posts: 3747
Joined: Mon Jan 20, 2014 6:48 pm

Re: FFmpeg 6.x compilation

Post by t42 »

scjet45 wrote: Tue Apr 02, 2024 10:33 am The ffmpeg-snapshot's obviously seem to be their newest releases, but, is there a reason why the ffmpeg devs would name their latest snapshot with an old "RELEASE" name of "5.1.git" instead of "6.1.*.git".
Obviously they just forgot to change the version number. We should move on from 6.1 to next at some point but we can forget to do this as well :)
-=t42=-
scjet45
Level 4
Level 4
Posts: 335
Joined: Sat May 07, 2016 12:50 am
Location: Canada

Re: FFmpeg 6.x compilation

Post by scjet45 »

t42 wrote: Tue Apr 02, 2024 12:30 pm
scjet45 wrote: Tue Apr 02, 2024 10:33 am The ffmpeg-snapshot's obviously seem to be their newest releases, but, is there a reason why the ffmpeg devs would name their latest snapshot with an old "RELEASE" name of "5.1.git" instead of "6.1.*.git".
Obviously they just forgot to change the version number. We should move on from 6.1 to next at some point but we can forget to do this as well :)
ok yep, I forgot, some devs prefer that we should be able to read their minds. ;)
MATE 21.3 | Lenovo Legion 5 17ACH6
scjet45
Level 4
Level 4
Posts: 335
Joined: Sat May 07, 2016 12:50 am
Location: Canada

Re: FFmpeg 6.x compilation

Post by scjet45 »

Good news, FFmpeg 7.0 released:
https://www.phoronix.com/news/FFmpeg-7.0-Released
;)
MATE 21.3 | Lenovo Legion 5 17ACH6
t42
Level 11
Level 11
Posts: 3747
Joined: Mon Jan 20, 2014 6:48 pm

Re: FFmpeg 6.x compilation

Post by t42 »

First I will wait till Tumbleweed get it, they are still on 6.1.1.
-=t42=-
Post Reply

Return to “Tutorials”