Build video enc env

From M1Research

(Difference between revisions)
Jump to: navigation, search
(MPEG4IP)
(MPEG4IP)
 
(22 intermediate revisions not shown)
Line 1: Line 1:
-
<b>!!!! WARNING !!!!</b> Article migrated to [http://streaming411.com/wiki/index.php?title=Building_encoding_tools_from_scratch Building encoding tools from scratch] at [http://streaming411.com/wiki/ streaming411.com]
+
Article mirrored  at [http://streaming411.com/wiki/index.php?title=Building_encoding_tools_from_scratch Building encoding tools from scratch] at [http://streaming411.com/wiki/ streaming411.com]
== System prerequisites ==
== System prerequisites ==
Line 26: Line 26:
== Software building ==
== Software building ==
-
=== lame ===
+
=== a52dec ===
-
An MP3 encoder and graphical frame analyzer. [http://lame.sourceforge.net/ http://lame.sourceforge.net/]
+
liba52 - a free ATSC A/52 stream decoder [http://liba52.sourceforge.net/ http://liba52.sourceforge.net/]
<pre>
<pre>
-
gzip -cd lame-3.97.tar.gz | tar xvf -
+
gzip -cd a52dec-0.7.4.tar.gz | tar xvf -
-
cd lame-3.97
+
cd a52dec-0.7.4
-
./configure --prefix=/usr/local/enctools
+
./configure --prefix=/usr/local/enctools --enable-shared=yes
-
make; make install
+
-
cd ..
+
-
</pre>
+
-
 
+
-
=== ogg ===
+
-
Ogg is a multimedia container format, and the native file and stream format for the Xiph.org multimedia codecs. As with all Xiph.org technology is it an open format free for anyone to use. [http://www.xiph.org/ogg/ http://www.xiph.org/ogg/]
+
-
<pre>
+
-
gzip -cd libogg-1.1.3.tar.gz | tar xvf -
+
-
cd libogg-1.1.3
+
-
./configure --prefix=/usr/local/enctools
+
make ; make install
make ; make install
-
cd ..
 
</pre>
</pre>
-
=== vorbis ===
+
=== amr ===
-
Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format [http://www.xiph.org/vorbis/ http://www.xiph.org/vorbis/]
+
Download amrwb and amrnb source from [http://www.penguin.cz/~utx/amr http://www.penguin.cz/~utx/amr]
-
<pre>
+
-
gzip -cd libvorbis-1.1.2.tar.gz | tar xvf -
+
-
cd libvorbis-1.1.2
+
-
./configure --with-ogg=/usr/local/enctools --prefix=/usr/local/enctools
+
-
make ; make install
+
-
cd ..
+
-
</pre>
+
-
=== theora ===
+
Compile and install:
-
Video codec [http://theora.org/ http://theora.org/]
+
<pre>
<pre>
-
gzip -cd libtheora-1.0alpha7.tar.gz | tar xvf -
+
bzip2 -cd amrnb-7.0.0.0.tar.bz2 | tar xf -
-
cd libtheora-1.0alpha7
+
cd amrnb-7.0.0.0
-
./configure --prefix=/usr/local/enctools --with-ogg=/usr/local/enctools --with-vorbis=/usr/local/enctools
+
./configure --prefix=/usr/local/enctools
make ; make install
make ; make install
cd ..
cd ..
-
</pre>
 
-
=== flac ===
 
-
Free Lossless Audio Codec [http://flac.sourceforge.net/ http://flac.sourceforge.net/]
 
-
<pre>
 
-
gzip -cd flac-1.1.4.tar.gz | tar xvf -
 
-
cd flac-1.1.4
 
-
./configure --prefix=/usr/local/enctools --with-ogg=/usr/local/enctools
 
-
make ; make install
 
-
cd ..
 
-
</pre>
 
-
=== speex ===
+
bzip2 -cd amrwb-7.0.0.2.tar.bz2 | tar xf -
-
Speex is an Open Source/Free Software  patent-free audio compression format designed for speech. The Speex Project aims to lower the barrier of entry for voice applications by providing a free alternative to expensive proprietary speech codecs. Moreover, Speex is well-adapted to Internet applications and provides useful features that are not present in most other codecs. Finally, Speex is part of the GNU  Project and is available under the Xiph.org variant of the BSD license. [http://speex.org/ http://speex.org/]
+
cd amrwb-7.0.0.2
-
<pre>
+
-
gzip -cd speex-1.0.5.tar.gz | tar xvf -
+
-
cd speex-1.0.5
+
-
./configure --prefix=/usr/local/enctools --with-ogg-dir=/usr/local/enctools
+
-
make ; make install
+
-
cd ..
+
-
</pre>
+
-
 
+
-
=== faad2 ===
+
-
AAC decoder library [http://www.audiocoding.com/modules/mydownloads/ http://www.audiocoding.com/modules/mydownloads/]
+
-
<pre>
+
-
gzip -cd faad2-2.5.tar.gz | tar xf -
+
-
cd faad2
+
-
</pre>
+
-
For successfull compile (avoid <b>conditional "HAVE_BMP" was never defined</b>) apply [[Media:faad2.no_beep_media_player.patch]] patch discussed in [http://www.audiocoding.com/modules/newbb/viewtopic.php?topic_id=487&forum=2 audiocoding forum]:
+
-
<pre>
+
-
diff -uNr faad2.origin/configure.in faad2/configure.in
+
-
--- faad2.origin/configure.in  2006-08-13 17:13:31.000000000 +0300
+
-
+++ faad2/configure.in  2007-04-16 19:31:20.000000000 +0300
+
-
@@ -118,6 +118,9 @@
+
-
  AC_DEFINE([HAVE_BMP], 1, [User wants beep media player plugin built])
+
-
  AM_CONDITIONAL([HAVE_XMMS], true)
+
-
  AM_CONDITIONAL([HAVE_BMP], true)
+
-
+else
+
-
+ AC_MSG_NOTICE(no bmp build configured)
+
-
+ AM_CONDITIONAL([HAVE_BMP], false)
+
-
fi
+
-
 
+
-
if test x$WITHDRM = xyes; then
+
-
</pre>
+
-
And now you can bootstrap (ignore warnings) and compile:
+
-
<pre>
+
-
autoreconf -vif
+
./configure --prefix=/usr/local/enctools
./configure --prefix=/usr/local/enctools
make ; make install
make ; make install
Line 194: Line 132:
</pre>
</pre>
-
=== xvidcore ===
+
=== faad2 ===
-
XviD is an ISO MPEG-4 compliant video codec, so designed to compress/decompress digital video. It's a open source project, which is developed and maintained by a handful of skilled and interested engineers from all over the world. [http://www.xvid.org/ http://www.xvid.org/]
+
AAC decoder library [http://www.audiocoding.com/modules/mydownloads/ http://www.audiocoding.com/modules/mydownloads/]
<pre>
<pre>
-
gzip -cd xvidcore-1.1.2.tar.gz | tar xvf -
+
gzip -cd faad2-2.5.tar.gz | tar xf -
-
cd xvidcore-1.1.2
+
cd faad2
-
cd build/generic
+
mkdir -p plugins/bmp
-
./configure --prefix=/usr/local/enctools
+
-
make ; make install
+
-
cd ..
+
</pre>
</pre>
-
 
+
For successfull compile (avoid <b>conditional "HAVE_BMP" was never defined</b>) apply [[Media:faad2.no_beep_media_player.patch]] patch discussed in [http://www.audiocoding.com/modules/newbb/viewtopic.php?topic_id=487&forum=2 audiocoding forum]:
-
=== x264 ===
+
-
x264 - a free h264/avc encoder [http://developers.videolan.org/x264.html http://developers.videolan.org/x264.html]
+
-
Download SVN snapshot:
+
<pre>
<pre>
-
svn co svn://svn.videolan.org/x264/trunk x264
+
diff -uNr faad2.origin/configure.in faad2/configure.in
 +
--- faad2.origin/configure.in  2006-08-13 17:13:31.000000000 +0300
 +
+++ faad2/configure.in  2007-04-16 19:31:20.000000000 +0300
 +
@@ -118,6 +118,9 @@
 +
  AC_DEFINE([HAVE_BMP], 1, [User wants beep media player plugin built])
 +
  AM_CONDITIONAL([HAVE_XMMS], true)
 +
  AM_CONDITIONAL([HAVE_BMP], true)
 +
+else
 +
+ AC_MSG_NOTICE(no bmp build configured)
 +
+ AM_CONDITIONAL([HAVE_BMP], false)
 +
fi
 +
 
 +
if test x$WITHDRM = xyes; then
</pre>
</pre>
-
Configure and compile (do not forget about <code>--enable-pthread</code>)
+
And now you can bootstrap (ignore warnings) and compile:
<pre>
<pre>
-
cd x264
+
patch -p1 < faad2.no_beep_media_player.patch
-
./configure --prefix=/usr/local/enctools --enable-shared --enable-pthread
+
autoreconf -vif
 +
./configure --prefix=/usr/local/enctools
make ; make install
make ; make install
cd ..
cd ..
</pre>
</pre>
-
=== a52dec ===
+
=== lame ===
-
liba52 - a free ATSC A/52 stream decoder [http://liba52.sourceforge.net/ http://liba52.sourceforge.net/]
+
An MP3 encoder and graphical frame analyzer. [http://lame.sourceforge.net/ http://lame.sourceforge.net/]
<pre>
<pre>
-
gzip -cd a52dec-0.7.4.tar.gz | tar xvf -
+
gzip -cd lame-3.97.tar.gz | tar xvf -
-
cd a52dec-0.7.4
+
cd lame-3.97
-
./configure --prefix=/usr/local/enctools --enable-shared=yes
+
./configure --prefix=/usr/local/enctools
-
make ; make install
+
make; make install
 +
cd ..
</pre>
</pre>
-
=== libdv ===
+
=== ogg ===
-
Quasar DV Codec: libdv [http://libdv.sourceforge.net/ http://libdv.sourceforge.net/]
+
Ogg is a multimedia container format, and the native file and stream format for the Xiph.org multimedia codecs. As with all Xiph.org technology is it an open format free for anyone to use. [http://www.xiph.org/ogg/ http://www.xiph.org/ogg/]
<pre>
<pre>
-
gzip -cd libdv-1.0.0.tar.gz | tar xvf -
+
gzip -cd libogg-1.1.3.tar.gz | tar xvf -
-
cd libdv-1.0.0
+
cd libogg-1.1.3
-
./configure --disable-gtk --disable-xv --prefix=/usr/local/enctools
+
./configure --prefix=/usr/local/enctools
make ; make install
make ; make install
cd ..
cd ..
</pre>
</pre>
-
=== libraw1394 ===
+
=== vorbis ===
-
The Linux kernel's IEEE 1394 subsystem provides access to the raw 1394 bus through the raw1394 module. [http://www.linux1394.org/ http://www.linux1394.org/]
+
Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format [http://www.xiph.org/vorbis/ http://www.xiph.org/vorbis/]
<pre>
<pre>
-
gzip -cd libraw1394-1.2.1.tar.gz | tar xvf -
+
gzip -cd libvorbis-1.2.0.tar.gz | tar xvf -
-
cd libraw1394-1.2.1
+
cd libvorbis-1.2.0
-
./configure --prefix=/usr/local/enctools
+
./configure --with-ogg=/usr/local/enctools --prefix=/usr/local/enctools
make ; make install
make ; make install
cd ..
cd ..
</pre>
</pre>
-
=== libdc1394 ===
+
=== theora ===
-
libdc1394 is a library that is intended to provide a high level programming interface for application developers who wish to control IEEE 1394 based cameras that conform to the 1394-based Digital Camera Specification [http://sourceforge.net/projects/libdc1394 http://sourceforge.net/projects/libdc1394]
+
Video codec [http://theora.org/ http://theora.org/]
-
 
+
-
On FC5 to avoid <code>'CLK_TCK' undeclared</code> error message during compiling we should apply patch [[Media:libdc1394-1.2.1.CLOCKS_PER_SEC.patch]]: (FC4 do not require patch)<pre>
+
-
diff -uNr libdc1394-1.2.1.origin/examples/grab_partial_image.c libdc1394-1.2.1/examples/grab_partial_image.c
+
-
--- libdc1394-1.2.1.origin/examples/grab_partial_image.c        2005-08-18 03:03:06.000000000 -0400
+
-
+++ libdc1394-1.2.1/examples/grab_partial_image.c      2006-06-29 12:09:12.000000000 -0400
+
-
@@ -218,7 +218,7 @@
+
-
    /*---------------------------------------------------------------------
+
-
      *  output elapsed time
+
-
      *---------------------------------------------------------------------*/
+
-
-    elapsed_time = (float)(times(&tms_buf) - start_time) / CLK_TCK;
+
-
+    elapsed_time = (float)(times(&tms_buf) - start_time) / CLOCKS_PER_SEC;
+
-
    printf( "got frame %d. elapsed time: %g sec ==> %g frames/second\n",
+
-
            i, elapsed_time, (float)i / elapsed_time);
+
-
  }
+
-
</pre>
+
-
 
+
-
Building process:
+
-
 
+
<pre>
<pre>
-
gzip -cd libdc1394-1.2.1.tar.gz | tar xvf -
+
gzip -cd libtheora-1.0beta1.tar.gz | tar xvf -
-
cd libdc1394-1.2.1
+
cd libtheora-1.0beta1
-
 
+
./configure --prefix=/usr/local/enctools --with-ogg=/usr/local/enctools --with-vorbis=/usr/local/enctools
-
patch -p1 < ../libdc1394-1.2.1.CLOCKS_PER_SEC.patch
+
-
 
+
-
CPPFLAGS="-I/usr/local/enctools/include/"; export CPPFLAGS
+
-
CFLAGS="-I/usr/local/enctools/include/"; export CFLAGS
+
-
LDFLAGS="-L/usr/local/enctools/lib/"; export LDFLAGS
+
-
./configure --prefix=/usr/local/enctools
+
-
 
+
make ; make install
make ; make install
cd ..
cd ..
</pre>
</pre>
-
=== libavc1394 ===
+
=== x264 ===
-
libavc1394 is a programming interface for the 1394 Trade Association AV/C (Audio/Video Control) Digital Interface Command Set. [http://sourceforge.net/projects/libavc1394/ http://sourceforge.net/projects/libavc1394/]
+
x264 - a free h264/avc encoder [http://developers.videolan.org/x264.html http://developers.videolan.org/x264.html]
 +
Download SVN snapshot:
<pre>
<pre>
-
gzip -cd libavc1394-0.5.3.tar.gz | tar xvf -
+
svn co svn://svn.videolan.org/x264/trunk x264
-
cd libavc1394-0.5.3
+
</pre>
-
LIBRAW1394_CFLAGS="-I/usr/local/enctools/include/" \
+
Configure and compile (do not forget about <code>--enable-pthread</code>)
-
LIBRAW1394_LIBS="-L/usr/local/enctools/lib/ -lraw1394" \
+
<pre>
-
./configure --prefix=/usr/local/enctools
+
cd x264
 +
./configure --prefix=/usr/local/enctools --enable-shared --enable-pthread
make ; make install
make ; make install
cd ..
cd ..
</pre>
</pre>
-
=== amr ===
+
=== xvidcore ===
-
Download amrwb and amrnb source from [http://www.penguin.cz/~utx/amr http://www.penguin.cz/~utx/amr]
+
XviD is an ISO MPEG-4 compliant video codec, so designed to compress/decompress digital video. It's a open source project, which is developed and maintained by a handful of skilled and interested engineers from all over the world. [http://www.xvid.org/ http://www.xvid.org/]
-
 
+
-
Compile and install:
+
<pre>
<pre>
-
bzip2 -cd amrnb-6.1.0.2.tar.bz2 | tar xf -
+
gzip -cd xvidcore-1.1.3.tar.gz | tar xvf -
-
cd amrnb-6.1.0.2
+
cd xvidcore-1.1.3
-
./configure --prefix=/usr/local/enctools
+
cd build/generic
-
make ; make install
+
-
cd ..
+
-
 
+
-
 
+
-
bzip2 -cd amrwb-6.0.0.1.tar.bz2 | tar xf -
+
-
cd amrwb-6.0.0.1
+
./configure --prefix=/usr/local/enctools
./configure --prefix=/usr/local/enctools
make ; make install
make ; make install
Line 317: Line 232:
FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. [http://ffmpeg.mplayerhq.hu/ http://ffmpeg.mplayerhq.hu/]
FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. [http://ffmpeg.mplayerhq.hu/ http://ffmpeg.mplayerhq.hu/]
-
Request a ffmpeg svn snapshot (this moment i have r8745):
+
Request a ffmpeg svn snapshot (this moment i have r10593):
<pre>
<pre>
svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg</pre>
svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg</pre>
-
 
-
for <b>faad2</b> support and correct library loading (avoid messages <i>[aac @ 0xb7db9a24]FAAD library: cannot resolve faacDecGetErrorMessage in libfaad.so.0!</i>) [[Media:ffmpeg.faad2.patch]] patch should be applied:
 
-
<pre>
 
-
diff -uNr ffmpeg-r8745.origin/configure ffmpeg-r8745/configure
 
-
--- ffmpeg-r8745.origin/configure      2007-04-17 16:38:30.000000000 +0300
 
-
+++ ffmpeg-r8745/configure      2007-04-17 16:44:04.000000000 +0300
 
-
@@ -1603,7 +1603,7 @@
 
-
enabled dc1394    && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
 
-
enabled mlib      && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
 
-
enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
 
-
-enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
 
-
+enabled libfaad    && require2 libfaad faad.h NeAACDecOpen -lfaad
 
-
enabled avisynth  && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
 
-
 
-
# test for lrintf in math.h
 
-
diff -uNr ffmpeg-r8745.origin/libavcodec/faad.c ffmpeg-r8745/libavcodec/faad.c
 
-
--- ffmpeg-r8745.origin/libavcodec/faad.c      2007-04-17 16:38:29.000000000 +0300
 
-
+++ ffmpeg-r8745/libavcodec/faad.c      2007-04-17 16:50:20.000000000 +0300
 
-
@@ -218,7 +218,7 @@
 
-
        return -1;
 
-
    }
 
-
#define dfaac(a, b) \
 
-
-    do { static const char* n = "faacDec" #a; \
 
-
+    do { static const char* n = "NeAACDec" #a; \
 
-
    if ((s->faacDec ## a = b dlsym( s->handle, n )) == NULL) { err = n; break; } } while(0)
 
-
    for(;;) {
 
-
#else  /* !CONFIG_LIBFAADBIN */
 
-
</pre>
 
Configuring procedure:
Configuring procedure:
Line 353: Line 240:
<pre>
<pre>
cd ffmpeg
cd ffmpeg
-
patch -p1 < ../ffmpeg.faad2.patch
 
-
PATH=$PATH:/usr/local/enctools/bin ./configure --prefix=/usr/local/enctools \
+
PATH=$PATH:/usr/local/enctools/bin \
-
--enable-libmp3lame --enable-libogg --enable-libvorbis --enable-libtheora \
+
./configure         \
-
--enable-libfaad --enable-libfaadbin --enable-libfaac --enable-xvid --enable-x264 \
+
--prefix=/usr/local/enctools \
-
--enable-liba52 --enable-liba52bin --enable-amr_nb --enable-amr_wb --enable-dc1394 \
+
--enable-liba52      \
-
--enable-gpl --enable-pp --enable-shared --enable-pthreads \
+
--enable-libamr_nb  \
-
--extra-cflags="-I/usr/local/enctools/include" --extra-ldflags="-L/usr/local/enctools/lib"
+
--enable-libamr_wb  \
 +
--enable-libfaac    \
 +
--enable-libfaad     \
 +
--enable-libmp3lame  \
 +
--enable-libogg      \
 +
--enable-libvorbis  \
 +
--enable-libtheora  \
 +
--enable-libxvid    \
 +
--enable-libx264    \
 +
--enable-gpl         \
 +
--enable-pp         \
 +
--enable-shared     \
 +
--enable-pthreads   \
 +
--extra-cflags="-I/usr/local/enctools/include" \
 +
--extra-ldflags="-L/usr/local/enctools/lib"  
make ; make install
make ; make install
cd ..
cd ..
</pre>
</pre>
-
 
-
 
=== libmad ===
=== libmad ===
Line 389: Line 287:
</pre>
</pre>
-
=== fribidi ===
+
=== flac ===
-
GNU FriBidi is an implementation of the [WWW]Unicode Bidirectional Algorithm (bidi). [http://fribidi.org/wiki/ http://fribidi.org/wiki/]
+
Free Lossless Audio Codec [http://flac.sourceforge.net/ http://flac.sourceforge.net/]
<pre>
<pre>
-
gzip -cd fribidi-0.10.7.tar.gz | tar xvf -
+
gzip -cd flac-1.2.1.tar.gz | tar xvf -
-
cd fribidi-0.10.7
+
cd flac-1.2.1
 +
./configure --prefix=/usr/local/enctools --with-ogg=/usr/local/enctools
 +
make ; make install
 +
cd ..
 +
</pre>
 +
 
 +
=== speex ===
 +
Speex is an Open Source/Free Software  patent-free audio compression format designed for speech. The Speex Project aims to lower the barrier of entry for voice applications by providing a free alternative to expensive proprietary speech codecs. Moreover, Speex is well-adapted to Internet applications and provides useful features that are not present in most other codecs. Finally, Speex is part of the GNU  Project and is available under the Xiph.org variant of the BSD license. [http://speex.org/ http://speex.org/]
 +
<pre>
 +
gzip -cd speex-1.2beta2.tar.gz | tar xvf -
 +
cd speex-1.2beta2
 +
./configure --prefix=/usr/local/enctools --with-ogg-dir=/usr/local/enctools
 +
make ; make install
 +
cd ..
 +
</pre>
 +
 
 +
=== libdv ===
 +
Quasar DV Codec: libdv [http://libdv.sourceforge.net/ http://libdv.sourceforge.net/]
 +
<pre>
 +
gzip -cd libdv-1.0.0.tar.gz | tar xvf -
 +
cd libdv-1.0.0
 +
./configure --disable-gtk --disable-xv --prefix=/usr/local/enctools
 +
make ; make install
 +
cd ..
 +
</pre>
 +
 
 +
=== libraw1394 ===
 +
The Linux kernel's IEEE 1394 subsystem provides access to the raw 1394 bus through the raw1394 module. [http://www.linux1394.org/  http://www.linux1394.org/]
 +
<pre>
 +
gzip -cd libraw1394-1.2.1.tar.gz | tar xvf -
 +
cd libraw1394-1.2.1
./configure --prefix=/usr/local/enctools
./configure --prefix=/usr/local/enctools
make ; make install
make ; make install
cd ..
cd ..
</pre>
</pre>
 +
 +
=== libavc1394 ===
 +
libavc1394 is a programming interface for the 1394 Trade Association AV/C (Audio/Video Control) Digital Interface Command Set. [http://sourceforge.net/projects/libavc1394/ http://sourceforge.net/projects/libavc1394/]
 +
<pre>
 +
gzip -cd libavc1394-0.5.3.tar.gz | tar xvf -
 +
cd libavc1394-0.5.3
 +
LIBRAW1394_CFLAGS="-I/usr/local/enctools/include/" \
 +
LIBRAW1394_LIBS="-L/usr/local/enctools/lib/ -lraw1394" \
 +
./configure --prefix=/usr/local/enctools
 +
make ; make install
 +
cd ..
 +
</pre>
 +
=== live555 ===
=== live555 ===
LIVE555 Streaming Media (rtsp, rtp support) [http://live555.com/liveMedia/ http://live555.com/liveMedia/]
LIVE555 Streaming Media (rtsp, rtp support) [http://live555.com/liveMedia/ http://live555.com/liveMedia/]
<pre>
<pre>
-
gzip -cd live.2007.02.20.tar.gz | tar xf -
+
gzip -cd live.2007.08.03a.tar.gz | tar xf -
cd live
cd live
./genMakefiles linux
./genMakefiles linux
Line 419: Line 360:
<pre>
<pre>
-
bzip2 -cd vlc-0.8.6a.tar.bz2 | tar xvf -
+
bzip2 -cd vlc-0.8.6c.tar.bz2 | tar xvf -
-
cd vlc-0.8.6a
+
cd vlc-0.8.6c
-
</pre>
+
-
 
+
-
Apply [http://svn.rpmforge.net/svn/trunk/rpms/vlc/vlc-0.8.6a-flac-1.1.3.patch vlc-0.8.6a-flac-1.1.3.patch] FLAC API update patch:
+
-
<pre>
+
-
patch -p1 < vlc-0.8.6a-flac-1.1.3.patch
+
</pre>
</pre>
Line 433: Line 369:
CFLAGS="-I/usr/local/enctools/include/"; export CFLAGS
CFLAGS="-I/usr/local/enctools/include/"; export CFLAGS
LDFLAGS="-L/usr/local/enctools/lib/"; export LDFLAGS
LDFLAGS="-L/usr/local/enctools/lib/"; export LDFLAGS
 +
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/enctools/lib/pkgconfig ; export PKG_CONFIG_PATH
 +
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/enctools/lib ; export LD_LIBRARY_PATH
-
ldconfig
+
./configure  \
-
 
+
--prefix=/usr/local/enctools \
-
./configure  --prefix=/usr/local/enctools \
+
--enable-dv \
--enable-dv \
--enable-live555 --with-live555-tree=../live \
--enable-live555 --with-live555-tree=../live \
Line 443: Line 380:
--enable-libmpeg2 --enable-vorbis --enable-speex --enable-theora \
--enable-libmpeg2 --enable-vorbis --enable-speex --enable-theora \
--enable-png --enable-x264 \
--enable-png --enable-x264 \
-
--enable-freetype --enable-fribidi --enable-libxml2 \
 
--enable-ffmpeg --with-ffmpeg-mp3lame --with-ffmpeg-faac \
--enable-ffmpeg --with-ffmpeg-mp3lame --with-ffmpeg-faac \
--with-ffmpeg-vorbis --with-ffmpeg-theora --with-ffmpeg-ogg \
--with-ffmpeg-vorbis --with-ffmpeg-theora --with-ffmpeg-ogg \
Line 453: Line 389:
</pre>
</pre>
-
=== twolame ===
 
 +
 +
=== twolame ===
 +
 +
TwoLAME is an optimised MPEG Audio Layer 2 (MP2) encoder based on tooLAME by Mike Cheng, which in turn is based upon the ISO dist10 code and portions of LAME. [http://www.twolame.org/ http://www.twolame.org/]
 +
<pre>
 +
gzip -cd twolame-0.3.10.tar.gz | tar xf -
 +
cd twolame-0.3.10
 +
./configure --prefix=/usr/local/enctools
 +
make ; make install
 +
cd ..
 +
</pre>
=== MPEG4IP ===
=== MPEG4IP ===
Line 470: Line 416:
LDFLAGS="-L/usr/local/enctools/lib/"; export LDFLAGS
LDFLAGS="-L/usr/local/enctools/lib/"; export LDFLAGS
-
gzip -cd mpeg4ip-1.5.0.1.tar.gz | tar xvf -
+
cd mpeg4ip
-
cd mpeg4ip-1.5.0.1
+
-
patch -p1 < ../mpeg4ip.alsa_linking_fix.patch
+
./bootstrap                  \
 +
--prefix=/usr/local/enctools  \
 +
--enable-ffmpeg              \
 +
--enable-mp4live              \
 +
--enable-player              \
 +
--enable-server              \
 +
--enable-igmpv3              \
 +
--disable-id3tags
-
./bootstrap  --prefix=/usr/local/enctools \
 
-
--enable-server \
 
-
--enable-player \
 
-
--enable-mp4live \
 
-
--enable-ffmpeg=/usr/local/enctools
 
</pre>
</pre>
After configuring mpeg4ip reports:<pre>
After configuring mpeg4ip reports:<pre>
Line 487: Line 434:
     x264 encoder is installed
     x264 encoder is installed
     lame encoder is installed
     lame encoder is installed
-
     faac encoder is installed </pre>
+
     faac encoder is installed
 +
    twolame encoder is installed</pre>
Build mpeg4ip:
Build mpeg4ip:
<pre>make ; make install; cd .. </pre>
<pre>make ; make install; cd .. </pre>
 +
 +
== Built binaries ==
 +
* [http://research.m1stereo.tv/downloads/enctools-20070419.bin.tar.bz2 bzip-ed binaries] build from 20070419 (33.6Mb)
 +
* [http://research.m1stereo.tv/downloads/enctools-20070404.bin.tar.bz2 bzip-ed binaries] build from 20070404 (27.7Mb)

Latest revision as of 13:35, 27 September 2007

Article mirrored at Building encoding tools from scratch at streaming411.com

Contents

System prerequisites

Building packages required preinstalled system packages:

  • base development packages: nasm, gcc, gcc-c++, libtool, automake*, autoconf*, make, libstdc++-devel, glibc-devel, subversion
  • development packages: alsa-lib-devel, SDL-devel, gtk+-devel, gtk2-devel, ncurses-devel
  • wxWidgets support required additional packages: wxGTK-2.6.x, wxGTK-devel-2.6.x, wxGTK-gl-2.6.x ( you can find sources at http://www.wxwidgets.org/, rpm could be found at http://fedoraproject.org/wiki/Extras or http://freshrpms.net/)

I choose path /usr/local/enctools for storing all builded files to avoid confilcts with other libs.

Make sure your PATH contains /usr/local/enctools/bin, to update path :

PATH=$PATH:/usr/local/enctools/bin; export PATH
Include libraries path to /etc/ld.so.conf:
--skipped--
/usr/local/enctools/lib
--skipped--

After adding path rebuild ld.so.cache:

ldconfig

Software building

a52dec

liba52 - a free ATSC A/52 stream decoder http://liba52.sourceforge.net/

gzip -cd a52dec-0.7.4.tar.gz | tar xvf -
cd a52dec-0.7.4
./configure --prefix=/usr/local/enctools --enable-shared=yes
make ; make install

amr

Download amrwb and amrnb source from http://www.penguin.cz/~utx/amr

Compile and install:

bzip2 -cd amrnb-7.0.0.0.tar.bz2 | tar xf -
cd amrnb-7.0.0.0
./configure --prefix=/usr/local/enctools
make ; make install
cd ..


bzip2 -cd amrwb-7.0.0.2.tar.bz2 | tar xf -
cd amrwb-7.0.0.2
./configure --prefix=/usr/local/enctools
make ; make install
cd ..

faac

AAC endecoder library http://www.audiocoding.com/modules/mydownloads/

gzip -cd faac-1.25.tar.gz | tar xf -
cd faac

To avoid warning during bootstrap:

utoreconf: running: aclocal --force
configure.in:10: warning: underquoted definition of MY_DEFINE
  run info '(automake)Extending aclocal'
  or see http://sources.redhat.com/automake/automake.html#Extending-aclocal

and error during configuring:

config.status: creating \
.infig.status: error: cannot find input file: \

Apply patches discussed in audiocoding forum:

diff -uNr faac.origin/configure.in faac/configure.in
--- faac.origin/configure.in    2006-08-13 17:17:26.000000000 +0300
+++ faac/configure.in   2007-04-17 14:14:38.000000000 +0300
@@ -7,7 +7,7 @@

 AC_ARG_WITH( mp4v2,  [  --with-mp4v2            compile libmp4v2],WITHMP4V2=$withval, WITHMP4V2=yes)

-AC_DEFUN(MY_DEFINE, [ AC_DEFINE($1, 1, [define if needed]) ])
+AC_DEFUN([MY_DEFINE], [ AC_DEFINE($1, 1, [define if needed]) ])

 CFLAGS=${CFLAGS:-"-O2 -Wall"}

@@ -66,6 +66,11 @@
         #include <netinet/in.h>])
 AC_CHECK_MEMBERS(fpos_t.__pos,,, [#include <stdio.h>])

-AC_OUTPUT(common/Makefile common/mp4v2/Makefile \
-          libfaac/Makefile frontend/Makefile \
-          include/Makefile Makefile)
+AC_CONFIG_FILES(common/Makefile)
+AC_CONFIG_FILES(common/mp4v2/Makefile)
+AC_CONFIG_FILES(libfaac/Makefile)
+AC_CONFIG_FILES(frontend/Makefile)
+AC_CONFIG_FILES(include/Makefile)
+AC_CONFIG_FILES(Makefile)
+
+AC_OUTPUT
diff -uNr faac.origin/frontend/main.c faac/frontend/main.c
--- faac.origin/frontend/main.c 2004-12-08 13:07:17.000000000 +0200
+++ faac/frontend/main.c        2007-04-17 14:45:01.000000000 +0300
@@ -918,7 +918,15 @@
     {
 #endif
         /* open the aac output file */
-        outfile = fopen(aacFileName, "wb");
+        if(('-' == aacFileName[0])&&(0 == aacFileName[1]))
+        {
+            outfile = stdout;
+        }
+        else
+        {
+            outfile = fopen(aacFileName, "wb");
+        };
+
         if (!outfile)
         {
             fprintf(stderr, "Couldn't create output file %s\n", aacFileName);

Bootstrap, configure and compile:

patch -p1 < faac.bootstrap.patch
patch -p1 < faac.pipe.patch
autoreconf -vif
./configure --prefix=/usr/local/enctools --with-mp4v2
make ; make install
cd ..

faad2

AAC decoder library http://www.audiocoding.com/modules/mydownloads/

gzip -cd faad2-2.5.tar.gz | tar xf -
cd faad2
mkdir -p plugins/bmp

For successfull compile (avoid conditional "HAVE_BMP" was never defined) apply Media:faad2.no_beep_media_player.patch patch discussed in audiocoding forum:

diff -uNr faad2.origin/configure.in faad2/configure.in
--- faad2.origin/configure.in   2006-08-13 17:13:31.000000000 +0300
+++ faad2/configure.in  2007-04-16 19:31:20.000000000 +0300
@@ -118,6 +118,9 @@
   AC_DEFINE([HAVE_BMP], 1, [User wants beep media player plugin built])
   AM_CONDITIONAL([HAVE_XMMS], true)
   AM_CONDITIONAL([HAVE_BMP], true)
+else
+ AC_MSG_NOTICE(no bmp build configured)
+ AM_CONDITIONAL([HAVE_BMP], false)
 fi

 if test x$WITHDRM = xyes; then

And now you can bootstrap (ignore warnings) and compile:

patch -p1 < faad2.no_beep_media_player.patch
autoreconf -vif
./configure --prefix=/usr/local/enctools
make ; make install
cd ..

lame

An MP3 encoder and graphical frame analyzer. http://lame.sourceforge.net/

gzip -cd lame-3.97.tar.gz | tar xvf -
cd lame-3.97
./configure --prefix=/usr/local/enctools
make; make install
cd ..

ogg

Ogg is a multimedia container format, and the native file and stream format for the Xiph.org multimedia codecs. As with all Xiph.org technology is it an open format free for anyone to use. http://www.xiph.org/ogg/

gzip -cd libogg-1.1.3.tar.gz | tar xvf -
cd libogg-1.1.3
./configure --prefix=/usr/local/enctools
make ; make install
cd ..

vorbis

Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format http://www.xiph.org/vorbis/

gzip -cd libvorbis-1.2.0.tar.gz | tar xvf -
cd libvorbis-1.2.0
./configure --with-ogg=/usr/local/enctools --prefix=/usr/local/enctools
make ; make install
cd ..

theora

Video codec http://theora.org/

gzip -cd libtheora-1.0beta1.tar.gz | tar xvf -
cd libtheora-1.0beta1
./configure --prefix=/usr/local/enctools --with-ogg=/usr/local/enctools --with-vorbis=/usr/local/enctools
make ; make install
cd ..

x264

x264 - a free h264/avc encoder http://developers.videolan.org/x264.html Download SVN snapshot:

svn co svn://svn.videolan.org/x264/trunk x264

Configure and compile (do not forget about --enable-pthread)

cd x264
./configure --prefix=/usr/local/enctools --enable-shared --enable-pthread
make ; make install
cd ..

xvidcore

XviD is an ISO MPEG-4 compliant video codec, so designed to compress/decompress digital video. It's a open source project, which is developed and maintained by a handful of skilled and interested engineers from all over the world. http://www.xvid.org/

gzip -cd xvidcore-1.1.3.tar.gz | tar xvf -
cd xvidcore-1.1.3
cd build/generic
./configure --prefix=/usr/local/enctools
make ; make install
cd ..

ffmpeg

FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. http://ffmpeg.mplayerhq.hu/

Request a ffmpeg svn snapshot (this moment i have r10593):

svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

Configuring procedure:

cd ffmpeg

PATH=$PATH:/usr/local/enctools/bin \
./configure          \
--prefix=/usr/local/enctools \
--enable-liba52      \
--enable-libamr_nb   \
--enable-libamr_wb   \
--enable-libfaac     \
--enable-libfaad     \
--enable-libmp3lame  \
--enable-libogg      \
--enable-libvorbis   \
--enable-libtheora   \
--enable-libxvid     \
--enable-libx264     \
--enable-gpl         \
--enable-pp          \
--enable-shared      \
--enable-pthreads    \
--extra-cflags="-I/usr/local/enctools/include" \
--extra-ldflags="-L/usr/local/enctools/lib" 

make ; make install
cd ..

libmad

A high-quality MPEG audio decoder. http://freshmeat.net/projects/libmad/

gzip -cd libmad-0.15.1b.tar.gz | tar xvf -
cd libmad-0.15.1b
./configure --prefix=/usr/local/enctools
make ; make install
cd ..

libmpeg2

libmpeg2 - a free MPEG-2 video stream decoder. http://libmpeg2.sourceforge.net/

gzip -cd mpeg2dec-0.4.1.tar.gz | tar xvf -
cd mpeg2dec-0.4.1
./configure --prefix=/usr/local/enctools
make
make install
cd ..

flac

Free Lossless Audio Codec http://flac.sourceforge.net/

gzip -cd flac-1.2.1.tar.gz | tar xvf -
cd flac-1.2.1
./configure --prefix=/usr/local/enctools --with-ogg=/usr/local/enctools
make ; make install
cd ..

speex

Speex is an Open Source/Free Software patent-free audio compression format designed for speech. The Speex Project aims to lower the barrier of entry for voice applications by providing a free alternative to expensive proprietary speech codecs. Moreover, Speex is well-adapted to Internet applications and provides useful features that are not present in most other codecs. Finally, Speex is part of the GNU Project and is available under the Xiph.org variant of the BSD license. http://speex.org/

gzip -cd speex-1.2beta2.tar.gz | tar xvf -
cd speex-1.2beta2
./configure --prefix=/usr/local/enctools --with-ogg-dir=/usr/local/enctools
make ; make install
cd ..

libdv

Quasar DV Codec: libdv http://libdv.sourceforge.net/

gzip -cd libdv-1.0.0.tar.gz | tar xvf -
cd libdv-1.0.0
./configure --disable-gtk --disable-xv --prefix=/usr/local/enctools
make ; make install
cd ..

libraw1394

The Linux kernel's IEEE 1394 subsystem provides access to the raw 1394 bus through the raw1394 module. http://www.linux1394.org/

gzip -cd libraw1394-1.2.1.tar.gz | tar xvf -
cd libraw1394-1.2.1
./configure --prefix=/usr/local/enctools
make ; make install
cd ..

libavc1394

libavc1394 is a programming interface for the 1394 Trade Association AV/C (Audio/Video Control) Digital Interface Command Set. http://sourceforge.net/projects/libavc1394/

gzip -cd libavc1394-0.5.3.tar.gz | tar xvf -
cd libavc1394-0.5.3
LIBRAW1394_CFLAGS="-I/usr/local/enctools/include/" \
LIBRAW1394_LIBS="-L/usr/local/enctools/lib/ -lraw1394" \
./configure --prefix=/usr/local/enctools
make ; make install
cd ..


live555

LIVE555 Streaming Media (rtsp, rtp support) http://live555.com/liveMedia/

gzip -cd live.2007.08.03a.tar.gz | tar xf -
cd live
./genMakefiles linux
make 
cd ..

folder live - it will be used by VLC in next step

VLC

VLC - the cross-platform media player and streaming server. http://www.videolan.org/vlc/

to avoid "error: redefinition of typedef ‘byte_t’", fix file /usr/local/enctools/include/libraw1394/raw1394.h, comment out line 43:

--skipped--
/* typedef u_int8_t  byte_t; */
--skipped--
bzip2 -cd vlc-0.8.6c.tar.bz2 | tar xvf -
cd vlc-0.8.6c

Building procedure:

CPPFLAGS="-I/usr/local/enctools/include/"; export CPPFLAGS
CFLAGS="-I/usr/local/enctools/include/"; export CFLAGS
LDFLAGS="-L/usr/local/enctools/lib/"; export LDFLAGS
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/enctools/lib/pkgconfig ; export PKG_CONFIG_PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/enctools/lib ; export LD_LIBRARY_PATH

./configure  \
--prefix=/usr/local/enctools \
--enable-dv \
--enable-live555 --with-live555-tree=../live \
--enable-v4l \
--enable-ogg --enable-mad --enable-faad --enable-a52 --enable-flac \
--enable-libmpeg2 --enable-vorbis --enable-speex --enable-theora \
--enable-png --enable-x264 \
--enable-ffmpeg --with-ffmpeg-mp3lame --with-ffmpeg-faac \
--with-ffmpeg-vorbis --with-ffmpeg-theora --with-ffmpeg-ogg \
--disable-wxwidgets --disable-skins2

make ; make install

cd ..


twolame

TwoLAME is an optimised MPEG Audio Layer 2 (MP2) encoder based on tooLAME by Mike Cheng, which in turn is based upon the ISO dist10 code and portions of LAME. http://www.twolame.org/

gzip -cd twolame-0.3.10.tar.gz | tar xf -
cd twolame-0.3.10
./configure --prefix=/usr/local/enctools
make ; make install
cd ..

MPEG4IP

MPEG4IP: Open Source, Open Standards, Open Streaming. http://www.mpeg4ip.net/

Request sources from CVS

cvs -d:pserver:anonymous@mpeg4ip.cvs.sourceforge.net:/cvsroot/mpeg4ip login
cvs -z3 -d:pserver:anonymous@mpeg4ip.cvs.sourceforge.net:/cvsroot/mpeg4ip co -P mpeg4ip

Configuring procedure:

CPPFLAGS="-I/usr/local/enctools/include/"; export CPPFLAGS
CFLAGS="-I/usr/local/enctools/include/"; export CFLAGS
LDFLAGS="-L/usr/local/enctools/lib/"; export LDFLAGS

cd mpeg4ip

./bootstrap                   \
--prefix=/usr/local/enctools  \
--enable-ffmpeg               \
--enable-mp4live              \
--enable-player               \
--enable-server               \
--enable-igmpv3               \
--disable-id3tags

After configuring mpeg4ip reports:
Mp4live encoder report:
    ffmpeg encoder is installed
    xvid encoder is installed
    x264 encoder is installed
    lame encoder is installed
    faac encoder is installed
    twolame encoder is installed

Build mpeg4ip:

make ; make install; cd .. 

Built binaries

Personal tools