| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr> |
| 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; |
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 7 | ;;; under the terms of the GNU General Public License as published by |
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 9 | ;;; your option) any later version. |
| 10 | ;;; |
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | ;;; GNU General Public License for more details. |
| 15 | ;;; |
| 16 | ;;; You should have received a copy of the GNU General Public License |
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 18 | |
| 19 | (define-module (gnu packages video) |
| 20 | #:use-module ((guix licenses) #:select (gpl2+)) |
| 21 | #:use-module (guix packages) |
| 22 | #:use-module (guix download) |
| 23 | #:use-module (guix build-system gnu) |
| 24 | #:use-module (gnu packages) |
| 25 | #:use-module (gnu packages algebra) |
| 26 | #:use-module (gnu packages compression) |
| 27 | #:use-module (gnu packages fontutils) |
| 28 | #:use-module (gnu packages oggvorbis) |
| 29 | #:use-module (gnu packages openssl) |
| 30 | #:use-module (gnu packages perl) |
| 31 | #:use-module (gnu packages pkg-config) |
| 32 | #:use-module (gnu packages python) |
| 33 | #:use-module (gnu packages yasm)) |
| 34 | |
| 35 | (define-public ffmpeg |
| 36 | (package |
| 37 | (name "ffmpeg") |
| 38 | (version "2.1.1") |
| 39 | (source (origin |
| 40 | (method url-fetch) |
| 41 | (uri (string-append "http://www.ffmpeg.org/releases/ffmpeg-" |
| 42 | version ".tar.bz2")) |
| 43 | (sha256 |
| 44 | (base32 |
| 45 | "1qnspbpwa6cflsb6mkm84ay4nfx60ism6d7lgvnasidck9dmxydy")) |
| 46 | ;; from upstream, drop with next release |
| 47 | (patches (list (search-patch "ffmpeg-check.patch"))))) |
| 48 | (build-system gnu-build-system) |
| 49 | (inputs |
| 50 | `(("bc" ,bc) |
| 51 | ("bzip2" ,bzip2) |
| 52 | ("fontconfig" ,fontconfig) |
| 53 | ("freetype" ,freetype) |
| 54 | ("libtheora" ,libtheora) |
| 55 | ("libvorbis" ,libvorbis) |
| 56 | ("perl" ,perl) |
| 57 | ("pkg-config" ,pkg-config) |
| 58 | ("python" ,python-2) ; scripts use interpreter python2 |
| 59 | ("speex" ,speex) |
| 60 | ("yasm" ,yasm) |
| 61 | ("zlib", zlib))) |
| 62 | (arguments |
| 63 | `(#:phases |
| 64 | (alist-replace |
| 65 | 'configure |
| 66 | ;; configure does not work followed by "SHELL=..." and |
| 67 | ;; "CONFIG_SHELL=..."; set environment variables instead |
| 68 | (lambda* (#:key outputs configure-flags #:allow-other-keys) |
| 69 | (let ((out (assoc-ref outputs "out"))) |
| 70 | (substitute* "configure" |
| 71 | (("#! /bin/sh") (string-append "#!" (which "bash")))) |
| 72 | (setenv "SHELL" (which "bash")) |
| 73 | (setenv "CONFIG_SHELL" (which "bash")) |
| 74 | ;; possible additional inputs: |
| 75 | ;; --enable-avisynth enable reading of AviSynth script files [no] |
| 76 | ;; --enable-frei0r enable frei0r video filtering |
| 77 | ;; --enable-ladspa enable LADSPA audio filtering |
| 78 | ;; --enable-libaacplus enable AAC+ encoding via libaacplus [no] |
| 79 | ;; --enable-libass enable libass subtitles rendering [no] |
| 80 | ;; --enable-libbluray enable BluRay reading using libbluray [no] |
| 81 | ;; --enable-libcaca enable textual display using libcaca |
| 82 | ;; --enable-libcelt enable CELT decoding via libcelt [no] |
| 83 | ;; --enable-libcdio enable audio CD grabbing with libcdio |
| 84 | ;; --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394 |
| 85 | ;; and libraw1394 [no] |
| 86 | ;; --enable-libfaac enable AAC encoding via libfaac [no] |
| 87 | ;; --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no] |
| 88 | ;; --enable-libflite enable flite (voice synthesis) support via libflite [no] |
| 89 | ;; --enable-libgme enable Game Music Emu via libgme [no] |
| 90 | ;; --enable-libgsm enable GSM de/encoding via libgsm [no] |
| 91 | ;; --enable-libiec61883 enable iec61883 via libiec61883 [no] |
| 92 | ;; --enable-libilbc enable iLBC de/encoding via libilbc [no] |
| 93 | ;; --enable-libmodplug enable ModPlug via libmodplug [no] |
| 94 | ;; --enable-libmp3lame enable MP3 encoding via libmp3lame [no] |
| 95 | ;; --enable-libnut enable NUT (de)muxing via libnut, |
| 96 | ;; native (de)muxer exists [no] |
| 97 | ;; --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no] |
| 98 | ;; --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no] |
| 99 | ;; --enable-libopencv enable video filtering via libopencv [no] |
| 100 | ;; --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no] |
| 101 | ;; --enable-libopus enable Opus decoding via libopus [no] |
| 102 | ;; --enable-libpulse enable Pulseaudio input via libpulse [no] |
| 103 | ;; --enable-libquvi enable quvi input via libquvi [no] |
| 104 | ;; --enable-librtmp enable RTMP[E] support via librtmp [no] |
| 105 | ;; --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no] |
| 106 | ;; --enable-libshine enable fixed-point MP3 encoding via libshine [no] |
| 107 | ;; --enable-libsoxr enable Include libsoxr resampling [no] |
| 108 | ;; --enable-libssh enable SFTP protocol via libssh [no] |
| 109 | ;; (libssh2 does not work) |
| 110 | ;; --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no] |
| 111 | ;; --enable-libtwolame enable MP2 encoding via libtwolame [no] |
| 112 | ;; --enable-libutvideo enable Ut Video encoding and decoding via libutvideo [no] |
| 113 | ;; --enable-libv4l2 enable libv4l2/v4l-utils [no] |
| 114 | ;; --enable-libvidstab enable video stabilization using vid.stab [no] |
| 115 | ;; --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no] |
| 116 | ;; --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no] |
| 117 | ;; --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no] |
| 118 | ;; --enable-libwavpack enable wavpack encoding via libwavpack [no] |
| 119 | ;; --enable-libx264 enable H.264 encoding via x264 [no] |
| 120 | ;; --enable-libxavs enable AVS encoding via xavs [no] |
| 121 | ;; --enable-libxvid enable Xvid encoding via xvidcore, |
| 122 | ;; native MPEG-4/Xvid encoder exists [no] |
| 123 | ;; --enable-libzmq enable message passing via libzmq [no] |
| 124 | ;; --enable-libzvbi enable teletext support via libzvbi [no] |
| 125 | ;; --enable-openal enable OpenAL 1.1 capture support [no] |
| 126 | ;; --enable-opencl enable OpenCL code |
| 127 | ;; --enable-x11grab enable X11 grabbing [no] |
| 128 | (zero? (system* |
| 129 | "./configure" |
| 130 | (string-append "--prefix=" out) |
| 131 | "--enable-gpl" ; enable optional gpl licensed parts |
| 132 | "--enable-shared" |
| 133 | "--enable-fontconfig" |
| 134 | ;; "--enable-gnutls" ; causes test failures |
| 135 | "--enable-libfreetype" |
| 136 | "--enable-libspeex" |
| 137 | "--enable-libtheora" |
| 138 | "--enable-libvorbis" |
| 139 | ;; drop special machine instructions not supported |
| 140 | ;; on all instances of the target |
| 141 | ,@(if (string-prefix? "x86_64" |
| 142 | (or (%current-target-system) |
| 143 | (%current-system))) |
| 144 | '() |
| 145 | '("--disable-amd3dnow" |
| 146 | "--disable-amd3dnowext" |
| 147 | "--disable-mmx" |
| 148 | "--disable-mmxext" |
| 149 | "--disable-sse" |
| 150 | "--disable-sse2")) |
| 151 | "--disable-altivec" |
| 152 | "--disable-sse3" |
| 153 | "--disable-ssse3" |
| 154 | "--disable-sse4" |
| 155 | "--disable-sse42" |
| 156 | "--disable-avx" |
| 157 | "--disable-fma4" |
| 158 | "--disable-avx2" |
| 159 | "--disable-armv5te" |
| 160 | "--disable-armv6" |
| 161 | "--disable-armv6t2" |
| 162 | "--disable-vfp" |
| 163 | "--disable-neon" |
| 164 | "--disable-vis" |
| 165 | "--disable-mips32r2" |
| 166 | "--disable-mipsdspr1" |
| 167 | "--disable-mipsdspr2" |
| 168 | "--disable-mipsfpu")))) |
| 169 | %standard-phases))) |
| 170 | (home-page "http://www.ffmpeg.org/") |
| 171 | (synopsis "Audio and video framework") |
| 172 | (description "FFmpeg is a complete, cross-platform solution to record, |
| 173 | convert and stream audio and video. It includes the libavcodec |
| 174 | audio/video codec library.") |
| 175 | (license gpl2+))) |