Clear Fraction, the third-party repository for Clear Linux

Hi @paulcarroty,

I like very much to archive/deprecate the ffmpeg-on-clear-linux project. Unfortunately, the ffmpeg binary in Clear Fraction lacks nvdec (cuda) support.

Basically, it requires one tiny dependency to be able to pass the --enable-nvdec option to the ffmpeg configure script. The great news is that one can build ffmpeg with nvdec support without NVIDIA driver / CUDA Toolkit.

Dependency needed / package name: nv-codec-headers

nvver="11.1.5.1"
url="https://github.com/FFmpeg/nv-codec-headers/releases/download/n${nvver}/nv-codec-headers-${nvver}.tar.gz"
curl -LO ${url}
cd nv-codec-headers-${nvver}
# build
make PREFIX=/usr LIBDIR=lib64
# install
make PREFIX=/usr LIBDIR=lib64 install

Add option to ffmpeg configure.

--enable-nvdec

Before - Clear Fraction without nvdec support

Enabled hwaccels: (from ./configure output)
av1_vaapi               mpeg1_xvmc              vp8_vaapi
h263_vaapi              mpeg2_vaapi             vp9_vaapi
h264_vaapi              mpeg2_xvmc              wmv3_vaapi
hevc_vaapi              mpeg4_vaapi
mjpeg_vaapi             vc1_vaapi

Hardware acceleration methods: (from ffmpeg -hwaccels)
vaapi
qsv
drm
vulkan

After - Clear Fraction with nvdec support

Enabled hwaccels: (from ./configure output)
av1_nvdec               mjpeg_vaapi             vc1_nvdec
av1_vaapi               mpeg1_nvdec             vc1_vaapi
h263_vaapi              mpeg1_xvmc              vp8_nvdec
h264_nvdec              mpeg2_nvdec             vp8_vaapi
h264_vaapi              mpeg2_vaapi             vp9_nvdec
hevc_nvdec              mpeg2_xvmc              vp9_vaapi
hevc_vaapi              mpeg4_nvdec             wmv3_nvdec
mjpeg_nvdec             mpeg4_vaapi             wmv3_vaapi

Hardware acceleration methods: (from ffmpeg -hwaccels)
cuda
vaapi
qsv
drm
vulkan

Currently (using Clear Fraction’s FFmpeg), folks using NVIDIA graphics can decode using VA-API.

ffmpeg -y -hwaccel vaapi -c:v vp9 -i input_vp9.webm -f null -
ffmpeg -y -hwaccel vaapi -c:v av1 -i input_av1.mp4 -f null -

Wish List - Summary

Please add the nv-codec-headers build dependency and the ffmpeg configure option --enable-nvdec. That will allow folks using NVIDIA graphics to select nvdec acceleration. The -c:v av1_cuvid selection for AV1 content is noticeably faster.

ffmpeg -y -hwaccel nvdec -c:v vp9_cuvid -i input_vp9.webm -f null - # 1436 fps
ffmpeg -y -hwaccel nvdec -c:v vp9 -i input_vp9.webm -f null -       # 1428 fps

ffmpeg -y -hwaccel nvdec -c:v av1_cuvid -i input_av1.mp4 -f null -  # 1629 fps
ffmpeg -y -hwaccel nvdec -c:v av1 -i input_av1.mp4 -f null -        #  895 fps

See also, Fedora Koji URL.

Thank you.

1 Like

The Clear Linux user experience has immensely improved for folks using NVIDIA graphics. See nvidia-driver-on-clear-linux. The missing piece now is nvdec support in Clear Fraction’s ffmpeg binary.

Thus the reason for the kind request above.

nv-codec-headers.spec for Clear Fraction

Name:           nv-codec-headers
Version:        11.1.5.1
Release:        1
Summary:        FFmpeg version of Nvidia Codec SDK headers
License:        MIT
URL:            https://github.com/FFmpeg/nv-codec-headers
Source:         %url/archive/n%{version}/%{name}-n%{version}.tar.gz
BuildRequires:  make

%description
FFmpeg version of headers required to interface with Nvidias codec APIs.

%prep
%autosetup -n %{name}-n%{version}
sed -i -e 's@/include@/include/ffnvcodec@g' ffnvcodec.pc.in

# Extract license
sed -n '4,25p' include/ffnvcodec/nvEncodeAPI.h > LICENSE
sed -i '1,22s/^.\{,3\}//' LICENSE

%build
%make_build PREFIX=%{_prefix} LIBDIR=lib64

%install
%make_install PREFIX=%{_prefix} LIBDIR=lib64

%files
%doc README
%license LICENSE
%{_includedir}/ffnvcodec/
%{_libdir}/pkgconfig/ffnvcodec.pc

%changelog
# based on https://koji.fedoraproject.org/koji/packageinfo?packageID=26434

Clear Fraction ffmpeg.spec modifications

It requires FFmpeg 5.1.0 as it provides AV1 acceleration on the GPU. I tested older 5.0.1, and -c:v av1_cuvid failed.

%global commit0 ffaf6061309b581eed1291d747fa419cab0d7565
Version: 5.1.0

BuildRequires: nv-codec-headers

./configure ... --enable-nvdec

Testing VA-API and NVDEC using NVIDIA graphics

# Install the YouTube downloader script. Installs in ~/.local/bin/
pip3 install --user --upgrade yt-dlp

# Download VP9 and AV1 media for testing
# Blackmagic Pocket Cinema Camera 4K ‘Balloons’
cd ~/Downloads
~/.local/bin/yt-dlp -F https://youtu.be/mIAfxj7nd9k
~/.local/bin/yt-dlp -f 248 https://youtu.be/mIAfxj7nd9k -o input_vp9.webm
~/.local/bin/yt-dlp -f 399 https://youtu.be/mIAfxj7nd9k -o input_av1.mp4

VP9

export LIBVA_DRIVER_NAME=nvdec (or nvidia)
ffmpeg -hwaccel vaapi -c:v vp9 -i input_vp9.webm -f null -       # 1311 fps
ffmpeg -hwaccel nvdec -c:v vp9 -i input_vp9.webm -f null -       # 1428 fps
ffmpeg -hwaccel nvdec -c:v vp9_cuvid -i input_vp9.webm -f null - # 1440 fps

AV1, minimally 3000 series

export LIBVA_DRIVER_NAME=nvdec (or nvidia)
ffmpeg -hwaccel vaapi -c:v av1 -i input_av1.mp4 -f null -        #  748 fps
ffmpeg -hwaccel nvdec -c:v av1 -i input_av1.mp4 -f null -        #  871 fps
ffmpeg -hwaccel nvdec -c:v av1_cuvid -i input_av1.mp4 -f null -  # 1630 fps

@marioroy not interested 'cause no NVidia hardware around, but CF is always open for collaboration. I’ll give you the Github access for a test bundle, then we’ll see.

It requires FFmpeg 5.1.0

Soon.

Also check GitHub - insilications/nv-codec-headers, https://github.com/insilications/ffmpeg/blob/f2fd0a37638558ebd01301abfc97c8fcee52556b/ffmpeg.spec.

1 Like

The following are the actions I took before making the request. I wanted to be sure working -hwaccel nvdec.

  1. Installed Clear Linux 36760 (using nouveau driver)

  2. Obtained fdk-aac.spec, lame.spec, x264.spec, x265.spec, and ffmpeg.spec from Clear Fraction. Basically, I built FFmpeg which involved installing various CL dependencies. That went well.

  3. Created a spec file for nv-codec-headers (minimally, 11.1.5.1) which is the current version. It works with the 470 NV drivers and above. There are no c source, simply header files and a pkgconfig file. Running rpmbuild completed successfully and installed the RPM.

  4. Next, I modified the Clear Fraction ffmpeg.spec file to version 5.1, added BuildRequires: nv-codec-headers and extra configure option --enable-nvdec. That went well. The ffmpeg binary -hwaccels mentions cuda support. :slight_smile: Note that the NV proprietary driver is not yet installed. Meaning that any author providing FFmpeg may add nv-codec support without NV hardware. FFmpeg’s configure --enable-nvdec ensures all is well.

  5. Finally, I installed the NV proprietary driver (including the NVDEC back-end VA-API driver) and tested latest 470, 510, and 515. For ffmpeg testing, I ensured -hwaccel vaapi -c:v {vp9, av1} and -hwaccel nvdec -c:v {vp9, vp9_cuvid, av1, av1_cuvid} working. Though, AV1 on the GPU requires FFmpeg 5.1.0 minimally.

Regarding testing, the FFmpeg configure script involves testing for --enable-nvdec. Thus, testing for cuda support is simply looking for cuda in the ffmpeg -hwaccels output. That is all one can do without NVIDIA graphics.

Access granted, push all above to Github.

2 Likes

Thanks for doing this. Run into an error with Brave.

Warning: File /usr/bin/brave-browser-stable does not have ‘execute’ permission so it won’t be exported

Any help?

sudo chmod +x /usr/bin/brave-browser-stable

Thanks for the reply.

The binary isn’t installed. No such file is created at the end of the installation. I guess it’s not exported into /usr/bin/ as the error quoted above says.

Won’t be exported 'cause the broken symlink: /usr/bin/brave-browser-nightly -> /opt/brave.com/brave-nightly/brave-browser-nightly

It was fixed a long time ago, just run Brave from desktop launcher. Even more, /opt/3rd-party/bin is useless 'cause performance penalty and export errors like this one, and can be removed.

1 Like

Ah that was helpful. I run XFCE so I just copied into the applications folder.

cp -s /opt/3rd-party/bundles/clearfraction/usr/share/applications/* ~/.local/share/applications/

Thanks again!

Project news:

2 Likes

:new: Project news:

2 Likes

:new: Now available: Lapce - Lightning-fast and Powerful Code Editor written in Rust

2 Likes

:new: Project news:

  • Welcome our new Patreon backer!

  • New application: Webapp-manager - run websites as if they were apps.

  • Shotwell removed due to build issues, will return in next release

1 Like

Hello. Your repository have something great: codecs-cuda and brave. Fully native and accelerated on CL. I have a question: do you know other 3rd-party repositories that have more bundles?

Another question: is it possible to build GNOME from sources and provide gnome-desktop-base (GNOME itself), gnome-desktop-core (GNOME Core Apps) and gnome-desktop-circle (GNOME Circle Apps) bundles? You can take a look at https://apps.gnome.org/

It is happening that CL have poor support for GNOME and it have it trimmed. Would be great to be able to have the entire GNOME desktop, plus some predefined configurations: like enabled animations, the experimental scaling factor, maybe others.

Hello once again. There is something that is happening to me right now. I want to build a software from source that depends on libraries and headers from ffmpeg. I confirmed that codecs-cuda doesn’t provide the headers, static libraries nor the pkg-config file. It would be great if you include that in the bundle in order to allow people to build software that depends on ffmpeg.

building software with dependencies not from official repo can a bit tricky. i think it’s stateless concept problem

@leiniercs, hello.

  1. Nope.
  2. It’s possible with some patches.
  3. Including headers is pointless 'cause gigantic dev bundes. I use this script to build packages, the Clear use mock & koji. So people can actually build software that depends on ffmpeg.

NVidia stuff available thanks to @marioroy, he’s left and I’ll try to maintain his legacy. About GNOME apps - I’m don’t use GNOME, so no motivation to add, but can help if anyone wants to contribute.

1 Like

:new: Project news:

  • the repository format bump
  • many updates including ffmpeg 6
  • qt6ct now available - allows users to configure Qt6 settings (theme, font, icons, etc.)
2 Likes