Subject: bug#43418: [PATCH] gnu: youtube-dl: Refer to ffmpeg.

From: Tobias Geerinckx-Rice <[email-masked]>
Date: Wed, 16 Sep 2020 11:54:15 +0200

Addresses <https://issues.guix.gnu.org/43418>.

* gnu/packages/video.scm (youtube-dl)[inputs]: Add ffmpeg.
[arguments]: Fall back to input ffmpeg instead of searching $PATH.
---
 gnu/packages/video.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 8ebe7dbcdf..50f751f8da 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2184,6 +2184,13 @@ To load this plugin, specify the following option when starting mpv:
      ;; 'youtube-dl.bash-completion'.
      `(#:tests? #f ; Many tests fail. The test suite can be run with pytest.
        #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'default-to-the-ffmpeg-input
+                    (lambda _
+                      ;; Continue respecting the --ffmpeg-location argument.
+                      (substitute* "youtube_dl/postprocessor/ffmpeg.py"
+                        (("\\.get\\('ffmpeg_location'\\)" match)
+                         (format #f "~a or '~a'" match (which "ffmpeg"))))
+                      #t))
                   (add-before 'install 'fix-the-data-directories
                     (lambda* (#:key outputs #:allow-other-keys)
                       (let ((prefix (assoc-ref outputs "out")))
@@ -2207,6 +2214,8 @@ To load this plugin, specify the following option when starting mpv:
                         (copy-file "youtube-dl.zsh"
                                    (string-append zsh "/_youtube-dl"))
                         #t))))))
+    (inputs
+     `(("ffmpeg" ,ffmpeg)))
     (synopsis "Download videos from YouTube.com and other sites")
     (description
      "Youtube-dl is a small command-line program to download videos from
-- 
2.28.0