1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org>
4 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages video)
22 #:use-module (ice-9 match)
23 #:use-module ((guix licenses)
24 #:select (gpl2 gpl2+ gpl3+ bsd-3 public-domain))
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system python)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages algebra)
31 #:use-module (gnu packages avahi)
32 #:use-module (gnu packages cdrom)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages zip)
35 #:use-module (gnu packages elf)
36 #:use-module (gnu packages fontutils)
37 #:use-module (gnu packages gl)
38 #:use-module (gnu packages glib)
39 #:use-module (gnu packages guile)
40 #:use-module (gnu packages gnupg)
41 #:use-module (gnu packages gnutls)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages linux)
44 #:use-module (gnu packages lua)
45 #:use-module (gnu packages mp3)
46 #:use-module (gnu packages openssl)
47 #:use-module (gnu packages perl)
48 #:use-module (gnu packages pkg-config)
49 #:use-module (gnu packages pulseaudio)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages qt)
52 #:use-module (gnu packages sdl)
53 #:use-module (gnu packages ssh)
54 #:use-module (gnu packages version-control)
55 #:use-module (gnu packages xiph)
56 #:use-module (gnu packages xml)
57 #:use-module (gnu packages xorg)
58 #:use-module (gnu packages yasm))
66 (uri (string-append "http://www.ffmpeg.org/releases/ffmpeg-"
70 "11m2hbhdgphjxjp6hk438cxmipqjg5ixbr1kqnn9mbdhq9kc34fc"))))
71 (build-system gnu-build-system)
73 `(("fontconfig" ,fontconfig)
74 ("freetype" ,freetype)
77 ("libtheora" ,libtheora)
78 ("libvorbis" ,libvorbis)
80 ("patchelf" ,patchelf)
87 ("pkg-config" ,pkg-config)
88 ("python" ,python-2) ; scripts use interpreter python2
92 `(#:test-target "fate"
93 #:modules ((guix build gnu-build-system)
97 #:imported-modules ((guix build gnu-build-system)
103 ;; configure does not work followed by "SHELL=..." and
104 ;; "CONFIG_SHELL=..."; set environment variables instead
105 (lambda* (#:key outputs configure-flags #:allow-other-keys)
106 (let ((out (assoc-ref outputs "out")))
107 (substitute* "configure"
108 (("#! /bin/sh") (string-append "#!" (which "bash"))))
109 (setenv "SHELL" (which "bash"))
110 (setenv "CONFIG_SHELL" (which "bash"))
111 ;; possible additional inputs:
112 ;; --enable-avisynth enable reading of AviSynth script files [no]
113 ;; --enable-frei0r enable frei0r video filtering
114 ;; --enable-ladspa enable LADSPA audio filtering
115 ;; --enable-libaacplus enable AAC+ encoding via libaacplus [no]
116 ;; --enable-libass enable libass subtitles rendering [no]
117 ;; --enable-libbluray enable BluRay reading using libbluray [no]
118 ;; --enable-libcaca enable textual display using libcaca
119 ;; --enable-libcelt enable CELT decoding via libcelt [no]
120 ;; --enable-libcdio enable audio CD grabbing with libcdio
121 ;; --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
122 ;; and libraw1394 [no]
123 ;; --enable-libfaac enable AAC encoding via libfaac [no]
124 ;; --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
125 ;; --enable-libflite enable flite (voice synthesis) support via libflite [no]
126 ;; --enable-libgme enable Game Music Emu via libgme [no]
127 ;; --enable-libgsm enable GSM de/encoding via libgsm [no]
128 ;; --enable-libiec61883 enable iec61883 via libiec61883 [no]
129 ;; --enable-libilbc enable iLBC de/encoding via libilbc [no]
130 ;; --enable-libmodplug enable ModPlug via libmodplug [no]
131 ;; --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
132 ;; --enable-libnut enable NUT (de)muxing via libnut,
133 ;; native (de)muxer exists [no]
134 ;; --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
135 ;; --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
136 ;; --enable-libopencv enable video filtering via libopencv [no]
137 ;; --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
138 ;; --enable-libpulse enable Pulseaudio input via libpulse [no]
139 ;; --enable-libquvi enable quvi input via libquvi [no]
140 ;; --enable-librtmp enable RTMP[E] support via librtmp [no]
141 ;; --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
142 ;; --enable-libshine enable fixed-point MP3 encoding via libshine [no]
143 ;; --enable-libsoxr enable Include libsoxr resampling [no]
144 ;; --enable-libssh enable SFTP protocol via libssh [no]
145 ;; (libssh2 does not work)
146 ;; --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
147 ;; --enable-libtwolame enable MP2 encoding via libtwolame [no]
148 ;; --enable-libutvideo enable Ut Video encoding and decoding via libutvideo [no]
149 ;; --enable-libv4l2 enable libv4l2/v4l-utils [no]
150 ;; --enable-libvidstab enable video stabilization using vid.stab [no]
151 ;; --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
152 ;; --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
153 ;; --enable-libwavpack enable wavpack encoding via libwavpack [no]
154 ;; --enable-libx264 enable H.264 encoding via x264 [no]
155 ;; --enable-libxavs enable AVS encoding via xavs [no]
156 ;; --enable-libxvid enable Xvid encoding via xvidcore,
157 ;; native MPEG-4/Xvid encoder exists [no]
158 ;; --enable-libzmq enable message passing via libzmq [no]
159 ;; --enable-libzvbi enable teletext support via libzvbi [no]
160 ;; --enable-openal enable OpenAL 1.1 capture support [no]
161 ;; --enable-opencl enable OpenCL code
162 ;; --enable-x11grab enable X11 grabbing [no]
165 (string-append "--prefix=" out)
166 "--enable-gpl" ; enable optional gpl licensed parts
168 "--enable-fontconfig"
169 ;; "--enable-gnutls" ; causes test failures
170 "--enable-libfreetype"
171 "--enable-libmp3lame"
178 "--enable-runtime-cpudetect"
180 ;; Runtime cpu detection is not implemented on
181 ;; MIPS, so we disable some features.
183 "--disable-mipsdspr1"
184 "--disable-mipsdspr2"
185 "--disable-mipsfpu"))))
187 'strip 'add-lib-to-runpath
188 (lambda* (#:key outputs #:allow-other-keys)
189 (let* ((out (assoc-ref outputs "out"))
190 (lib (string-append out "/lib")))
191 ;; Add LIB to the RUNPATH of all the executables and libraries.
192 (with-directory-excursion out
193 (for-each (cut augment-rpath <> lib)
194 (append (find-files "bin" ".*")
195 (find-files "lib" "\\.so\\..*\\."))))))
197 (home-page "http://www.ffmpeg.org/")
198 (synopsis "Audio and video framework")
199 (description "FFmpeg is a complete, cross-platform solution to record,
200 convert and stream audio and video. It includes the libavcodec
201 audio/video codec library.")
204 ;; We need this older ffmpeg because vlc-2.1.5 doesn't work with ffmpeg-2.4.
205 (define-public ffmpeg-2.2
206 (package (inherit ffmpeg)
210 (uri (string-append "http://www.ffmpeg.org/releases/ffmpeg-"
214 "06sli7xvihh97ss6a2mkdq4dcj3rg1w8zffrmjfc1hvyjxhc8f2r"))))))
223 "http://download.videolan.org/pub/videolan/vlc/"
224 version "/vlc-" version ".tar.xz"))
227 "0whzbn7ahn5maarcwl1yhk9lq10b0q0y9w5pjl9kh3frdjmncrbg"))))
228 (build-system gnu-build-system)
230 `(("git" ,git) ; needed for a test
231 ("pkg-config" ,pkg-config)))
232 ;; FIXME: Add optional inputs once available.
234 `(("alsa-lib" ,alsa-lib)
238 ("ffmpeg" ,ffmpeg-2.2) ; FIXME: vlc-2.1.5 won't work with ffmpeg-2.4
239 ("fontconfig" ,fontconfig)
240 ("freetype" ,freetype)
243 ("libgcrypt" ,libgcrypt)
248 ("libsamplerate" ,libsamplerate)
250 ("libvorbis" ,libvorbis)
251 ("libtheora" ,libtheora)
253 ("libxinerama" ,libxinerama)
260 ("pulseaudio" ,pulseaudio)
261 ("python" ,python-wrapper)
264 ("sdl-image" ,sdl-image)
266 ("xcb-util-keysyms" ,xcb-util-keysyms)))
269 `("--disable-a52" ; FIXME: reenable once available
270 ,(string-append "LDFLAGS=-Wl,-rpath -Wl,"
271 (assoc-ref %build-inputs "ffmpeg")
272 "/lib")))) ; needed for the tests
273 (home-page "https://www.videolan.org/")
274 (synopsis "Audio and video framework")
275 (description "VLC is a cross-platform multimedia player and framework
276 that plays most multimedia files as well as DVD, Audio CD, VCD, and various
277 treaming protocols.")
280 (define-public mplayer
287 "http://www.mplayerhq.hu/MPlayer/releases/MPlayer-"
291 "0xlcg7rszrwmw29wqr0plsw5d1rq0hb7vjsq7bmmfsly2z1wg3yf"))))
292 (build-system gnu-build-system)
293 ;; FIXME: Add additional inputs once available.
295 `(("pkg-config" ,pkg-config)))
297 `(("alsa-lib" ,alsa-lib)
298 ("cdparanoia" ,cdparanoia)
299 ("fontconfig" ,fontconfig)
300 ("freetype" ,freetype)
302 ("libmpg123" ,mpg123) ; audio codec for MP3
303 ;; ("giflib" ,giflib) ; uses QuantizeBuffer, requires version >= 5
306 ("libtheora" ,libtheora)
307 ("libvorbis" ,libvorbis)
309 ("libxxf86dga" ,libxxf86dga)
310 ("libxinerama" ,libxinerama)
314 ("pulseaudio" ,pulseaudio)
315 ("python" ,python-wrapper)
321 `(#:tests? #f ; no test target
325 ;; configure does not work followed by "SHELL=..." and
326 ;; "CONFIG_SHELL=..."; set environment variables instead
327 (lambda* (#:key inputs outputs #:allow-other-keys)
328 (let ((out (assoc-ref outputs "out"))
329 (libx11 (assoc-ref inputs "libx11")))
330 (substitute* "configure"
331 (("#! /bin/sh") (string-append "#!" (which "bash"))))
332 (setenv "SHELL" (which "bash"))
333 (setenv "CONFIG_SHELL" (which "bash"))
336 (string-append "--extra-cflags=-I"
337 libx11 "/include") ; to detect libx11
338 "--disable-tremor-internal" ; forces external libvorbis
339 (string-append "--prefix=" out)
340 ;; Enable runtime cpu detection where supported,
341 ;; and choose a suitable target.
342 ,@(match (or (%current-target-system)
345 '("--enable-runtime-cpudetection"
346 "--target=x86_64-linux"))
348 '("--enable-runtime-cpudetection"
349 "--target=i686-linux"))
351 '("--target=mips3-linux")))
358 "--disable-iwmmxt"))))
360 (home-page "http://www.mplayerhq.hu/design7/news.html")
361 (synopsis "Audio and video player")
362 (description "MPlayer is a movie player. It plays most MPEG/VOB, AVI,
363 Ogg/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, RealMedia, Matroska, NUT,
364 NuppelVideo, FLI, YUV4MPEG, FILM, RoQ, PVA files. One can watch VideoCD,
365 SVCD, DVD, 3ivx, DivX 3/4/5, WMV and H.264 movies.")
368 (define-public libvpx
374 (uri (string-append "http://webm.googlecode.com/files/libvpx-v"
378 "1aai0h0z1bhp89pxmg4fkrwpmqq24k39fhr15cw6q77m9bccip6k"))
380 (list (search-patch "libvpx-vp9-out-of-bounds-access.patch")
381 (search-patch "libvpx-fix-ssse3-quantize.patch")
382 (search-patch "libvpx-fix-armhf-link.patch")))))
383 (build-system gnu-build-system)
385 `(#:phases (alist-replace
387 (lambda* (#:key outputs #:allow-other-keys)
388 (setenv "CONFIG_SHELL" (which "bash"))
389 (let ((out (assoc-ref outputs "out")))
390 (zero? (system* "./configure"
393 ,@(if (and (not (%current-target-system))
397 ;; When building on ARMv7, libvpx
398 ;; assumes that NEON will be
399 ;; available. On Guix, armhf
400 ;; does not require NEON, so we
401 ;; build for ARMv6 and -marm (since
402 ;; no thumb2 on ARMv6) to ensure
403 ;; compatibility with all ARMv7
404 ;; cores we support. Based on
405 ;; the Debian libvpx package.
406 '("--target=armv6-linux-gcc"
407 "--extra-cflags=-marm"
410 (string-append "--prefix=" out)))))
412 #:tests? #f)) ; no check target
416 (synopsis "VP8/VP9 video codec")
417 (description "libvpx is a codec for the VP8/VP9 video compression format.")
419 (home-page "http://www.webmproject.org/")))
421 (define-public youtube-dl
424 (version "2015.01.23.4")
427 (uri (string-append "http://youtube-dl.org/downloads/"
428 version "/youtube-dl-"
432 "0pvvab9dk1righ3fa79000iz8fzdlcxakscx5sd31730c37j3kj2"))))
433 (build-system python-build-system)
434 (inputs `(("setuptools" ,python-setuptools)))
435 (home-page "http://youtube-dl.org")
436 (synopsis "Download videos from YouTube.com and other sites")
438 "youtube-dl is a small command-line program to download videos from
439 YouTube.com and a few more sites.")
440 (license public-domain)))
442 (define-public libdvdread
448 (uri (string-append "http://download.videolan.org/videolan/"
450 name "-" version ".tar.bz2"))
453 "052z62l3x8ka5jpf5bi1mzp5p323n1z9rxj74nq5c35a88x1myv6"))))
454 (build-system gnu-build-system)
455 (home-page "http://dvdnav.mplayerhq.hu/")
456 (synopsis "Library for reading video DVDs")
458 "Libdvdread provides a simple foundation for reading DVD video
459 disks. It provides the functionality that is required to access many
460 DVDs. It parses IFO files, reads NAV-blocks, and performs CSS
461 authentication and descrambling (if an external libdvdcss library is
465 (define-public libdvdnav
471 (uri (string-append "http://download.videolan.org/videolan/"
473 name "-" version ".tar.bz2"))
476 "1ad2lkkiydgwiyqfysra9lkwjv9yqnvcg4hv92hx8qzics1cpcbj"))))
477 (build-system gnu-build-system)
479 `(("pkg-config" ,pkg-config)))
481 `(("libdvdread" ,libdvdread)))
482 (home-page "http://dvdnav.mplayerhq.hu/")
483 (synopsis "Library for video DVD navigation features")
485 "Libdvdnav is a library for developers of multimedia
486 applications. It allows easy use of sophisticated DVD navigation features
487 such as DVD menus, multiangle playback and even interactive DVD games. All
488 this functionality is provided through a simple API which provides the DVD
489 playback as a single logical stream of blocks, intermitted by special
490 dvdnav events to report certain conditions. The main usage of libdvdnav is
491 a loop regularly calling a function to get the next block, surrounded by
492 additional calls to tell the library of user interaction. The whole
493 DVD virtual machine and internal playback states are completely
497 (define-public srt2vtt
504 "http://dthompson.us/releases/srt2vtt/srt2vtt-"
508 "16b377znjm6qlga5yb8aj7b7bcisa1ghcnj2lrb1d30lvxp4liif"))))
509 (build-system gnu-build-system)
511 `(("guile" ,guile-2.0)))
512 (synopsis "SubRip to WebVTT subtitle converter")
513 (description "srt2vtt converts SubRip formatted subtitles to WebVTT format
514 for use with HTML5 video.")
515 (home-page "http://dthompson.us/pages/software/srt2vtt")