-
Notifications
You must be signed in to change notification settings - Fork 99
Integration in FFmpeg
The VVC decoder in FFmpeg is almost feature complete and is still being optimized.
As VVdeC is still faster and realtime capable this section describes how VVdeC can be added to FFmpeg.
-
To build FFmpeg the general compilation guide is needed:
https://trac.ffmpeg.org/wiki/CompilationGuide -
To patch FFmpeg for VVdeC support follow the guide depending on your operating system.
The following procedure to patch FFmpeg with VVdeC support is tested with FFmpeg revision 41190da9e1 (June 22th 2024).
- Build and install VVdeC where it can be found by pkg-config
- Build VVdeC shared and install into a system path, e.g.:
make release-shared install-prefix=/usr/local
sudo make install
- Clone FFmpeg and go into the downloaded folder
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
- Checkout the master
- Download the libvvdec patch.
(Attention: the latest official libvvdec patchset from FFmpeg patchwork can not be applied anymore since the fileconfigure
changed in the ffmpeg master. The new provided patch is aligned to the current ffmpeg master):
wget -O libvvdec.patch https://raw.githubusercontent.com/wiki/fraunhoferhhi/vvdec/data/patch/v6-0001-avcodec-add-external-dec-libvvdec-for-H266-VVC.patch
- Patch with the latest VVdeC Patch from the FFmpeg patchwork
patch -p 1 < libvvdec.patch
- Configure and build FFmpeg
- add '--enable-libvvdec' in the configure step to enable VVdeC as VVC decoder. For instance:
./configure --enable-pthreads --enable-pic --enable-shared --enable-rpath --arch=amd64 --enable-demuxer=dash --enable-libxml2 --enable-libvvdec
- Add more options to your configure command to enable all needed tools and codecs (e.g.
--enable-libvvenc
) -
make
(usemake -j
to compile multi-threaded)
- Install ffmpeg (optional step)
sudo make install
- Check if FFmpeg supports VVC
ffmpeg -hide_banner -codecs | grep vvc
DEV.L. vvc H.266 / VVC (Versatile Video Coding) (decoders: libvvdec ) (encoders: libvvenc )
In case you want to revert all changes the master can be cleaned up to origin/master by using:
git reset --hard
git clean -df
In general you can follow the guidelines for Linux when build on MacOS.
VVdeC is also available in Homebrew.
If you want to skip the build process it can be installed by calling:
brew install vvdec
When building on an ARM platform please follow this guide:
When running on an ARM device you have to build and install VVdeC and FFmpeg for ARM
To build VVdeC on ARM ninja build must be used to build, as with XCode generated libraries are not working.
It can be installed by using Homebrew: brew install ninja
- Build and install VVdeC:
sudo make g=ninja install install-prefix=/usr/local
Alternatively install via Homebrew:brew install vvdec
- configure and build FFmpeg:
- VVenC and VVdeC support:
./configure --enable-pthreads --enable-pic --enable-shared --enable-rpath --arch=arm64 --enable-demuxer=dash --enable-libxml2 --enable-libvvenc --enable-libvvdec
- VVdeC support:
./configure --enable-pthreads --enable-pic --enable-shared --enable-rpath --arch=arm64 --enable-demuxer=dash --enable-libxml2 --enable-libvvdec
As building FFmpeg for Windows can be tricky, we recommend the Media Autobuild Suite (m-ab-s).
VVdeC (as well as VVenC) is already part of the suite and must be enabled during the script setup to get VVC support in FFmpeg.
To add VVdeC into FFmpeg a libvvdec patch is provided, that is based on the latest official libvvdec patchset from Thomas Siedel/Christian Bartnik, since the official patch cannot be applied to the FFmpeg master anymore.
This patch already has been integrated into the the m-ab-s suite which means as soon as VVdeC is enabled in the options, it will be build automatically and added into FFmpeg.
Follow the guide given in the Media Autobuild Suite to build FFmpeg.
- Clone the media-autobuild_suite from the command line
git clone https://github.com/m-ab-s/media-autobuild_suite
- Open the Windows PowerShell, go into cloned directory and start the suite:
cd media-autobuild_suite
media-autobuild_suite.bat
- Follow the instructions given by the script and enable VVdeC when asked
FFmpeg may fail to build as the Media Autobuild Suite is kind of a moving target.
That means FFmpeg is depending on a bunch of core applications and codecs which are build from the current master branch per default.
As a depending repository may fail to build or is not compatible with the ffmpeg version this section will show solutions or workarounds on known issues.
- error during ffmpeg configure step:
ERROR: libjxl >= 0.7.0 not found using pkg-config
- workaround: disable libjxl in file
build/media-autobuild_suite.ini
jpegxl=2
and in filebuild/ffmpeg_options.txt
by comment line
#--enable-libjxl
- workaround: disable libavif in file
build/media-autobuild_suite.ini
libavif=2
- error during ffmpeg build step:
/build/ffmpeg-git/doc/t2h.pm: Undefined subroutine &Texinfo::Config::set_from_init_file ...
- workaround: disable html generation in file
build/ffmpeg_options.txt
by adding
--disable-doc
- workaround: disable in file
build/ffmpeg_options.txt
by comment line
#--enable-libplacebo
or set
--disable-libplacebo
If a dependent library has changed the interface and is not compatible with ffmpeg anymore a particular revision can be set in the file
build/media-suite_deps.sh
, e.g. for mpv player
SOURCE_REPO_MPV=https://github.com/mpv-player/mpv.git#tag=v0.36.0
The particular FFmpeg revision can also be set in the file build/media-autobuild_suite.ini
, e.g.
ffmpegPath=https://git.ffmpeg.org/ffmpeg.git#1b41631185
ffmpeg -hide_banner -codecs | grep vvc
DEV.L. vvc H.266 / VVC (Versatile Video Coding) (decoders: libvvdec ) (encoders: libvvenc )
Run FFmpeg help to see available options for decoder:
ffmpeg -h decoder=libvvdec
Decoder libvvdec [H.266 / VVC Decoder VVdeC]:
General capabilities: delay threads
Threading capabilities: other
Supported pixel formats: gray gray10le yuv420p yuv422p yuv444p yuv420p10le yuv422p10le yuv444p10le
Per default the FFmpeg VVC decoder is used. To run VVdeC it must be specified:
ffmpeg -c:v libvvdec -i input.mp4 output.yuv
ffmpeg -c:v libvvdec -i input.mp4 -strict -1 output.y4m
ffmpeg -i input.mp4 -an -vcodec copy -bsf vvc_mp4toannexb output.266
ffmpeg -c:v libvvdec -benchmark -i input.mp4 -f null NULL
ffplay is part of ffmpeg and can be used to playback VVC streams.
Following file formats are supported and can be played with ffplay:
- RAW elementary streams (.266, .vvc)
- ISO base media file format (.mp4, .mpd)
- MPEG transport streams (.ts)
Per default the FFmpeg VVC decoder is used.
To use VVdeC it must be specified in the ffplay call:
ffplay -codec:v:1 libvvdec input
ffplay input
To use VVdeC use:
ffplay -codec:v:1 libvvdec input
To playback a specific video track the option -vst v:id
can be used. e.g.:
ffplay -codec:v:1 libvvdec dashfile.mpd -vst v:2
To toggle between different tracks during playback use v
A variety of transport streams and dash streams according to the DVB specification can be found at:
https://dvb.org/specifications/verification-validation/vvc-test-content/
All test bitstreams from JVET can be found at:
https://www.itu.int/wftp3/av-arch/jvet-site/bitstream_exchange/VVC/draft_conformance/draft6/
The used libvvdec patchset is an community submitted patch and not merged into the master nor checked by the developer team.