Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / video.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 David Thompson <davet@gnu.org>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages video)
21 #:use-module ((guix licenses)
22 #:select (gpl2 gpl2+ bsd-3 public-domain))
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system python)
27 #:use-module (gnu packages algebra)
28 #:use-module (gnu packages avahi)
29 #:use-module (gnu packages cdrom)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages zip)
32 #:use-module (gnu packages elf)
33 #:use-module (gnu packages fontutils)
34 #:use-module (gnu packages gl)
35 #:use-module (gnu packages glib)
36 #:use-module (gnu packages gnupg)
37 #:use-module (gnu packages gnutls)
38 #:use-module (gnu packages image)
39 #:use-module (gnu packages linux)
40 #:use-module (gnu packages lua)
41 #:use-module (gnu packages mp3)
42 #:use-module (gnu packages openssl)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages pulseaudio)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages qt)
48 #:use-module (gnu packages sdl)
49 #:use-module (gnu packages ssh)
50 #:use-module (gnu packages version-control)
51 #:use-module (gnu packages xiph)
52 #:use-module (gnu packages xml)
53 #:use-module (gnu packages xorg)
54 #:use-module (gnu packages yasm))
55
56 (define-public ffmpeg
57 (package
58 (name "ffmpeg")
59 (version "2.3")
60 (source (origin
61 (method url-fetch)
62 (uri (string-append "http://www.ffmpeg.org/releases/ffmpeg-"
63 version ".tar.bz2"))
64 (sha256
65 (base32
66 "17l0bx95al6cjhz3pzfcbwg07sbfbwqbxg34zl5lhl89w9jbngbb"))))
67 (build-system gnu-build-system)
68 (inputs
69 `(("fontconfig" ,fontconfig)
70 ("freetype" ,freetype)
71 ("opus" ,opus)
72 ("libtheora" ,libtheora)
73 ("libvorbis" ,libvorbis)
74 ("libvpx" ,libvpx)
75 ("patchelf" ,patchelf)
76 ("speex" ,speex)
77 ("zlib", zlib)))
78 (native-inputs
79 `(("bc" ,bc)
80 ("bzip2" ,bzip2)
81 ("perl" ,perl)
82 ("pkg-config" ,pkg-config)
83 ("python" ,python-2) ; scripts use interpreter python2
84 ("speex" ,speex)
85 ("yasm" ,yasm)))
86 (arguments
87 `(#:test-target "fate"
88 #:modules ((guix build gnu-build-system)
89 (guix build utils)
90 (guix build rpath)
91 (srfi srfi-26))
92 #:imported-modules ((guix build gnu-build-system)
93 (guix build utils)
94 (guix build rpath))
95 #:phases
96 (alist-replace
97 'configure
98 ;; configure does not work followed by "SHELL=..." and
99 ;; "CONFIG_SHELL=..."; set environment variables instead
100 (lambda* (#:key outputs configure-flags #:allow-other-keys)
101 (let ((out (assoc-ref outputs "out")))
102 (substitute* "configure"
103 (("#! /bin/sh") (string-append "#!" (which "bash"))))
104 (setenv "SHELL" (which "bash"))
105 (setenv "CONFIG_SHELL" (which "bash"))
106 ;; possible additional inputs:
107 ;; --enable-avisynth enable reading of AviSynth script files [no]
108 ;; --enable-frei0r enable frei0r video filtering
109 ;; --enable-ladspa enable LADSPA audio filtering
110 ;; --enable-libaacplus enable AAC+ encoding via libaacplus [no]
111 ;; --enable-libass enable libass subtitles rendering [no]
112 ;; --enable-libbluray enable BluRay reading using libbluray [no]
113 ;; --enable-libcaca enable textual display using libcaca
114 ;; --enable-libcelt enable CELT decoding via libcelt [no]
115 ;; --enable-libcdio enable audio CD grabbing with libcdio
116 ;; --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
117 ;; and libraw1394 [no]
118 ;; --enable-libfaac enable AAC encoding via libfaac [no]
119 ;; --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
120 ;; --enable-libflite enable flite (voice synthesis) support via libflite [no]
121 ;; --enable-libgme enable Game Music Emu via libgme [no]
122 ;; --enable-libgsm enable GSM de/encoding via libgsm [no]
123 ;; --enable-libiec61883 enable iec61883 via libiec61883 [no]
124 ;; --enable-libilbc enable iLBC de/encoding via libilbc [no]
125 ;; --enable-libmodplug enable ModPlug via libmodplug [no]
126 ;; --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
127 ;; --enable-libnut enable NUT (de)muxing via libnut,
128 ;; native (de)muxer exists [no]
129 ;; --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
130 ;; --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
131 ;; --enable-libopencv enable video filtering via libopencv [no]
132 ;; --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
133 ;; --enable-libpulse enable Pulseaudio input via libpulse [no]
134 ;; --enable-libquvi enable quvi input via libquvi [no]
135 ;; --enable-librtmp enable RTMP[E] support via librtmp [no]
136 ;; --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
137 ;; --enable-libshine enable fixed-point MP3 encoding via libshine [no]
138 ;; --enable-libsoxr enable Include libsoxr resampling [no]
139 ;; --enable-libssh enable SFTP protocol via libssh [no]
140 ;; (libssh2 does not work)
141 ;; --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
142 ;; --enable-libtwolame enable MP2 encoding via libtwolame [no]
143 ;; --enable-libutvideo enable Ut Video encoding and decoding via libutvideo [no]
144 ;; --enable-libv4l2 enable libv4l2/v4l-utils [no]
145 ;; --enable-libvidstab enable video stabilization using vid.stab [no]
146 ;; --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
147 ;; --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
148 ;; --enable-libwavpack enable wavpack encoding via libwavpack [no]
149 ;; --enable-libx264 enable H.264 encoding via x264 [no]
150 ;; --enable-libxavs enable AVS encoding via xavs [no]
151 ;; --enable-libxvid enable Xvid encoding via xvidcore,
152 ;; native MPEG-4/Xvid encoder exists [no]
153 ;; --enable-libzmq enable message passing via libzmq [no]
154 ;; --enable-libzvbi enable teletext support via libzvbi [no]
155 ;; --enable-openal enable OpenAL 1.1 capture support [no]
156 ;; --enable-opencl enable OpenCL code
157 ;; --enable-x11grab enable X11 grabbing [no]
158 (zero? (system*
159 "./configure"
160 (string-append "--prefix=" out)
161 "--enable-gpl" ; enable optional gpl licensed parts
162 "--enable-shared"
163 "--enable-fontconfig"
164 ;; "--enable-gnutls" ; causes test failures
165 "--enable-libfreetype"
166 "--enable-libopus"
167 "--enable-libspeex"
168 "--enable-libtheora"
169 "--enable-libvorbis"
170 "--enable-libvpx"
171 ;; drop special machine instructions not supported
172 ;; on all instances of the target
173 ,@(if (string-prefix? "x86_64"
174 (or (%current-target-system)
175 (%current-system)))
176 '()
177 '("--disable-amd3dnow"
178 "--disable-amd3dnowext"
179 "--disable-mmx"
180 "--disable-mmxext"
181 "--disable-sse"
182 "--disable-sse2"))
183 "--disable-altivec"
184 "--disable-sse3"
185 "--disable-ssse3"
186 "--disable-sse4"
187 "--disable-sse42"
188 "--disable-avx"
189 "--disable-fma4"
190 "--disable-avx2"
191 "--disable-armv5te"
192 "--disable-armv6"
193 "--disable-armv6t2"
194 "--disable-vfp"
195 "--disable-neon"
196 "--disable-mips32r2"
197 "--disable-mipsdspr1"
198 "--disable-mipsdspr2"
199 "--disable-mipsfpu"))))
200 (alist-cons-after
201 'strip 'add-lib-to-runpath
202 (lambda* (#:key outputs #:allow-other-keys)
203 (let* ((out (assoc-ref outputs "out"))
204 (lib (string-append out "/lib")))
205 ;; Add LIB to the RUNPATH of all the executables.
206 (with-directory-excursion out
207 (for-each (cut augment-rpath <> lib)
208 (find-files "bin" ".*")))))
209 %standard-phases))))
210 (home-page "http://www.ffmpeg.org/")
211 (synopsis "Audio and video framework")
212 (description "FFmpeg is a complete, cross-platform solution to record,
213 convert and stream audio and video. It includes the libavcodec
214 audio/video codec library.")
215 (license gpl2+)))
216
217 (define-public vlc
218 (package
219 (name "vlc")
220 (version "2.1.4")
221 (source (origin
222 (method url-fetch)
223 (uri (string-append
224 "http://download.videolan.org/pub/videolan/vlc/"
225 version "/vlc-" version ".tar.xz"))
226 (sha256
227 (base32
228 "1lymhbb2bns73qivdaqanhggjjhyc9fwfgf5ikhng0a74msnqmiy"))))
229 (build-system gnu-build-system)
230 (native-inputs
231 `(("git" ,git) ; needed for a test
232 ("pkg-config" ,pkg-config)))
233 ;; FIXME: Add optional inputs once available.
234 (inputs
235 `(("alsa-lib" ,alsa-lib)
236 ("avahi" ,avahi)
237 ("dbus" ,dbus)
238 ("flac" ,flac)
239 ("ffmpeg" ,ffmpeg)
240 ("fontconfig" ,fontconfig)
241 ("freetype" ,freetype)
242 ("gnutls" ,gnutls)
243 ("libcddb" ,libcddb)
244 ("libgcrypt" ,libgcrypt)
245 ("libkate" ,libkate)
246 ("libmad" ,libmad)
247 ("libogg" ,libogg)
248 ("libpng" ,libpng)
249 ("libsamplerate" ,libsamplerate)
250 ("libssh2" ,libssh2)
251 ("libvorbis" ,libvorbis)
252 ("libtheora" ,libtheora)
253 ("libxext" ,libxext)
254 ("libxinerama" ,libxinerama)
255 ("libxml2" ,libxml2)
256 ("libxpm" ,libxpm)
257 ("lua" ,lua-5.1)
258 ("mesa" ,mesa)
259 ("opus" ,opus)
260 ("perl" ,perl)
261 ("pulseaudio" ,pulseaudio)
262 ("python" ,python-wrapper)
263 ("qt" ,qt-4)
264 ("sdl" ,sdl)
265 ("sdl-image" ,sdl-image)
266 ("speex" ,speex)
267 ("xcb-util-keysyms" ,xcb-util-keysyms)))
268 (arguments
269 `(#:configure-flags
270 `("--disable-a52" ; FIXME: reenable once available
271 "--disable-mmx" ; FIXME: may be enabled on x86_64
272 "--disable-sse" ; 1-4, no separate options available
273 "--disable-neon"
274 "--disable-altivec"
275 ,(string-append "LDFLAGS=-Wl,-rpath -Wl,"
276 (assoc-ref %build-inputs "ffmpeg")
277 "/lib")))) ; needed for the tests
278 (home-page "https://www.videolan.org/")
279 (synopsis "Audio and video framework")
280 (description "VLC is a cross-platform multimedia player and framework
281 that plays most multimedia files as well as DVD, Audio CD, VCD, and various
282 treaming protocols.")
283 (license gpl2+)))
284
285 (define-public mplayer
286 (package
287 (name "mplayer")
288 (version "1.1.1")
289 (source (origin
290 (method url-fetch)
291 (uri (string-append
292 "http://www.mplayerhq.hu/MPlayer/releases/MPlayer-"
293 version ".tar.xz"))
294 (sha256
295 (base32
296 "0xlcg7rszrwmw29wqr0plsw5d1rq0hb7vjsq7bmmfsly2z1wg3yf"))))
297 (build-system gnu-build-system)
298 ;; FIXME: Add additional inputs once available.
299 (native-inputs
300 `(("pkg-config" ,pkg-config)))
301 (inputs
302 `(("alsa-lib" ,alsa-lib)
303 ("cdparanoia" ,cdparanoia)
304 ("fontconfig" ,fontconfig)
305 ("freetype" ,freetype)
306 ("lame" ,lame)
307 ("libmpg123" ,mpg123) ; audio codec for MP3
308 ;; ("giflib" ,giflib) ; uses QuantizeBuffer, requires version >= 5
309 ("libjpeg" ,libjpeg)
310 ("libpng" ,libpng)
311 ("libtheora" ,libtheora)
312 ("libvorbis" ,libvorbis)
313 ("libx11" ,libx11)
314 ("libxxf86dga" ,libxxf86dga)
315 ("libxinerama" ,libxinerama)
316 ("libxv" ,libxv)
317 ("mesa" ,mesa)
318 ("perl" ,perl)
319 ("pulseaudio" ,pulseaudio)
320 ("python" ,python-wrapper)
321 ("sdl" ,sdl)
322 ("speex" ,speex)
323 ("yasm" ,yasm)
324 ("zlib" ,zlib)))
325 (arguments
326 `(#:tests? #f ; no test target
327 #:phases
328 (alist-replace
329 'configure
330 ;; configure does not work followed by "SHELL=..." and
331 ;; "CONFIG_SHELL=..."; set environment variables instead
332 (lambda* (#:key inputs outputs #:allow-other-keys)
333 (let ((out (assoc-ref outputs "out"))
334 (libx11 (assoc-ref inputs "libx11")))
335 (substitute* "configure"
336 (("#! /bin/sh") (string-append "#!" (which "bash"))))
337 (setenv "SHELL" (which "bash"))
338 (setenv "CONFIG_SHELL" (which "bash"))
339 (zero? (system*
340 "./configure"
341 (string-append "--extra-cflags=-I"
342 libx11 "/include") ; to detect libx11
343 "--disable-tremor-internal" ; forces external libvorbis
344 (string-append "--prefix=" out)
345 ;; drop special machine instructions not supported
346 ;; on all instances of the target
347 ,@(if (string-prefix? "x86_64"
348 (or (%current-target-system)
349 (%current-system)))
350 '()
351 '("--disable-3dnow"
352 "--disable-3dnowext"
353 "--disable-mmx"
354 "--disable-mmxext"
355 "--disable-sse"
356 "--disable-sse2"))
357 "--disable-ssse3"
358 "--disable-altivec"
359 "--disable-armv5te"
360 "--disable-armv6"
361 "--disable-armv6t2"
362 "--disable-armvfp"
363 "--disable-neon"
364 "--disable-thumb"
365 "--disable-iwmmxt"))))
366 %standard-phases)))
367 (home-page "http://www.mplayerhq.hu/design7/news.html")
368 (synopsis "Audio and video player")
369 (description "MPlayer is a movie player. It plays most MPEG/VOB, AVI,
370 Ogg/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, RealMedia, Matroska, NUT,
371 NuppelVideo, FLI, YUV4MPEG, FILM, RoQ, PVA files. One can watch VideoCD,
372 SVCD, DVD, 3ivx, DivX 3/4/5, WMV and H.264 movies.")
373 (license gpl2)))
374
375 (define-public libvpx
376 (package
377 (name "libvpx")
378 (version "1.3.0")
379 (source (origin
380 (method url-fetch)
381 (uri (string-append "http://webm.googlecode.com/files/libvpx-v"
382 version ".tar.bz2"))
383 (sha256
384 (base32
385 "1aai0h0z1bhp89pxmg4fkrwpmqq24k39fhr15cw6q77m9bccip6k"))))
386 (build-system gnu-build-system)
387 (arguments
388 '(#:phases (alist-replace
389 'configure
390 (lambda* (#:key outputs #:allow-other-keys)
391 (setenv "CONFIG_SHELL" (which "bash"))
392 (let ((out (assoc-ref outputs "out")))
393 (zero? (system* "./configure"
394 "--enable-shared"
395 "--as=yasm"
396 (string-append "--prefix=" out)))))
397 %standard-phases)
398 #:tests? #f)) ; no check target
399 (native-inputs
400 `(("perl" ,perl)
401 ("yasm" ,yasm)))
402 (synopsis "VP8/VP9 video codec")
403 (description "libvpx is a codec for the VP8/VP9 video compression format.")
404 (license bsd-3)
405 (home-page "http://www.webmproject.org/")))
406
407 (define-public youtube-dl
408 (package
409 (name "youtube-dl")
410 (version "2014.06.26")
411 (source (origin
412 (method url-fetch)
413 (uri (string-append "http://youtube-dl.org/downloads/"
414 version "/youtube-dl-"
415 version ".tar.gz"))
416 (sha256
417 (base32
418 "0jl90plg9mz4mwich219a58y4npwi33myx0cx44v8pymkqykv5cd"))))
419 (build-system python-build-system)
420 (inputs `(("setuptools" ,python-setuptools)))
421 (home-page "http://youtube-dl.org")
422 (synopsis "Download videos from YouTube.com and other sites")
423 (description
424 "youtube-dl is a small command-line program to download videos from
425 YouTube.com and a few more sites.")
426 (license public-domain)))