1 | | = Compile FFmpeg on Ubuntu Lucid Lynx 10.04 LTS = |
2 | | |
3 | | [[PageOutline(2, Contents)]] |
4 | | |
5 | | This guide supports '''Ubuntu Lucid Lynx 10.04 LTS'''. If you are using a different Ubuntu version see the main [wiki:UbuntuCompilationGuide Compile FFmpeg on Ubuntu Guide]. This guide will enable several external encoders and decoders: ''libfaac'' (AAC encoder), ''libmp3lame'' (MP3 encoder), ''libopencore-amr'' (AMR encoder/decoder), ''libtheora'' (Theora encoder), ''libvorbis'' (Vorbis encoder), ''libvpx'' (VP8 encoder/decoder), and ''libx264'' (H.264 encoder). These are optional and may be omitted if desired. |
6 | | |
7 | | '''Note:''' Copy and paste the whole code box for each step. |
8 | | |
9 | | == Preparation == |
10 | | Remove any existing packages: |
11 | | {{{ |
12 | | sudo apt-get remove ffmpeg x264 libx264-dev yasm |
13 | | }}} |
14 | | |
15 | | Get the dependencies ('''Ubuntu Desktop''' users): |
16 | | {{{ |
17 | | sudo apt-get update |
18 | | sudo apt-get install -y build-essential git-core checkinstall texi2html libfaac-dev \ |
19 | | libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev \ |
20 | | libvorbis-dev libx11-dev libxfixes-dev pkg-config zlib1g-dev |
21 | | }}} |
22 | | |
23 | | Get the dependencies ('''Ubuntu Server''' or headless users): |
24 | | {{{ |
25 | | sudo apt-get update |
26 | | sudo apt-get install -y build-essential git-core checkinstall texi2html libfaac-dev \ |
27 | | libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev pkg-config zlib1g-dev |
28 | | }}} |
29 | | |
30 | | == Installation == |
31 | | === Yasm === |
32 | | Yasm is an assembler and is recommended for x264 and FFmpeg. |
33 | | {{{ |
34 | | cd |
35 | | wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz |
36 | | tar xzvf yasm-1.2.0.tar.gz |
37 | | cd yasm-1.2.0 |
38 | | ./configure |
39 | | make |
40 | | sudo checkinstall --pkgname=yasm --pkgversion="1.2.0" --backup=no --deldoc=yes --default |
41 | | }}} |
42 | | |
43 | | |
44 | | === x264 ===#x264 |
45 | | H.264 video encoder. The following commands will get the current source files, compile, and install x264. |
46 | | {{{ |
47 | | cd |
48 | | git clone --depth 1 git://git.videolan.org/x264 |
49 | | cd x264 |
50 | | ./configure --enable-static |
51 | | make |
52 | | sudo checkinstall --pkgname=x264 --default --pkgversion="3:$(./version.sh | \ |
53 | | awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes |
54 | | }}} |
55 | | |
56 | | '''Note:''' See [http://ubuntuforums.org/showpost.php?p=11483157&postcount=1945 using snapshots] if you are having connection issues with the Git server. |
57 | | |
58 | | === LAME === |
59 | | MP3 audio encoder. |
60 | | {{{ |
61 | | sudo apt-get remove libmp3lame-dev |
62 | | sudo apt-get install nasm |
63 | | cd |
64 | | wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz |
65 | | tar xzvf lame-3.99.5.tar.gz |
66 | | cd lame-3.99.5 |
67 | | ./configure --enable-nasm --disable-shared |
68 | | make |
69 | | sudo checkinstall --pkgname=lame-ffmpeg --pkgversion="3.99.5" --backup=no --default \ |
70 | | --deldoc=yes |
71 | | }}} |
72 | | |
73 | | === libvpx ===#libvpx |
74 | | VP8 video encoder and decoder. |
75 | | {{{ |
76 | | cd |
77 | | git clone --depth 1 http://git.chromium.org/webm/libvpx.git |
78 | | cd libvpx |
79 | | ./configure |
80 | | make |
81 | | sudo checkinstall --pkgname=libvpx --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \ |
82 | | --default --deldoc=yes |
83 | | }}} |
84 | | |
85 | | === FFmpeg ===#ffmpeg |
86 | | {{{ |
87 | | cd |
88 | | git clone --depth 1 git://source.ffmpeg.org/ffmpeg |
89 | | cd ffmpeg |
90 | | ./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \ |
91 | | --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx \ |
92 | | --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab |
93 | | make |
94 | | sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(./version.sh)" --backup=no \ |
95 | | --deldoc=yes --default |
96 | | hash x264 ffmpeg ffplay ffprobe |
97 | | }}} |
98 | | |
99 | | '''Note:''' Ubuntu Server users should omit `--enable-x11grab`. |
100 | | |
101 | | == Finish == |
102 | | Installation is now complete and FFmpeg is now ready for use. You can keep the `x264`, `libvpx`, and `ffmpeg` directories in your home directory if you plan on updating later. See [#update Updating FFmpeg] below for more details. Some optional steps are next followed by instructions on updating FFmpeg and finally instructions on reverting all changes made by this guide. |
103 | | |
104 | | ---- |
105 | | |
106 | | == Optional Installation == |
107 | | === qt-faststart === |
108 | | This is a useful tool if you're showing your H.264 in MP4 videos on the web. It relocates some data in the video to allow playback to begin before the file is completely downloaded. Usage: `qt-faststart input.mp4 output.mp4`. |
109 | | {{{ |
110 | | cd ~/ffmpeg |
111 | | make tools/qt-faststart |
112 | | sudo checkinstall --pkgname=qt-faststart --pkgversion="$(./version.sh)" --backup=no \ |
113 | | --deldoc=yes --default install -Dm755 tools/qt-faststart /usr/local/bin/qt-faststart |
114 | | }}} |
115 | | |
116 | | === Add `lavf` support to x264 === |
117 | | This allows x264 to accept just about any input that FFmpeg can handle and is useful if you want to use x264 directly. |
118 | | {{{ |
119 | | cd ~/x264 |
120 | | make distclean |
121 | | ./configure --enable-static |
122 | | make |
123 | | sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \ |
124 | | awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \ |
125 | | --fstrans=no --default |
126 | | }}} |
127 | | |
128 | | ---- |
129 | | |
130 | | == Updating FFmpeg ==#update |
131 | | Development of FFmpeg and x264 is active and an occasional update can give you new features and bug fixes. First, remove some packages and then update the dependencies: |
132 | | {{{ |
133 | | sudo apt-get -y remove ffmpeg x264 libx264-dev libvpx-dev |
134 | | sudo apt-get update |
135 | | sudo apt-get install -y build-essential git-core checkinstall texi2html libfaac-dev \ |
136 | | libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev \ |
137 | | libvorbis-dev libx11-dev libxfixes-dev pkg-config zlib1g-dev |
138 | | }}} |
139 | | |
140 | | === x264 === |
141 | | {{{ |
142 | | cd ~/x264 |
143 | | make distclean |
144 | | git pull |
145 | | }}} |
146 | | Now run `./configure`, `make`, and `make install` as shown in the [#x264 Install x264] section. |
147 | | |
148 | | === libvpx === |
149 | | {{{ |
150 | | cd ~/libvpx |
151 | | make clean |
152 | | git pull |
153 | | }}} |
154 | | Now run `./configure`, `make`, and `make install` as shown in the [#libvpx Install libvpx] section. |
155 | | |
156 | | === FFmpeg === |
157 | | {{{ |
158 | | cd ~/ffmpeg |
159 | | make distclean |
160 | | git pull |
161 | | }}} |
162 | | Now run `./configure`, `make`, and `make install` as shown in the [#ffmpeg Install FFmpeg] section. |
163 | | |
164 | | ---- |
165 | | |
166 | | == Reverting Changes Made by This Guide == |
167 | | To remove FFmpeg/x264 and other packages added for this guide: |
168 | | {{{ |
169 | | sudo apt-get remove x264 ffmpeg qt-faststart build-essential git-core checkinstall \ |
170 | | nasm yasm texi2html libfaac-dev lame-ffmpeg libsdl1.2-dev libtheora-dev libvorbis-dev \ |
171 | | libx11-dev libxfixes-dev zlib1g-dev |
172 | | }}} |
173 | | Lastly, delete the `x264`, `libvpx`, and `ffmpeg` directories in your home folder. |
174 | | |
175 | | == If You Need Help == |
176 | | Feel free to ask your questions at the #ffmpeg IRC channel or the [http://ffmpeg.org/contact.html ffmpeg-user] mailing list. |
| 1 | This article has been merged with the main [[UbuntuCompilationGuide|Compile FFmpeg on Ubuntu, Debian, and Linux Mint]] article. |