gnu: Add libdvdnav-4.
[jackhill/guix/guix.git] / gnu / packages / video.scm
index 9946b3a..ba6a48f 100644 (file)
@@ -1,6 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2014 David Thompson <davet@gnu.org>
+;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org>
+;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages video)
+  #:use-module (ice-9 match)
   #:use-module ((guix licenses)
-                #:select (gpl2 gpl2+ bsd-3 public-domain))
+                #:select (gpl2 gpl2+ gpl3+ lgpl2.1+ bsd-3 public-domain))
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages audio)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages avahi)
   #:use-module (gnu packages cdrom)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages zip)
+  #:use-module (gnu packages databases)
+  #:use-module (gnu packages doxygen)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages fribidi)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages guile)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gnutls)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages ssh)
+  #:use-module (gnu packages texlive)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
-  #:use-module (gnu packages yasm))
+  #:use-module (gnu packages yasm)
+  #:use-module (gnu packages zip))
+
+(define-public liba52
+  (package
+    (name "liba52")
+    (version "0.7.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/liba52/a52dec-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "0czccp4fcpf2ykp16xcrzdfmnircz1ynhls334q374xknd5747d2"))))
+    (build-system gnu-build-system)
+    (home-page "http://liba52.sourceforge.net/")
+    (synopsis "ATSC A/52 stream decoder")
+    (description "liba52 is a library for decoding ATSC A/52 streams.  The
+A/52 standard is used in a variety of applications, including digital
+television and DVD.  It is also known as AC-3.")
+    (license gpl2+)))
+
+(define-public libdca
+  (package
+    (name "libdca")
+    (version "0.0.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://download.videolan.org/pub/videolan/libdca/"
+                    version "/libdca-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0hh6a7l8vvccsd5i1fkv9av2gzv9fy8m0b8jpsn5p6hh4bh2586v"))))
+    (build-system gnu-build-system)
+    (home-page "http://www.videolan.org/developers/libdca.html")
+    (synopsis "DTS Coherent Acoustics decoder")
+    (description "libdca is a library for decoding DTS Coherent Acoustics
+streams.")
+    (license gpl2+)))
+
+(define-public libdv
+  (package
+    (name "libdv")
+    (version "1.0.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "mirror://sourceforge/libdv/libdv-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1fl96f2xh2slkv1i1ix7kqk576a0ak1d33cylm0mbhm96d0761d3"))))
+    (build-system gnu-build-system)
+    (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs `(("libxv" ,libxv)))
+    (home-page "http://libdv.sourceforge.net/")
+    (synopsis "DV video (IEC 61834 and SMPTE 314M) codec")
+    (description "The Quasar DV codec (libdv) is a software codec for DV
+video, the encoding format used by most digital camcorders, typically those
+that support the IEEE 1394 (a.k.a. FireWire or i.Link) interface.  Libdv was
+developed according to the official standards for DV video: IEC 61834 and
+SMPTE 314M.")
+    (license lgpl2.1+)))
 
 (define-public ffmpeg
   (package
     (name "ffmpeg")
-    (version "2.2.1")
+    (version "2.5.4")
     (source (origin
              (method url-fetch)
              (uri (string-append "http://www.ffmpeg.org/releases/ffmpeg-"
                                  version ".tar.bz2"))
              (sha256
               (base32
-               "153kfk8rzrfxx930rrk417b2m695dvy47v4hci3nd49iggx9jzz1"))))
+               "11m2hbhdgphjxjp6hk438cxmipqjg5ixbr1kqnn9mbdhq9kc34fc"))))
     (build-system gnu-build-system)
     (inputs
      `(("fontconfig" ,fontconfig)
        ("freetype" ,freetype)
        ("opus" ,opus)
+       ("lame" ,lame)
+       ("libbluray" ,libbluray)
        ("libtheora" ,libtheora)
        ("libvorbis" ,libvorbis)
        ("libvpx" ,libvpx)
        ("patchelf" ,patchelf)
+       ("soxr" ,soxr)
        ("speex" ,speex)
+       ("twolame" ,twolame)
        ("zlib", zlib)))
     (native-inputs
      `(("bc" ,bc)
 ;;   --enable-ladspa          enable LADSPA audio filtering
 ;;   --enable-libaacplus      enable AAC+ encoding via libaacplus [no]
 ;;   --enable-libass          enable libass subtitles rendering [no]
-;;   --enable-libbluray       enable BluRay reading using libbluray [no]
 ;;   --enable-libcaca         enable textual display using libcaca
 ;;   --enable-libcelt         enable CELT decoding via libcelt [no]
 ;;   --enable-libcdio         enable audio CD grabbing with libcdio
 ;;   --enable-libiec61883     enable iec61883 via libiec61883 [no]
 ;;   --enable-libilbc         enable iLBC de/encoding via libilbc [no]
 ;;   --enable-libmodplug      enable ModPlug via libmodplug [no]
-;;   --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
 ;;   --enable-libnut          enable NUT (de)muxing via libnut,
 ;;                            native (de)muxer exists [no]
 ;;   --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
 ;;   --enable-librtmp         enable RTMP[E] support via librtmp [no]
 ;;   --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
 ;;   --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
-;;   --enable-libsoxr         enable Include libsoxr resampling [no]
 ;;   --enable-libssh          enable SFTP protocol via libssh [no]
 ;;                            (libssh2 does not work)
 ;;   --enable-libstagefright-h264  enable H.264 decoding via libstagefright [no]
-;;   --enable-libtwolame      enable MP2 encoding via libtwolame [no]
 ;;   --enable-libutvideo      enable Ut Video encoding and decoding via libutvideo [no]
 ;;   --enable-libv4l2         enable libv4l2/v4l-utils [no]
 ;;   --enable-libvidstab      enable video stabilization using vid.stab [no]
                       "--enable-shared"
                       "--enable-fontconfig"
                       ;; "--enable-gnutls" ; causes test failures
+                      "--enable-libbluray"
                       "--enable-libfreetype"
+                      "--enable-libmp3lame"
                       "--enable-libopus"
+                      "--enable-libsoxr"
                       "--enable-libspeex"
                       "--enable-libtheora"
+                      "--enable-libtwolame"
                       "--enable-libvorbis"
                       "--enable-libvpx"
-                      ;; drop special machine instructions not supported
-                      ;; on all instances of the target
-                      ,@(if (string-prefix? "x86_64"
-                                            (or (%current-target-system)
-                                                (%current-system)))
-                            '()
-                            '("--disable-amd3dnow"
-                              "--disable-amd3dnowext"
-                              "--disable-mmx"
-                              "--disable-mmxext"
-                              "--disable-sse"
-                              "--disable-sse2"))
-                      "--disable-altivec"
-                      "--disable-sse3"
-                      "--disable-ssse3"
-                      "--disable-sse4"
-                      "--disable-sse42"
-                      "--disable-avx"
-                      "--disable-fma4"
-                      "--disable-avx2"
-                      "--disable-armv5te"
-                      "--disable-armv6"
-                      "--disable-armv6t2"
-                      "--disable-vfp"
-                      "--disable-neon"
-                      "--disable-vis"
+
+                      "--enable-runtime-cpudetect"
+
+                      ;; Runtime cpu detection is not implemented on
+                      ;; MIPS, so we disable some features.
                       "--disable-mips32r2"
                       "--disable-mipsdspr1"
                       "--disable-mipsdspr2"
         (lambda* (#:key outputs #:allow-other-keys)
           (let* ((out (assoc-ref outputs "out"))
                  (lib (string-append out "/lib")))
-            ;; Add LIB to the RUNPATH of all the executables.
+            ;; Add LIB to the RUNPATH of all the executables and libraries.
             (with-directory-excursion out
               (for-each (cut augment-rpath <> lib)
-                        (find-files "bin" ".*")))))
+                        (append (find-files "bin" ".*")
+                                (find-files "lib" "\\.so\\..*\\."))))))
           %standard-phases))))
     (home-page "http://www.ffmpeg.org/")
     (synopsis "Audio and video framework")
@@ -215,10 +274,22 @@ convert and stream audio and video.  It includes the libavcodec
 audio/video codec library.")
     (license gpl2+)))
 
+;; We need this older ffmpeg because vlc-2.1.5 doesn't work with ffmpeg-2.4.
+(define-public ffmpeg-2.2
+  (package (inherit ffmpeg)
+    (version "2.2.13")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "http://www.ffmpeg.org/releases/ffmpeg-"
+                                 version ".tar.bz2"))
+             (sha256
+              (base32
+               "1vva8ffwxi3rg44byy09qlbiqrrd1h4rmsl5b1mbmvzvwl1lq1l0"))))))
+
 (define-public vlc
   (package
     (name "vlc")
-    (version "2.1.4")
+    (version "2.2.0")
     (source (origin
              (method url-fetch)
              (uri (string-append
@@ -226,7 +297,7 @@ audio/video codec library.")
                    version "/vlc-" version ".tar.xz"))
              (sha256
               (base32
-               "1lymhbb2bns73qivdaqanhggjjhyc9fwfgf5ikhng0a74msnqmiy"))))
+               "05smn9hqdp7iscc1dj4cxp1mrlad7b50lhlnlqisfzf493i2f2jy"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("git" ,git) ; needed for a test
@@ -237,7 +308,7 @@ audio/video codec library.")
        ("avahi" ,avahi)
        ("dbus" ,dbus)
        ("flac" ,flac)
-       ("ffmpeg" ,ffmpeg)
+       ("ffmpeg" ,ffmpeg-2.2)     ; FIXME: vlc-2.1.5 won't work with ffmpeg-2.4
        ("fontconfig" ,fontconfig)
        ("freetype" ,freetype)
        ("gnutls" ,gnutls)
@@ -269,10 +340,6 @@ audio/video codec library.")
     (arguments
      `(#:configure-flags
        `("--disable-a52" ; FIXME: reenable once available
-         "--disable-mmx" ; FIXME: may be enabled on x86_64
-         "--disable-sse" ; 1-4, no separate options available
-         "--disable-neon"
-         "--disable-altivec"
          ,(string-append "LDFLAGS=-Wl,-rpath -Wl,"
                          (assoc-ref %build-inputs "ffmpeg")
                          "/lib")))) ; needed for the tests
@@ -343,20 +410,18 @@ treaming protocols.")
                                      libx11 "/include") ; to detect libx11
                       "--disable-tremor-internal" ; forces external libvorbis
                       (string-append "--prefix=" out)
-                      ;; drop special machine instructions not supported
-                      ;; on all instances of the target
-                      ,@(if (string-prefix? "x86_64"
-                                            (or (%current-target-system)
-                                                (%current-system)))
-                            '()
-                            '("--disable-3dnow"
-                              "--disable-3dnowext"
-                              "--disable-mmx"
-                              "--disable-mmxext"
-                              "--disable-sse"
-                              "--disable-sse2"))
-                      "--disable-ssse3"
-                      "--disable-altivec"
+                      ;; Enable runtime cpu detection where supported,
+                      ;; and choose a suitable target.
+                      ,@(match (or (%current-target-system)
+                                   (%current-system))
+                          ("x86_64-linux"
+                           '("--enable-runtime-cpudetection"
+                             "--target=x86_64-linux"))
+                          ("i686-linux"
+                           '("--enable-runtime-cpudetection"
+                             "--target=i686-linux"))
+                          ("mips64el-linux"
+                           '("--target=mips3-linux")))
                       "--disable-armv5te"
                       "--disable-armv6"
                       "--disable-armv6t2"
@@ -383,10 +448,14 @@ SVCD, DVD, 3ivx, DivX 3/4/5, WMV and H.264 movies.")
                                   version ".tar.bz2"))
               (sha256
                (base32
-                "1aai0h0z1bhp89pxmg4fkrwpmqq24k39fhr15cw6q77m9bccip6k"))))
+                "1aai0h0z1bhp89pxmg4fkrwpmqq24k39fhr15cw6q77m9bccip6k"))
+              (patches
+               (list (search-patch "libvpx-vp9-out-of-bounds-access.patch")
+                     (search-patch "libvpx-fix-ssse3-quantize.patch")
+                     (search-patch "libvpx-fix-armhf-link.patch")))))
     (build-system gnu-build-system)
     (arguments
-     '(#:phases (alist-replace
+     `(#:phases (alist-replace
                  'configure
                  (lambda* (#:key outputs #:allow-other-keys)
                    (setenv "CONFIG_SHELL" (which "bash"))
@@ -394,6 +463,23 @@ SVCD, DVD, 3ivx, DivX 3/4/5, WMV and H.264 movies.")
                      (zero? (system* "./configure"
                                      "--enable-shared"
                                      "--as=yasm"
+                                     ,@(if (and (not (%current-target-system))
+                                                (string-prefix?
+                                                 "armhf-"
+                                                 (%current-system)))
+                                           ;; When building on ARMv7, libvpx
+                                           ;; assumes that NEON will be
+                                           ;; available.  On Guix, armhf
+                                           ;; does not require NEON, so we
+                                           ;; build for ARMv6 and -marm (since
+                                           ;; no thumb2 on ARMv6) to ensure
+                                           ;; compatibility with all ARMv7
+                                           ;; cores we support.  Based on
+                                           ;; the Debian libvpx package.
+                                           '("--target=armv6-linux-gcc"
+                                             "--extra-cflags=-marm"
+                                             "--enable-small")
+                                           '())
                                      (string-append "--prefix=" out)))))
                  %standard-phases)
        #:tests? #f)) ; no check target
@@ -408,7 +494,7 @@ SVCD, DVD, 3ivx, DivX 3/4/5, WMV and H.264 movies.")
 (define-public youtube-dl
   (package
     (name "youtube-dl")
-    (version "2014.06.26")
+    (version "2015.01.23.4")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://youtube-dl.org/downloads/"
@@ -416,7 +502,7 @@ SVCD, DVD, 3ivx, DivX 3/4/5, WMV and H.264 movies.")
                                   version ".tar.gz"))
               (sha256
                (base32
-                "0jl90plg9mz4mwich219a58y4npwi33myx0cx44v8pymkqykv5cd"))))
+                "0pvvab9dk1righ3fa79000iz8fzdlcxakscx5sd31730c37j3kj2"))))
     (build-system python-build-system)
     (inputs `(("setuptools" ,python-setuptools)))
     (home-page "http://youtube-dl.org")
@@ -425,3 +511,358 @@ SVCD, DVD, 3ivx, DivX 3/4/5, WMV and H.264 movies.")
      "youtube-dl is a small command-line program to download videos from
 YouTube.com and a few more sites.")
     (license public-domain)))
+
+(define-public libbluray
+  (package
+    (name "libbluray")
+    (version "0.7.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.videolan.org/videolan/"
+                                  name "/" version "/"
+                                  name "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "13dngs4b4cv29f6b825dq14n77mfhvk1kjb42axpq494pfgyp6zp"))))
+    (build-system gnu-build-system)
+    (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("doxygen" ,doxygen)
+       ("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("libxml2" ,libxml2)
+       ("perl" ,perl)                   ;for doxygen
+       ("texlive" ,texlive)))
+    (home-page "http://www.videolan.org/developers/libbluray.html")
+    (synopsis "Blu-Ray Disc playback library")
+    (description
+     "libbluray is a library designed for Blu-Ray Disc playback for media
+players, like VLC or MPlayer.")
+    (license lgpl2.1+)))
+
+(define-public libdvdread
+  (package
+    (name "libdvdread")
+    (version "5.0.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.videolan.org/videolan/"
+                                  name "/" version "/"
+                                  name "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "052z62l3x8ka5jpf5bi1mzp5p323n1z9rxj74nq5c35a88x1myv6"))))
+    (build-system gnu-build-system)
+    (home-page "http://dvdnav.mplayerhq.hu/")
+    (synopsis "Library for reading video DVDs")
+    (description
+     "Libdvdread provides a simple foundation for reading DVD video
+disks.  It provides the functionality that is required to access many
+DVDs.  It parses IFO files, reads NAV-blocks, and performs CSS
+authentication and descrambling (if an external libdvdcss library is
+installed).")
+    (license gpl2+)))
+
+(define-public libdvdnav
+  (package
+    (name "libdvdnav")
+    (version "5.0.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.videolan.org/videolan/"
+                                  name "/" version "/"
+                                  name "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "1ad2lkkiydgwiyqfysra9lkwjv9yqnvcg4hv92hx8qzics1cpcbj"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("libdvdread" ,libdvdread)))
+    (home-page "http://dvdnav.mplayerhq.hu/")
+    (synopsis "Library for video DVD navigation features")
+    (description
+     "Libdvdnav is a library for developers of multimedia
+applications.  It allows easy use of sophisticated DVD navigation features
+such as DVD menus, multiangle playback and even interactive DVD games.  All
+this functionality is provided through a simple API which provides the DVD
+playback as a single logical stream of blocks, intermitted by special
+dvdnav events to report certain conditions.  The main usage of libdvdnav is
+a loop regularly calling a function to get the next block, surrounded by
+additional calls to tell the library of user interaction.  The whole
+DVD virtual machine and internal playback states are completely
+encapsulated.")
+    (license gpl2+)))
+
+(define-public libdvdnav-4
+  (package
+    (inherit libdvdnav)
+    (version "4.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri
+               (string-append
+                "http://download.videolan.org/videolan/libdvdnav/libdvdnav-"
+                version ".tar.xz"))
+              (sha256
+               (base32
+                "0wi3gy408c8xj0ism0hckv5jbfh3lg4pmgxv87gbch9jrhp2gjkz"))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)))
+    (arguments
+     '(#:phases
+       (alist-cons-after
+        'unpack 'autoreconf
+        (lambda _
+          (zero? (system* "autoreconf" "-vif")))
+        %standard-phases)))))
+
+(define-public libdvdcss
+  (package
+    (name "libdvdcss")
+    (version "1.3.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://download.videolan.org/videolan/"
+                                  name "/" version "/"
+                                  name "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "158k9zagmbk5bkbz96l6lwhh7xcgfcnzflkr4vblskhcab6llhbw"))))
+    (build-system gnu-build-system)
+    (home-page "http://www.videolan.org/developers/libdvdcss.html")
+    (synopsis "Library for accessing DVDs as block devices")
+    (description
+     "libdvdcss is a simple library designed for accessing DVDs like a block
+device without having to bother about the decryption.")
+    (license gpl2+)))
+
+(define-public srt2vtt
+  (package
+    (name "srt2vtt")
+    (version "0.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://dthompson.us/releases/srt2vtt/srt2vtt-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "16b377znjm6qlga5yb8aj7b7bcisa1ghcnj2lrb1d30lvxp4liif"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("guile" ,guile-2.0)))
+    (synopsis "SubRip to WebVTT subtitle converter")
+    (description "srt2vtt converts SubRip formatted subtitles to WebVTT format
+for use with HTML5 video.")
+    (home-page "http://dthompson.us/pages/software/srt2vtt")
+    (license gpl3+)))
+
+(define-public avidemux
+  (package
+    (name "avidemux")
+    (version "2.6.8")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append
+                   "mirror://sourceforge/avidemux/avidemux_"
+                   version ".tar.gz"))
+             (sha256
+              (base32
+               "10p60wjkzf1bxqcb6i7bx4hbqy3vqg598p3l9lc4v2c9b8iqr682"))))
+    (build-system cmake-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    ;; FIXME: Once packaged, add libraries not found during the build.
+    (inputs
+     `(("alsa-lib" ,alsa-lib)
+       ("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("fribidi" ,fribidi)
+       ("glu" ,glu)
+       ("gtk+" ,gtk+)
+       ("jack" ,jack-1)
+       ("lame" ,lame)
+       ("libvorbis" ,libvorbis)
+       ("libvpx" ,libvpx)
+       ("libxv" ,libxv)
+       ("perl" ,perl)
+       ("pulseaudio" ,pulseaudio)
+       ("python" ,python-wrapper)
+       ("qt" ,qt-4)
+       ("sdl" ,sdl)
+       ("sqlite" ,sqlite)
+       ("yasm" ,yasm)
+       ("zlib" ,zlib)))
+    (arguments
+     `(#:tests? #f ; no check target
+       #:phases
+       ;; Make sure files inside the included ffmpeg tarball are
+       ;; patch-shebanged.
+       (alist-cons-before
+        'patch-source-shebangs 'unpack-ffmpeg
+        (lambda _
+          (with-directory-excursion "avidemux_core/ffmpeg_package"
+            (system* "tar" "xf" "ffmpeg-1.2.1.tar.bz2")
+            (delete-file "ffmpeg-1.2.1.tar.bz2")))
+        (alist-cons-after
+         'patch-source-shebangs 'repack-ffmpeg
+         (lambda _
+           (with-directory-excursion "avidemux_core/ffmpeg_package"
+             (substitute* "ffmpeg-1.2.1/configure"
+               (("#! /bin/sh") (string-append "#!" (which "bash"))))
+             (system* "tar" "cjf" "ffmpeg-1.2.1.tar.bz2" "ffmpeg-1.2.1")
+             (delete-file-recursively "ffmpeg-1.2.1")))
+         (alist-replace 'configure
+          (lambda _
+            ;; Copy-paste settings from the cmake build system.
+            (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
+            (setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH")))
+          (alist-replace 'build
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let*
+                ((out (assoc-ref outputs "out"))
+                 (lib (string-append out "/lib64"))
+                 (top (getcwd))
+                 (sdl (assoc-ref inputs "sdl"))
+                 (build_component
+                   (lambda* (component srcdir #:optional (args '()))
+                     (let ((builddir (string-append "build_" component)))
+                       (mkdir builddir)
+                       (with-directory-excursion builddir
+                        (zero? (and
+                          (apply system* "cmake"
+                                 "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
+                                 (string-append "-DCMAKE_INSTALL_PREFIX=" out)
+                                 (string-append "-DCMAKE_INSTALL_RPATH=" lib)
+                                 (string-append "-DAVIDEMUX_SOURCE_DIR=" top)
+                                 (string-append "-DSDL_INCLUDE_DIR="
+                                                sdl "/include/SDL")
+                                 (string-append "../" srcdir)
+                                 args)
+                          (system* "make" "-j"
+                                   (number->string (parallel-job-count)))
+                          (system* "make" "install"))))))))
+                (mkdir out)
+                (and (build_component "core" "avidemux_core")
+                     (build_component "cli" "avidemux/cli")
+                     (build_component "qt4" "avidemux/qt4")
+                     (build_component "gtk" "avidemux/gtk")
+                     (build_component "plugins_common" "avidemux_plugins"
+                                     '("-DPLUGIN_UI=COMMON"))
+                     (build_component "plugins_cli" "avidemux_plugins"
+                                     '("-DPLUGIN_UI=CLI"))
+                     (build_component "plugins_qt4" "avidemux_plugins"
+                                     '("-DPLUGIN_UI=QT4"))
+                     (build_component "plugins_gtk" "avidemux_plugins"
+                                     '("-DPLUGIN_UI=GTK"))
+                     (build_component "plugins_settings" "avidemux_plugins"
+                                     '("-DPLUGIN_UI=SETTINGS")))
+                ;; Remove .exe and .dll file.
+                (delete-file-recursively
+                  (string-append out "/share/ADM6_addons"))))
+            (alist-delete 'install
+               %standard-phases)))))))
+    (home-page "http://fixounet.free.fr/avidemux/")
+    (synopsis "Video editor")
+    (description "Avidemux is a video editor designed for simple cutting,
+filtering and encoding tasks.  It supports many file types, including AVI,
+DVD compatible MPEG files, MP4 and ASF, using a variety of codecs.  Tasks
+can be automated using projects, job queue and powerful scripting
+capabilities.")
+    ;; Software with various licenses is included, see License.txt.
+    (license gpl2+)))
+
+(define-public avidemux-2.5
+  (package (inherit avidemux)
+    (version "2.5.6")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append
+                   "mirror://sourceforge/avidemux/avidemux_"
+                   version ".tar.gz"))
+             (sha256
+              (base32
+               "12wvxz0n2g85f079d8mdkkp2zm279d34m9v7qgcqndh48cn7znnn"))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("alsa-lib" ,alsa-lib)
+       ("gettext" ,gnu-gettext)
+       ("gtk+" ,gtk+-2)
+       ("jack" ,jack-1)
+       ("lame" ,lame)
+       ("libvorbis" ,libvorbis)
+       ("libvpx" ,libvpx)
+       ("libxml2" ,libxml2)
+       ("libxslt" ,libxslt)
+       ("libxv" ,libxv)
+       ("perl" ,perl)
+       ("pulseaudio" ,pulseaudio)
+       ("qt" ,qt-4)
+       ("sdl" ,sdl)
+       ("yasm" ,yasm)
+       ("zlib" ,zlib)))
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (alist-cons-before
+        'patch-source-shebangs 'unpack-ffmpeg
+        (lambda _
+          (with-directory-excursion "avidemux/ADM_libraries"
+            (system* "tar" "xf" "ffmpeg-0.9.tar.bz2")
+            (delete-file "ffmpeg-0.9.tar.bz2")))
+        (alist-cons-after
+         'patch-source-shebangs 'repack-ffmpeg
+         (lambda _
+           (with-directory-excursion "avidemux/ADM_libraries"
+             (substitute* "ffmpeg-0.9/configure"
+               (("#! /bin/sh") (string-append "#!" (which "bash"))))
+             (system* "tar" "cjf" "ffmpeg-0.9.tar.bz2" "ffmpeg-0.9")
+             (delete-file-recursively "ffmpeg-0.9")))
+         (alist-replace 'configure
+          (lambda _
+            (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
+            (setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH")))
+          (alist-replace 'build
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let*
+                ((out (assoc-ref outputs "out"))
+                 (lib (string-append out "/lib"))
+                 (top (getcwd))
+                 (sdl (assoc-ref inputs "sdl"))
+                 (build_component
+                   (lambda* (component srcdir)
+                     (let ((builddir (string-append "build_" component)))
+                       (mkdir builddir)
+                       (with-directory-excursion builddir
+                        (zero? (and
+                          (system* "cmake"
+                                   "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
+                                   (string-append "-DCMAKE_INSTALL_PREFIX="
+                                                  out)
+                                   (string-append "-DCMAKE_INSTALL_RPATH="
+                                                  lib)
+                                   (string-append "-DAVIDEMUX_SOURCE_DIR="
+                                                  top)
+                                   (string-append "-DAVIDEMUX_CORECONFIG_DIR="
+                                                  top "/build_main/config")
+                                   (string-append "-DAVIDEMUX_INSTALL_PREFIX="
+                                                  out)
+                                   (string-append "-DSDL_INCLUDE_DIR="
+                                                  sdl "/include/SDL")
+                                   (string-append "../" srcdir))
+                          (system* "make" "-j"
+                                   (number->string (parallel-job-count)))
+                          (system* "make" "install"))))))))
+                (mkdir out)
+                (and (build_component "main" ".")
+                     (build_component "plugins" "plugins"))
+                (delete-file-recursively
+                  (string-append out "/share/ADM_addons"))))
+            (alist-delete 'install
+               %standard-phases)))))))))