Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg-headless: enable additional encoders #330056

Merged
merged 1 commit into from
Jul 29, 2024
Merged

ffmpeg-headless: enable additional encoders #330056

merged 1 commit into from
Jul 29, 2024

Conversation

eclairevoyant
Copy link
Contributor

@eclairevoyant eclairevoyant commented Jul 26, 2024

Description of changes

Should help with #271863

This adds some extremely helpful and popular encoders in by default:

  • openjpeg
  • celt
  • libwebp
  • libaom

Closure size for ffmpeg-headless went up 18.5 MiB, and even less of a difference for the "small" variant.
(I tested this on the master branch before rebasing because I didn't want to spend all year on a mass rebuild)

$ nix store diff-closures nixpkgs#ffmpeg-headless^bin .#ffmpeg-headless^bin
celt: ∅ → 0.11.3, +168.4 KiB
ffmpeg-headless: +70.0 KiB
giflib: ∅ → 5.2.2, +398.7 KiB
lcms2: ∅ → 2.16, +466.2 KiB
lerc: ∅ → 4.0.0, +840.2 KiB
libaom: ∅ → 3.9.0, +8047.8 KiB
libdeflate: ∅ → 1.20, +427.0 KiB
libtiff: ∅ → 4.6.0, +655.9 KiB
libvmaf: ∅ → 3.0.0, +2665.0 KiB
libwebp: ∅ → 1.4.0, +2559.7 KiB
openjpeg: ∅ → 2.5.2, +1525.1 KiB
zstd: ∅ → 1.5.6, +1158.0 KiB

$ nvd diff $(nix build nixpkgs#ffmpeg-headless^bin --print-out-paths --no-link) $(nix build .#ffmpeg-headless^bin --print-out-paths --no-link)
<<< /nix/store/4n60lnj3zkjpasd4c56bzhpx2m8lc1sx-ffmpeg-headless-6.1.1-bin
>>> /nix/store/884f487w5hac6rs94jq6hq5zqkxdv666-ffmpeg-headless-6.1.1-bin
Added packages:
[A.]  #01  celt        0.11.3
[A.]  #02  giflib      5.2.2
[A.]  #03  lcms2       2.16
[A.]  #04  lerc        4.0.0
[A.]  #05  libaom      3.9.0
[A.]  #06  libdeflate  1.20
[A.]  #07  libtiff     4.6.0
[A.]  #08  libvmaf     3.0.0
[A.]  #09  libwebp     1.4.0 x2
[A.]  #10  openjpeg    2.5.2
[A.]  #11  zstd        1.5.6
Closure size: 66 -> 78 (15 paths added, 3 paths removed, delta +12, disk usage +18.5MiB).

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Copy link
Member

@jopejoe1 jopejoe1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe even worth including aom and jxl seeing #330125 and looking at the mpv manual they are listed as supported formats for screenshots https://mpv.io/manual/master/#options-screenshot-format

@eclairevoyant
Copy link
Contributor Author

jxl is too big (100 megs)
aom i thought would be redundant as we already have svt-av1 and rav1e

@jopejoe1
Copy link
Member

jxl is too big (100 megs)

ooff

aom i thought would be redundant as we already have svt-av1 and rav1e

mpv defaults to that one https://mpv.io/manual/master/#options-screenshot-avif-encoder

@eclairevoyant
Copy link
Contributor Author

aom i thought would be redundant as we already have svt-av1 and rav1e

mpv defaults to that one

right but that doesn't preclude using another av1 encoder (aom is slow so the default is probably suboptimal). anyway i'll take a look at closure size later

@Atemu
Copy link
Member

Atemu commented Jul 26, 2024

aom is slow so the default is probably suboptimal

Keep in mind that the purpose here is singular frames where iframe quality matters most and speed is almost secondary. The performance of either encoder in motion pictures has little relevance here.

@eclairevoyant
Copy link
Contributor Author

eclairevoyant commented Jul 26, 2024

aom adds another 10 megs, up to you if you think it's worth it
I personally am not super convinced by needing that much space for a thumbnailer but 🤷

@Atemu
Copy link
Member

Atemu commented Jul 26, 2024

That sounds acceptable, especially considering that you likely already have libaom in your final closure via libavif.

Searching around, I gathered from discussions that aom has greater compression efficiency for avif purposes and that SVT-AV1 has odd resolution and memory limitations. I have sadly not found any data on this despite my best efforts.

@eclairevoyant eclairevoyant changed the title ffmpeg-headless: enable additional encoders by default ffmpeg-headless: enable additional encoders Jul 28, 2024
@eclairevoyant
Copy link
Contributor Author

added libaom, desc updated.

Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the PR message content to the commit message?

This adds some extremely helpful and popular encoders in by default:
* openjpeg
* celt
* libwebp
* libaom

On the `master` branch, closure size for ffmpeg-headless went up 18.5 MiB.
```
$ nix store diff-closures nixpkgs#ffmpeg-headless^bin .#ffmpeg-headless^bin
celt: ∅ → 0.11.3, +168.4 KiB
ffmpeg-headless: +70.0 KiB
giflib: ∅ → 5.2.2, +398.7 KiB
lcms2: ∅ → 2.16, +466.2 KiB
lerc: ∅ → 4.0.0, +840.2 KiB
libaom: ∅ → 3.9.0, +8047.8 KiB
libdeflate: ∅ → 1.20, +427.0 KiB
libtiff: ∅ → 4.6.0, +655.9 KiB
libvmaf: ∅ → 3.0.0, +2665.0 KiB
libwebp: ∅ → 1.4.0, +2559.7 KiB
openjpeg: ∅ → 2.5.2, +1525.1 KiB
zstd: ∅ → 1.5.6, +1158.0 KiB

$ nvd diff $(nix build nixpkgs#ffmpeg-headless^bin --print-out-paths --no-link) $(nix build .#ffmpeg-headless^bin --print-out-paths --no-link)
<<< /nix/store/4n60lnj3zkjpasd4c56bzhpx2m8lc1sx-ffmpeg-headless-6.1.1-bin
>>> /nix/store/884f487w5hac6rs94jq6hq5zqkxdv666-ffmpeg-headless-6.1.1-bin
Added packages:
[A.]  #1  celt        0.11.3
[A.]  #2  giflib      5.2.2
[A.]  #3  lcms2       2.16
[A.]  #4  lerc        4.0.0
[A.]  #5  libaom      3.9.0
[A.]  #6  libdeflate  1.20
[A.]  #7  libtiff     4.6.0
[A.]  #8  libvmaf     3.0.0
[A.]  #9  libwebp     1.4.0 x2
[A.]  #10  openjpeg    2.5.2
[A.]  #11  zstd        1.5.6
Closure size: 66 -> 78 (15 paths added, 3 paths removed, delta +12, disk usage +18.5MiB).
```
@ofborg ofborg bot requested review from Atemu and jopejoe1 July 29, 2024 03:04
@Atemu Atemu merged commit adbff05 into NixOS:staging Jul 29, 2024
25 of 27 checks passed
@eclairevoyant eclairevoyant deleted the ffmpeg-deps branch August 2, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants