[PATCH 0/2] Add r128gain

  • Done
  • quality assurance status badge
Details
4 participants
  • jgart
  • Lars-Dominik Braun
  • Ludovic Courtès
  • Parnikkapore
Owner
unassigned
Submitted by
Parnikkapore
Severity
normal
P
P
Parnikkapore wrote on 19 Jul 2023 17:30
(address . guix-patches@gnu.org)
cover.1689780467.git.poomklao@yahoo.com
Add the newer, Python-based r128gain.

Parnikkapore (2):
gnu: Add python-ffmpeg-python.
gnu: Add r128gain.

gnu/packages/audio.scm | 32 ++++++++++++++++++++++++++++++++
gnu/packages/python-xyz.scm | 30 ++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)


base-commit: 1d837aaa32a3a2de8f4a1ac391f92effba50834e
--
2.41.0
P
P
Parnikkapore wrote on 19 Jul 2023 17:34
[PATCH 2/2] gnu: Add r128gain.
(address . 64732@debbugs.gnu.org)
39cea1bf3cb8f87ffb20c1a61cb0281d2738a005.1689780467.git.poomklao@yahoo.com
* gnu/packages/audio.scm (r128gain): New variable.
---
gnu/packages/audio.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (60 lines)
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 8a11d2d6cc..db23635f15 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -45,6 +45,7 @@
;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; Copyright © 2023 Gabriel Wicki <gabriel@erlikon.ch>
;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023 Parnikkapore <poomklao@yahoo.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -116,7 +117,9 @@ (define-module (gnu packages audio)
#:use-module (gnu packages pulseaudio) ;libsndfile, libsamplerate
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
+ #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-science)
+ #:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages qt)
#:use-module (gnu packages rdf)
@@ -4691,6 +4694,35 @@ (define-public bs1770gain
loudness of audio and video files to the same level.")
(license license:gpl2+)))
+(define-public r128gain
+ (package
+ (name "r128gain")
+ (version "1.0.7")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/desbma/r128gain.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0zqclskkjb9hfdw9gq6iq4bs9dl1wj9nr8v1jz6s885379q9l8i7"))))
+ (build-system python-build-system)
+ (inputs (list python-crcmod python-ffmpeg-python python-mutagen
+ python-tqdm))
+ (propagated-inputs (list ffmpeg))
+ (native-inputs (list python-future python-requests))
+ (home-page "https://github.com/desbma/r128gain")
+ (synopsis "Fast audio loudness scanner & tagger")
+ (description
+ "r128gain is a multi platform command line tool to scan your audio
+files and tag them with loudness metadata (ReplayGain v2 or Opus R128 gain
+format), to allow playback of several tracks or albums at a similar
+loudness level. r128gain can also be used as a Python module from other
+Python projects to scan and/or tag audio files.")
+ ;; setup.py claims LGPL2+, but this is not corroborated anywhere else
+ (license license:lgpl2.1)))
+
(define-public filteraudio
(let ((revision "1")
(commit "2fc669581e2a0ff87fba8de85861b49133306094"))
--
2.41.0
P
P
Parnikkapore wrote on 19 Jul 2023 17:34
[PATCH 1/2] gnu: Add python-ffmpeg-python.
(address . 64732@debbugs.gnu.org)
a95bef988a2b414c3f0a6fc10911761bfe5d2dbe.1689780467.git.poomklao@yahoo.com
* gnu/packages/python-xyz.scm (python-ffmpeg-python): New variable.
---
The failed tests are asserts getting values that are close to, but not exactly,
equal. There's also one more test failure that has not yet made it into a
release.

gnu/packages/python-xyz.scm | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

Toggle diff (50 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 755b0af4b6..2dee31aa5d 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -139,6 +139,7 @@
;;; Copyright © 2023 Dominik Delgado Steuter <d@delgado.nrw>
;;; Copyright © 2023 Ivan Vilata-i-Balaguer <ivan@selidor.net>
;;; Copyright © 2023 Ontje Lünsdorf <ontje.luensdorf@dlr.de>
+;;; Copyright © 2023 Parnikkapore <poomklao@yahoo.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -8918,6 +8919,35 @@ (define-public python-lfdfiles
experimental data and metadata at the Laboratory for Fluorescence Dynamics.")
(license license:bsd-3)))
+(define-public python-ffmpeg-python
+ (package
+ (name "python-ffmpeg-python")
+ (version "0.2.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/kkroening/ffmpeg-python.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0mmydmfz3yiclbgi4lqrv9fh2nalafg4bkm92y2qi50mwqgffk8f"))))
+ (build-system python-build-system)
+ (arguments
+ ;; Some tests fail.
+ `(#:tests? #f))
+ (inputs (list python-future))
+ (propagated-inputs (list ffmpeg))
+ (native-inputs (list python-future python-numpy python-pytest
+ python-pytest-mock python-pytest-runner))
+ (home-page "https://github.com/kkroening/ffmpeg-python")
+ (synopsis "Python bindings for FFmpeg - with complex filtering support")
+ (description
+ "ffmpeg-python allows you to write FFmpeg filtergraphs in familiar
+Python terms, taking care of running ffmpeg with the correct command-line
+arguments. It handles arbitrarily large (directed-acyclic) signal graphs.")
+ (license license:asl2.0)))
+
(define-public python-imageio-ffmpeg
(package
(name "python-imageio-ffmpeg")
--
2.41.0
J
(name . Lars-Dominik Braun)(address . lars@6xq.net)
9b1de2185cdd19e4592fa0a82158c928@dismail.de
Toggle quote (3 lines)
> The failed tests are asserts getting values that are close to, but not exactly,
> equal.

Hi Parnikkapore,

Sounds like it might be a matter of adjusting the rel_tol and abs_tol upstream if related to isclose or similar being called in a test:


Might be worth doing that...

I'll try to take a closer look at this soon and the tests. Thanks for the patch!

all best,

jgart

https://whereis.???/
P
P
Parnikkapore wrote on 20 Jul 2023 04:34
(name . Lars-Dominik Braun)(address . lars@6xq.net)
86d89a4b622b8758036827c6389b615ab876e3ee.camel@yahoo.com
Hi jgart,

There's some evidence¹ that the failing tests are a consequence of them being written for FFmpeg 4, not having been updated for changed behavior in FFmpeg 5+.


While we have the option of using ffmpeg-4 as the input, that doesn't seem like a good option. There's a PR that fixes this, but the AUR simply ignores test failures. I'll probably disable the 2 failing tests and cherry-pick the collections.Iterable commit as a patch.
J
(name . Lars-Dominik Braun)(address . lars@6xq.net)
4cbd56591859aeede9c8d7fbbf098932@dismail.de
I'll probably disable the 2
Toggle quote (2 lines)
> failing tests and cherry-pick the collections.Iterable commit as a patch.

Hi Parnikkapore,

It is favorable to disable just those two tests than to disable the whole test suite, yes. Can you send a new patch with that change?

It would be much appreciated. Just Cc me when you have v2.

thanks,

jgart
P
P
Parnikkapore wrote on 20 Jul 2023 17:51
[PATCH v2 2/2] gnu: Add r128gain.
(address . 64732@debbugs.gnu.org)
4b66e7586e481db8eb612ec7efd8ca48499d4e5d.1689868307.git.poomklao@yahoo.com
* gnu/packages/audio.scm (r128gain): New variable.
---
gnu/packages/audio.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (60 lines)
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 8a11d2d6cc..db23635f15 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -45,6 +45,7 @@
;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; Copyright © 2023 Gabriel Wicki <gabriel@erlikon.ch>
;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023 Parnikkapore <poomklao@yahoo.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -116,7 +117,9 @@ (define-module (gnu packages audio)
#:use-module (gnu packages pulseaudio) ;libsndfile, libsamplerate
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
+ #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-science)
+ #:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages qt)
#:use-module (gnu packages rdf)
@@ -4691,6 +4694,35 @@ (define-public bs1770gain
loudness of audio and video files to the same level.")
(license license:gpl2+)))
+(define-public r128gain
+ (package
+ (name "r128gain")
+ (version "1.0.7")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/desbma/r128gain.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0zqclskkjb9hfdw9gq6iq4bs9dl1wj9nr8v1jz6s885379q9l8i7"))))
+ (build-system python-build-system)
+ (inputs (list python-crcmod python-ffmpeg-python python-mutagen
+ python-tqdm))
+ (propagated-inputs (list ffmpeg))
+ (native-inputs (list python-future python-requests))
+ (home-page "https://github.com/desbma/r128gain")
+ (synopsis "Fast audio loudness scanner & tagger")
+ (description
+ "r128gain is a multi platform command line tool to scan your audio
+files and tag them with loudness metadata (ReplayGain v2 or Opus R128 gain
+format), to allow playback of several tracks or albums at a similar
+loudness level. r128gain can also be used as a Python module from other
+Python projects to scan and/or tag audio files.")
+ ;; setup.py claims LGPL2+, but this is not corroborated anywhere else
+ (license license:lgpl2.1)))
+
(define-public filteraudio
(let ((revision "1")
(commit "2fc669581e2a0ff87fba8de85861b49133306094"))
--
2.41.0
P
P
Parnikkapore wrote on 20 Jul 2023 17:51
[PATCH v2 1/2] gnu: Add python-ffmpeg-python.
(address . 64732@debbugs.gnu.org)
eb3eaaa0e7f3d610c6ea0bcc8e170c9544397520.1689868307.git.poomklao@yahoo.com
* gnu/packages/python-xyz.scm (python-ffmpeg-python): New variable.
---
gnu/packages/python-xyz.scm | 50 +++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)

Toggle diff (72 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 755b0af4b6..9097f3f027 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -139,6 +139,7 @@
;;; Copyright © 2023 Dominik Delgado Steuter <d@delgado.nrw>
;;; Copyright © 2023 Ivan Vilata-i-Balaguer <ivan@selidor.net>
;;; Copyright © 2023 Ontje Lünsdorf <ontje.luensdorf@dlr.de>
+;;; Copyright © 2023 Parnikkapore <poomklao@yahoo.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -8918,6 +8919,55 @@ (define-public python-lfdfiles
experimental data and metadata at the Laboratory for Fluorescence Dynamics.")
(license license:bsd-3)))
+(define-public python-ffmpeg-python
+ (package
+ (name "python-ffmpeg-python")
+ (version "0.2.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/kkroening/ffmpeg-python.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0mmydmfz3yiclbgi4lqrv9fh2nalafg4bkm92y2qi50mwqgffk8f"))
+ (snippet
+ #~(begin
+ (use-modules (guix build utils))
+ (substitute* "ffmpeg/_run.py"
+ (("collections\\.Iterable")
+ "collections.abc.Iterable"))))))
+ (build-system python-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'disable-failing-tests
+ (lambda* _
+ (substitute* "ffmpeg/tests/test_ffmpeg.py"
+ (("([ \t]*)def test_pipe\\(" all indent)
+ (string-append indent
+ "@pytest.mark.skip"
+ "(reason=\"Not working under FFmpeg 5+\")\n"
+ all))
+ (("([ \t]*)def test__probe\\(" all indent)
+ (string-append indent
+ "@pytest.mark.skip"
+ "(reason=\"Not working under FFmpeg 5+\")\n"
+ all))))))))
+ (inputs (list python-future))
+ (propagated-inputs (list ffmpeg))
+ (native-inputs (list python-future python-numpy python-pytest
+ python-pytest-mock python-pytest-runner))
+ (home-page "https://github.com/kkroening/ffmpeg-python")
+ (synopsis "Python bindings for FFmpeg - with complex filtering support")
+ (description
+ "ffmpeg-python allows you to write FFmpeg filtergraphs in familiar
+Python terms, taking care of running ffmpeg with the correct command-line
+arguments. It handles arbitrarily large (directed-acyclic) signal graphs.")
+ (license license:asl2.0)))
+
(define-public python-imageio-ffmpeg
(package
(name "python-imageio-ffmpeg")

base-commit: 1d837aaa32a3a2de8f4a1ac391f92effba50834e
--
2.41.0
J
(name . Lars-Dominik Braun)(address . lars@6xq.net)
c8374d656c5a61b56d01cede57b9d061@dismail.de
Hi Parnikkapore,

Thanks for v2.

From a quick glance at the patch are you aware of the -k flag in Pytest that allows to disable tests?


It is a common pattern to use that flag in Guix Python packages for this purpose. I would look in (gnu packages python-xyz) for examples.

Is there some other reason why you're using substitute* to disable the tests?

all best,

jgart
P
P
Parnikkapore wrote on 21 Jul 2023 08:50
[PATCH v3 1/2] gnu: Add python-ffmpeg-python.
(address . 64732@debbugs.gnu.org)
bcae23c779592e17719214ec54c89ba86c2e9aa9.1689922236.git.poomklao@yahoo.com
* gnu/packages/python-xyz.scm (python-ffmpeg-python): New variable.
---

I was not aware, thank you! The "flag the tests in the source" method
is the one I spotted when looking around python-xyz.

Included in this email is a v3 that uses the -k flag.

gnu/packages/python-xyz.scm | 42 +++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)

Toggle diff (64 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 755b0af4b6..10cadd6e15 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -139,6 +139,7 @@
;;; Copyright © 2023 Dominik Delgado Steuter <d@delgado.nrw>
;;; Copyright © 2023 Ivan Vilata-i-Balaguer <ivan@selidor.net>
;;; Copyright © 2023 Ontje Lünsdorf <ontje.luensdorf@dlr.de>
+;;; Copyright © 2023 Parnikkapore <poomklao@yahoo.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -8918,6 +8919,47 @@ (define-public python-lfdfiles
experimental data and metadata at the Laboratory for Fluorescence Dynamics.")
(license license:bsd-3)))
+(define-public python-ffmpeg-python
+ (package
+ (name "python-ffmpeg-python")
+ (version "0.2.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/kkroening/ffmpeg-python.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0mmydmfz3yiclbgi4lqrv9fh2nalafg4bkm92y2qi50mwqgffk8f"))
+ (snippet
+ #~(begin
+ (use-modules (guix build utils))
+ (substitute* "ffmpeg/_run.py"
+ (("collections\\.Iterable")
+ "collections.abc.Iterable"))))))
+ (build-system python-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "pytest" "-vv"
+ "-k" "not test_pipe and not test__probe")))))))
+ (inputs (list python-future))
+ (propagated-inputs (list ffmpeg))
+ (native-inputs (list python-future python-numpy python-pytest
+ python-pytest-mock python-pytest-runner))
+ (home-page "https://github.com/kkroening/ffmpeg-python")
+ (synopsis "Python bindings for FFmpeg - with complex filtering support")
+ (description
+ "ffmpeg-python allows you to write FFmpeg filtergraphs in familiar
+Python terms, taking care of running ffmpeg with the correct command-line
+arguments. It handles arbitrarily large (directed-acyclic) signal graphs.")
+ (license license:asl2.0)))
+
(define-public python-imageio-ffmpeg
(package
(name "python-imageio-ffmpeg")

base-commit: 1d837aaa32a3a2de8f4a1ac391f92effba50834e
--
2.41.0
P
P
Parnikkapore wrote on 21 Jul 2023 08:50
[PATCH v3 2/2] gnu: Add r128gain.
(address . 64732@debbugs.gnu.org)
a9f1fc820d62cbe67f963462088a2477138fed93.1689922236.git.poomklao@yahoo.com
* gnu/packages/audio.scm (r128gain): New variable.
---
gnu/packages/audio.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (60 lines)
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 8a11d2d6cc..db23635f15 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -45,6 +45,7 @@
;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; Copyright © 2023 Gabriel Wicki <gabriel@erlikon.ch>
;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023 Parnikkapore <poomklao@yahoo.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -116,7 +117,9 @@ (define-module (gnu packages audio)
#:use-module (gnu packages pulseaudio) ;libsndfile, libsamplerate
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
+ #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-science)
+ #:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages qt)
#:use-module (gnu packages rdf)
@@ -4691,6 +4694,35 @@ (define-public bs1770gain
loudness of audio and video files to the same level.")
(license license:gpl2+)))
+(define-public r128gain
+ (package
+ (name "r128gain")
+ (version "1.0.7")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/desbma/r128gain.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0zqclskkjb9hfdw9gq6iq4bs9dl1wj9nr8v1jz6s885379q9l8i7"))))
+ (build-system python-build-system)
+ (inputs (list python-crcmod python-ffmpeg-python python-mutagen
+ python-tqdm))
+ (propagated-inputs (list ffmpeg))
+ (native-inputs (list python-future python-requests))
+ (home-page "https://github.com/desbma/r128gain")
+ (synopsis "Fast audio loudness scanner & tagger")
+ (description
+ "r128gain is a multi platform command line tool to scan your audio
+files and tag them with loudness metadata (ReplayGain v2 or Opus R128 gain
+format), to allow playback of several tracks or albums at a similar
+loudness level. r128gain can also be used as a Python module from other
+Python projects to scan and/or tag audio files.")
+ ;; setup.py claims LGPL2+, but this is not corroborated anywhere else
+ (license license:lgpl2.1)))
+
(define-public filteraudio
(let ((revision "1")
(commit "2fc669581e2a0ff87fba8de85861b49133306094"))
--
2.41.0
J
P
P
Parnikkapore wrote on 22 Jul 2023 15:50
(name . Lars-Dominik Braun)(address . lars@6xq.net)
5fdcca04abe3ce8d7bfa62c20b3376341af72bd6.camel@yahoo.com
Hi all,

jgart suggested on the GitHub thread that we pick a new commit from upstream instead of patching the release.

Should we use https://github.com/kkroening/ffmpeg-python/commit/6189cd6861a90f6f52e6a8ba2db0fada54134194(the commit that fixes the issue upstream) or https://github.com/kkroening/ffmpeg-python/commit/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6 (the last ever commit before the project went silent)?
J
40ae688dc99d72f784f2fb1a155e22dc@dismail.de
Lars,

Should these be patched to refer to our ffmpeg?


And a call to subprocess.check_call in the tests:


WDYT if we document our policy for patching executables. Currently, this practice is tribal knowledge that Guixers receive during patch review but we don't have it officially in writing anywhere (e.g. manual, cookbook, etc)

Ludo WDYT

all best,

jgart
J
114a57803185a45e977cbba0e02f1793@dismail.de
Toggle quote (2 lines)
> Ludo WDYT

Or anyone else on the team:

Zimoun WDYT ;()

Efraim WDYT ;()

yours truly,

jgart
L
L
Lars-Dominik Braun wrote on 22 Jul 2023 17:59
(name . jgart)(address . jgart@dismail.de)
ZLv81O_Ey01jMM9c@noor.fritz.box
Hi,

Toggle quote (4 lines)
> Should these be patched to refer to our ffmpeg?
>
> https://github.com/kkroening/ffmpeg-python/blob/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6/ffmpeg/_run.py#L302

yes.

Toggle quote (4 lines)
> And a call to subprocess.check_call in the tests:
>
> https://github.com/kkroening/ffmpeg-python/blob/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6/ffmpeg/tests/test_ffmpeg.py#L29

Probably fine. The tests will find the only (and correct) ffmpeg if it’s an input.

Lars
J
(name . Lars-Dominik Braun)(address . lars@6xq.net)
d04e53142cf5ae50a69dd98c23c89de5@dismail.de
Toggle quote (2 lines)
> Probably fine. The tests will find the only (and correct) ffmpeg if it’s an input.

Hi Lars,

The tests will only ever use the guix installed ffmpeg in the inputs even if the user installed ffmpeg via dnf on Fedora, for example?

I haven't tested that edge case myself.

happy hacking,

jgart
J
(name . Lars-Dominik Braun)(address . lars@6xq.net)
4f14b81fb26bfa703b3fe37c8e1c93ae@dismail.de
Toggle quote (7 lines)
>> Should these be patched to refer to our ffmpeg?
>>
>> https://github.com/kkroening/ffmpeg-python/blob/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6/ffmpeg/_run
>> py#L302
>
> yes.

Lars,

Thanks.

Parnikkapore,

Can you send another revision patching the ffmpeg executable?

No need to patch the ffmpeg executable in the tests as those are run hermetically in a container and will only ever use/find the Guix-installed ffmpeg.

all best,

jgart
P
P
Parnikkapore wrote on 4 Aug 2023 16:56
[PATCH v4 2/2] gnu: Add r128gain.
(address . 64732@debbugs.gnu.org)
05823418e436be45c415b9f1738c23edaf4c88c4.1691160970.git.poomklao@yahoo.com
* gnu/packages/audio.scm (r128gain): New variable.
---

Ditto.

gnu/packages/audio.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)

Toggle diff (70 lines)
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 8a11d2d6cc..39f7f5496b 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -45,6 +45,7 @@
;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; Copyright © 2023 Gabriel Wicki <gabriel@erlikon.ch>
;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023 Parnikkapore <poomklao@yahoo.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -116,7 +117,9 @@ (define-module (gnu packages audio)
#:use-module (gnu packages pulseaudio) ;libsndfile, libsamplerate
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
+ #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-science)
+ #:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages qt)
#:use-module (gnu packages rdf)
@@ -4691,6 +4694,45 @@ (define-public bs1770gain
loudness of audio and video files to the same level.")
(license license:gpl2+)))
+(define-public r128gain
+ (package
+ (name "r128gain")
+ (version "1.0.7")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/desbma/r128gain.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0zqclskkjb9hfdw9gq6iq4bs9dl1wj9nr8v1jz6s885379q9l8i7"))))
+ (build-system python-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'hardcode-ffmpeg
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "r128gain/__init__.py"
+ (("ffmpeg_path or \"ffmpeg\"")
+ (string-append "ffmpeg_path or \""
+ (search-input-file inputs "bin/ffmpeg")
+ "\""))))))))
+ (inputs (list python-crcmod python-ffmpeg-python python-mutagen
+ python-tqdm ffmpeg))
+ (native-inputs (list python-future python-requests))
+ (home-page "https://github.com/desbma/r128gain")
+ (synopsis "Fast audio loudness scanner & tagger")
+ (description
+ "r128gain is a multi platform command line tool to scan your audio
+files and tag them with loudness metadata (ReplayGain v2 or Opus R128 gain
+format), to allow playback of several tracks or albums at a similar
+loudness level. r128gain can also be used as a Python module from other
+Python projects to scan and/or tag audio files.")
+ ;; setup.py claims LGPL2+, but this is not corroborated anywhere else
+ (license license:lgpl2.1)))
+
(define-public filteraudio
(let ((revision "1")
(commit "2fc669581e2a0ff87fba8de85861b49133306094"))
--
2.41.0
P
P
Parnikkapore wrote on 4 Aug 2023 16:56
[PATCH v4 1/2] gnu: Add python-ffmpeg-python.
(address . 64732@debbugs.gnu.org)
6c8737581d9018c48763b23d237978fb639c78c7.1691160970.git.poomklao@yahoo.com
* gnu/packages/python-xyz.scm (python-ffmpeg-python): New variable.
---

Here's a v4 that hardcodes and no longer propagates ffmpeg. One of the tests check the
command to be run, including the ffmpeg command used, so that test has to be patched too.

gnu/packages/python-xyz.scm | 48 +++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)

Toggle diff (70 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 755b0af4b6..23d14db449 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -139,6 +139,7 @@
;;; Copyright © 2023 Dominik Delgado Steuter <d@delgado.nrw>
;;; Copyright © 2023 Ivan Vilata-i-Balaguer <ivan@selidor.net>
;;; Copyright © 2023 Ontje Lünsdorf <ontje.luensdorf@dlr.de>
+;;; Copyright © 2023 Parnikkapore <poomklao@yahoo.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -8918,6 +8919,53 @@ (define-public python-lfdfiles
experimental data and metadata at the Laboratory for Fluorescence Dynamics.")
(license license:bsd-3)))
+(define-public python-ffmpeg-python
+ ;; The latest release (0.2.0) is old and its test suite crashs on Python 3.10.
+ (let ((commit "df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6") (revision "0"))
+ (package
+ (name "python-ffmpeg-python")
+ (version (git-version "0.2.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/kkroening/ffmpeg-python.git")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1zj4ac37n4igfj21zy405mdlvbpv6jyb12wfpszf8zkhhj2qby4c"))))
+ (build-system python-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'hardcode-ffmpeg
+ (lambda* (#:key inputs #:allow-other-keys)
+ (define ffmpeg (search-input-file inputs "bin/ffmpeg"))
+ (substitute* "ffmpeg/_run.py"
+ (("cmd='ffmpeg'")
+ (string-append "cmd='" ffmpeg "'")))
+ (substitute* "ffmpeg/tests/test_ffmpeg.py"
+ (("out_file.compile\\(\\) == \\['ffmpeg'")
+ (string-append "out_file.compile() == ['" ffmpeg "'")))))
+ ;; Some tests fail with ffmpeg 5+
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "pytest" "-vv"
+ "-k" "not test_pipe and not test__probe")))))))
+ (inputs (list ffmpeg))
+ (propagated-inputs (list python-future))
+ (native-inputs (list python-future python-numpy python-pytest
+ python-pytest-mock python-pytest-runner))
+ (home-page "https://github.com/kkroening/ffmpeg-python")
+ (synopsis "Python bindings for FFmpeg - with complex filtering support")
+ (description
+ "ffmpeg-python allows you to write FFmpeg filtergraphs in familiar
+Python terms, taking care of running ffmpeg with the correct command-line
+arguments. It handles arbitrarily large (directed-acyclic) signal graphs.")
+ (license license:asl2.0))))
+
(define-public python-imageio-ffmpeg
(package
(name "python-imageio-ffmpeg")

base-commit: 1d837aaa32a3a2de8f4a1ac391f92effba50834e
--
2.41.0
L
L
Ludovic Courtès wrote on 20 Aug 2023 23:08
Re: bug#64732: [PATCH 0/2] Add r128gain
(name . Parnikkapore)(address . poomklao@yahoo.com)
87350dqv4w.fsf_-_@gnu.org
Hi,

Parnikkapore <poomklao@yahoo.com> skribis:

Toggle quote (2 lines)
> * gnu/packages/python-xyz.scm (python-ffmpeg-python): New variable.

[...]

Toggle quote (2 lines)
> * gnu/packages/audio.scm (r128gain): New variable.

Applied with the changes below.

Thanks,
Ludo’.
Toggle diff (15 lines)
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index f890e82eb0..b786375599 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -4730,8 +4730,8 @@ (define-public r128gain
format), to allow playback of several tracks or albums at a similar
loudness level. r128gain can also be used as a Python module from other
Python projects to scan and/or tag audio files.")
- ;; setup.py claims LGPL2+, but this is not corroborated anywhere else
- (license license:lgpl2.1)))
+ ;; 'setup.py' claims LGPL2+, 'LICENSE' is LGPLv2.1.
+ (license license:lgpl2.1+)))
(define-public filteraudio
(let ((revision "1")
Closed
?