[bug#34050] gnu: Add libaom and activate AV1 support in ffmpeg. updated

Message ID 87va2l4l02.fsf@web.de
State Accepted
Headers show
Series [bug#34050] gnu: Add libaom and activate AV1 support in ffmpeg. updated | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied

Commit Message

Dr. Arne Babenhauserheide Jan. 18, 2019, 11:13 p.m. UTC
The following patch now avoids breaking ffmpeg-3.4.

From f4406df33f1ed6dd64757f43ea7354fd5a88d2d3 Mon Sep 17 00:00:00 2001
From: Arne Babenhauserheide <arne_bab@web.de>
Date: Sat, 12 Jan 2019 01:24:58 +0100
Subject: [PATCH]     gnu: Add libaom and activate AV1 support in ffmpeg.

    * gnu/packages/video.scm (libaom): New variable.
    * gnu/packages/video.scm (ffmpeg): Add libaom support.
    [inputs] new input libaom.
    [arguments] new configure-flag --enable-libaom.
    * gnu/packages/video.scm (ffmpeg-3.4): filter out libaom.
    [inputs] remove inherited libaom
    [arguments] remove inherited configure-flag --enable-libaom
---
 gnu/packages/video.scm | 45 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

Comments

Leo Famulari March 5, 2019, 3:18 a.m. UTC | #1
On Sat, Jan 19, 2019 at 12:13:49AM +0100, Arne Babenhauserheide wrote:
> The following patch now avoids breaking ffmpeg-3.4.
> 
> From f4406df33f1ed6dd64757f43ea7354fd5a88d2d3 Mon Sep 17 00:00:00 2001
> From: Arne Babenhauserheide <arne_bab@web.de>
> Date: Sat, 12 Jan 2019 01:24:58 +0100
> Subject: [PATCH]     gnu: Add libaom and activate AV1 support in ffmpeg.
> 
>     * gnu/packages/video.scm (libaom): New variable.
>     * gnu/packages/video.scm (ffmpeg): Add libaom support.
>     [inputs] new input libaom.
>     [arguments] new configure-flag --enable-libaom.
>     * gnu/packages/video.scm (ffmpeg-3.4): filter out libaom.
>     [inputs] remove inherited libaom
>     [arguments] remove inherited configure-flag --enable-libaom

Sorry, this fell through the cracks.

I noticed that ffmpeg-for-stepmania (FFmpeg 2) isn't addressed by this
patch.

So, I built ffmpeg-3.4 without filtering out the libaom stuff and it
does build, so I'm wondering how it breaks?
Dr. Arne Babenhauserheide March 5, 2019, 3:57 p.m. UTC | #2
Leo Famulari <leo@famulari.name> writes:

> On Sat, Jan 19, 2019 at 12:13:49AM +0100, Arne Babenhauserheide wrote:
>> The following patch now avoids breaking ffmpeg-3.4.
>> 
>> From f4406df33f1ed6dd64757f43ea7354fd5a88d2d3 Mon Sep 17 00:00:00 2001
>> From: Arne Babenhauserheide <arne_bab@web.de>
>> Date: Sat, 12 Jan 2019 01:24:58 +0100
>> Subject: [PATCH]     gnu: Add libaom and activate AV1 support in ffmpeg.
>> 
>>     * gnu/packages/video.scm (libaom): New variable.
>>     * gnu/packages/video.scm (ffmpeg): Add libaom support.
>>     [inputs] new input libaom.
>>     [arguments] new configure-flag --enable-libaom.
>>     * gnu/packages/video.scm (ffmpeg-3.4): filter out libaom.
>>     [inputs] remove inherited libaom
>>     [arguments] remove inherited configure-flag --enable-libaom
>
> Sorry, this fell through the cracks.
>
> I noticed that ffmpeg-for-stepmania (FFmpeg 2) isn't addressed by this
> patch.

I did not know about it … 

> So, I built ffmpeg-3.4 without filtering out the libaom stuff and it
> does build, so I'm wondering how it breaks?

It broke because ffmpeg-3.4 does not have the --enable-libaom configure
flag.

What’s the exact patch you applied?

Best wishes,
Arne
Leo Famulari March 5, 2019, 8:08 p.m. UTC | #3
On Tue, Mar 05, 2019 at 04:57:33PM +0100, Arne Babenhauserheide wrote:
> It broke because ffmpeg-3.4 does not have the --enable-libaom configure
> flag.
> 
> What’s the exact patch you applied?

I'm seeing the build fail now. Auto-compilation of my Git tree must not
have been working previously. Testing...
Leo Famulari March 5, 2019, 8:12 p.m. UTC | #4
On Sat, Jan 19, 2019 at 12:13:49AM +0100, Arne Babenhauserheide wrote:
> From f4406df33f1ed6dd64757f43ea7354fd5a88d2d3 Mon Sep 17 00:00:00 2001
> From: Arne Babenhauserheide <arne_bab@web.de>
> Date: Sat, 12 Jan 2019 01:24:58 +0100
> Subject: [PATCH]     gnu: Add libaom and activate AV1 support in ffmpeg.
> 
>     * gnu/packages/video.scm (libaom): New variable.
>     * gnu/packages/video.scm (ffmpeg): Add libaom support.
>     [inputs] new input libaom.
>     [arguments] new configure-flag --enable-libaom.
>     * gnu/packages/video.scm (ffmpeg-3.4): filter out libaom.
>     [inputs] remove inherited libaom
>     [arguments] remove inherited configure-flag --enable-libaom

Okay, looks good in general.

> +(define-public libaom
> +  (package
> +    (name "libaom")
> +    (version "22b150bf040608028a56d8bf39e72f771383d836") ;; master

Typically we only package tagged releases. I think the latest libaom
release is 'v1.0.0-errata1'. Can we use that or did it not work for you?
If you didn't try it, I can do it here.
Leo Famulari March 5, 2019, 11:30 p.m. UTC | #5
On Tue, Mar 05, 2019 at 03:12:07PM -0500, Leo Famulari wrote:
> On Sat, Jan 19, 2019 at 12:13:49AM +0100, Arne Babenhauserheide wrote:
> > +(define-public libaom
> > +  (package
> > +    (name "libaom")
> > +    (version "22b150bf040608028a56d8bf39e72f771383d836") ;; master
> 
> Typically we only package tagged releases. I think the latest libaom
> release is 'v1.0.0-errata1'. Can we use that or did it not work for you?
> If you didn't try it, I can do it here.

To answer my own question, 1.0.0-errata1 installs a broken pkg-config
.pc file [0].

This is fixed in a later commit [1] ... we might as well use the commit
you chose originally, which is later than the pkg-config fix commit.

This library's decoder is *very* expensive — it can't even decode
1280x720 in realtime on my Ivy Bridge i5-3230M. I'm sure it only gets
faster as they keep working on it.

I changed the libaom package to be more idiomatic about versioning from
Git [2] and edited the synopsis and description, and pushed as
84eb265eb8076876d2b569bcdff1e44b44b4b295

Thanks a lot!

[0]
https://bugs.chromium.org/p/aomedia/issues/detail?id=1988

[1]
https://aomedia.googlesource.com/aom/+/0ddc150516b7672101265eac032a11a9aae4cb53

[2]
https://www.gnu.org/software/guix/manual/en/html_node/Version-Numbers.html
Dr. Arne Babenhauserheide March 6, 2019, 7:24 p.m. UTC | #6
Leo Famulari <leo@famulari.name> writes:

> On Tue, Mar 05, 2019 at 03:12:07PM -0500, Leo Famulari wrote:
>> On Sat, Jan 19, 2019 at 12:13:49AM +0100, Arne Babenhauserheide wrote:
>> > +(define-public libaom
>> > +  (package
>> > +    (name "libaom")
>> > +    (version "22b150bf040608028a56d8bf39e72f771383d836") ;; master
>>
>> Typically we only package tagged releases. I think the latest libaom
>> release is 'v1.0.0-errata1'. Can we use that or did it not work for you?
>> If you didn't try it, I can do it here.
>
> To answer my own question, 1.0.0-errata1 installs a broken pkg-config
> .pc file [0].

Thank you for checking!
(I do not remember why I chose the commit instead of the tag)

> This is fixed in a later commit [1] ... we might as well use the commit
> you chose originally, which is later than the pkg-config fix commit.

Sounds good.

> This library's decoder is *very* expensive — it can't even decode
> 1280x720 in realtime on my Ivy Bridge i5-3230M. I'm sure it only gets
> faster as they keep working on it.

I take it that you did not test the encoder yet … it takes roughly an
hour per second :-)

But this is a reference for seeing the quality, not for fast de- and
encoding.

> I changed the libaom package to be more idiomatic about versioning from
> Git [2] and edited the synopsis and description, and pushed as
> 84eb265eb8076876d2b569bcdff1e44b44b4b295
>
> Thanks a lot!

Thank you for taking care of the patch!

Best wishes,
Arne
--
Unpolitisch sein
heißt politisch sein
ohne es zu merken
Leo Famulari March 6, 2019, 8:02 p.m. UTC | #7
On Wed, Mar 06, 2019 at 08:24:03PM +0100, Arne Babenhauserheide wrote:
> I take it that you did not test the encoder yet … it takes roughly an
> hour per second :-)

Wooooow! I had heard it was very slow so I only tested the decoder.

I'm looking forward to dav1d and rav1e or some other implementations
leading us to the AV1+Opus promised land ;)

Patch

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 947c498c0..a2d56293f 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -237,6 +237,40 @@  A/52 standard is used in a variety of applications, including digital
 television and DVD.  It is also known as AC-3.")
     (license license:gpl2+)))
 
+(define-public libaom
+  (package
+    (name "libaom")
+    (version "22b150bf040608028a56d8bf39e72f771383d836") ;; master
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://aomedia.googlesource.com/aom/")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1pdd5h3n42607n6qmggz4yv8izhjr2kl6knb3kh7gh4v0vy47h1r"))))
+    (build-system cmake-build-system)
+    (native-inputs
+     `(("git" ,git)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python))) ; to detect the version
+    (arguments
+     `(#:tests? #f  ;no check target
+       #:configure-flags
+         ;; build dynamic library
+       (list "-DBUILD_SHARED_LIBS=YES"
+             "-DENABLE_PIC=TRUE"
+             "-DAOM_TARGET_CPU=generic"
+             (string-append "-DCMAKE_INSTALL_PREFIX="
+                              (assoc-ref %outputs "out")))))
+    (home-page "https://aomedia.googlesource.com/aom/")
+    (synopsis "AV1 Codec Library")
+    (description "libaom is the reference encoder of AV1.")
+    (license license:bsd-2)))
+
+
 (define-public libmpeg2
   (package
     (name "libmpeg2")
@@ -701,6 +735,7 @@  standards (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/VMW3).")
        ("opus" ,opus)
        ("ladspa" ,ladspa)
        ("lame" ,lame)
+       ("libaom" ,libaom)
        ("libass" ,libass)
        ("libbluray" ,libbluray)
        ("libcaca" ,libcaca)
@@ -787,6 +822,7 @@  standards (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/VMW3).")
          "--enable-fontconfig"
          "--enable-gnutls"
          "--enable-ladspa"
+         "--enable-libaom"
          "--enable-libass"
          "--enable-libbluray"
          "--enable-libcaca"
@@ -869,7 +905,14 @@  audio/video codec library.")
                                  version ".tar.xz"))
              (sha256
               (base32
-               "0b59qk5wpc5ksiha76jbhb859g5gxa4w0k6afh3kgvgajiivs73l"))))))
+               "0b59qk5wpc5ksiha76jbhb859g5gxa4w0k6afh3kgvgajiivs73l"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments ffmpeg)
+       ((#:configure-flags flags)
+        `(delete "--enable-libaom" ,flags))))
+    (inputs (fold alist-delete
+                  (package-inputs ffmpeg)
+                  '("libaom")))))
 
 (define-public ffmpegthumbnailer
   (package