Шукати в цьому блозі

середу, 22 вересня 2010 р.

Cборка ffmpeg с поддержкой librtmp в Ubuntu 10.04.1 server

Принимаем, что librtmp уже установлена.

Скачиваем последний ffmpeg:
sudo apt-get install git-core
git clone git://git.ffmpeg.org/ffmpeg/
cd ffmpeg
git clone git://git.ffmpeg.org/libswscale/


Cмотрим доступные функции для конфигурирования:

~/ffmpeg$ ./configure --help

Usage: configure [options]
Options: [defaults in brackets after descriptions]
Standard options:
--help print this message
--logfile=FILE log tests and output to FILE [config.log]
--disable-logging do not log configure debug information
--prefix=PREFIX install in PREFIX []
--bindir=DIR install binaries in DIR [PREFIX/bin]
--datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
--libdir=DIR install libs in DIR [PREFIX/lib]
--shlibdir=DIR install shared libs in DIR [PREFIX/lib]
--incdir=DIR install includes in DIR [PREFIX/include]
--mandir=DIR install man page in DIR [PREFIX/share/man]

Configuration options:
--disable-static do not build static libraries [no]
--enable-shared build shared libraries [no]
--enable-gpl allow use of GPL code, the resulting libs
and binaries will be under GPL [no]
--enable-version3 upgrade (L)GPL to version 3 [no]
--enable-nonfree allow use of nonfree code, the resulting libs
and binaries will be unredistributable [no]
--disable-doc do not build documentation
--disable-ffmpeg disable ffmpeg build
--disable-ffplay disable ffplay build
--disable-ffprobe disable ffprobe build
--disable-ffserver disable ffserver build
--disable-avdevice disable libavdevice build
--disable-avcodec disable libavcodec build
--disable-avcore disable libavcore build
--disable-avformat disable libavformat build
--disable-swscale disable libswscale build
--enable-postproc enable GPLed postprocessing support [no]
--disable-avfilter disable video filter support [no]
--disable-pthreads disable pthreads [auto]
--enable-w32threads use Win32 threads [no]
--enable-x11grab enable X11 grabbing [no]
--disable-network disable network support [no]
--disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
--enable-gray enable full grayscale support (slower color)
--disable-swscale-alpha disable alpha channel support in swscale
--disable-fastdiv disable table-based division
--enable-small optimize for size instead of speed
--disable-aandct disable AAN DCT code
--disable-dct disable DCT code
--disable-fft disable FFT code
--disable-golomb disable Golomb code
--disable-huffman disable Huffman code
--disable-lpc disable LPC code
--disable-mdct disable MDCT code
--disable-rdft disable RDFT code
--disable-vaapi disable VAAPI code
--disable-vdpau disable VDPAU code
--disable-dxva2 disable DXVA2 code
--enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
--enable-hardcoded-tables use hardcoded tables instead of runtime generation
--enable-memalign-hack emulate memalign, interferes with memory debuggers
--disable-everything disable all components listed below
--disable-encoder=NAME disable encoder NAME
--enable-encoder=NAME enable encoder NAME
--disable-encoders disable all encoders
--disable-decoder=NAME disable decoder NAME
--enable-decoder=NAME enable decoder NAME
--disable-decoders disable all decoders
--disable-hwaccel=NAME disable hwaccel NAME
--enable-hwaccel=NAME enable hwaccel NAME
--disable-hwaccels disable all hwaccels
--disable-muxer=NAME disable muxer NAME
--enable-muxer=NAME enable muxer NAME
--disable-muxers disable all muxers
--disable-demuxer=NAME disable demuxer NAME
--enable-demuxer=NAME enable demuxer NAME
--disable-demuxers disable all demuxers
--enable-parser=NAME enable parser NAME
--disable-parser=NAME disable parser NAME
--disable-parsers disable all parsers
--enable-bsf=NAME enable bitstream filter NAME
--disable-bsf=NAME disable bitstream filter NAME
--disable-bsfs disable all bitstream filters
--enable-protocol=NAME enable protocol NAME
--disable-protocol=NAME disable protocol NAME
--disable-protocols disable all protocols
--disable-indev=NAME disable input device NAME
--disable-outdev=NAME disable output device NAME
--disable-indevs disable input devices
--disable-outdevs disable output devices
--disable-devices disable all devices
--enable-filter=NAME enable filter NAME
--disable-filter=NAME disable filter NAME
--disable-filters disable all filters
--list-decoders show all available decoders
--list-encoders show all available encoders
--list-hwaccels show all available hardware accelerators
--list-muxers show all available muxers
--list-demuxers show all available demuxers
--list-parsers show all available parsers
--list-protocols show all available protocols
--list-bsfs show all available bitstream filters
--list-indevs show all available input devices
--list-outdevs show all available output devices
--list-filters show all available filters

External library support:
--enable-avisynth enable reading of AVISynth script files [no]
--enable-bzlib enable bzlib [autodetect]
--enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
--enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
--enable-libopencv enable video filtering via libopencv [no]
--enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
--enable-libdirac enable Dirac support via libdirac [no]
--enable-libfaac enable FAAC support via libfaac [no]
--enable-libgsm enable GSM support via libgsm [no]
--enable-libmp3lame enable MP3 encoding via libmp3lame [no]
--enable-libnut enable NUT (de)muxing via libnut,
native (de)muxer exists [no]
--enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
--enable-librtmp enable RTMP[E] support via librtmp [no]
--enable-libschroedinger enable Dirac support via libschroedinger [no]
--enable-libspeex enable Speex decoding via libspeex [no]
--enable-libtheora enable Theora encoding via libtheora [no]
--enable-libvorbis enable Vorbis encoding via libvorbis,
native implementation exists [no]
--enable-libvpx enable VP8 support via libvpx [no]
--enable-libx264 enable H.264 encoding via x264 [no]
--enable-libxavs enable AVS encoding via xavs [no]
--enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no]
--enable-mlib enable Sun medialib [no]
--enable-zlib enable zlib [autodetect]

Advanced options (experts only):
--source-path=PATH path to source code [/home/emutant/ffmpeg]
--cross-prefix=PREFIX use PREFIX for compilation tools []
--enable-cross-compile assume a cross-compiler is used
--sysroot=PATH root of cross-build tree
--sysinclude=PATH location of cross-build system headers
--target-os=OS compiler targets OS []
--target-exec=CMD command to run executables on target
--target-path=DIR path to view of build directory on target
--nm=NM use nm tool
--ar=AR use archive tool AR [ar]
--as=AS use assembler AS []
--cc=CC use C compiler CC [gcc]
--ld=LD use linker LD
--host-cc=HOSTCC use host C compiler HOSTCC
--host-cflags=HCFLAGS use HCFLAGS when compiling for host
--host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
--host-libs=HLIBS use libs HLIBS when linking for host
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS []
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS []
--extra-libs=ELIBS add ELIBS []
--extra-version=STRING version string suffix []
--build-suffix=SUFFIX library name suffix []
--arch=ARCH select architecture []
--cpu=CPU select the minimum required CPU (affects
instruction selection, may crash on older CPUs)
--disable-asm disable all assembler optimizations
--disable-altivec disable AltiVec optimizations
--disable-amd3dnow disable 3DNow! optimizations
--disable-amd3dnowext disable 3DNow! extended optimizations
--disable-mmx disable MMX optimizations
--disable-mmx2 disable MMX2 optimizations
--disable-sse disable SSE optimizations
--disable-ssse3 disable SSSE3 optimizations
--disable-armv5te disable armv5te optimizations
--disable-armv6 disable armv6 optimizations
--disable-armv6t2 disable armv6t2 optimizations
--disable-armvfp disable ARM VFP optimizations
--disable-iwmmxt disable iwmmxt optimizations
--disable-mmi disable MMI optimizations
--disable-neon disable neon optimizations
--disable-vis disable VIS optimizations
--disable-yasm disable use of yasm assembler
--enable-pic build position-independent code
--malloc-prefix=PFX prefix malloc and related names with PFX
--enable-sram allow use of on-chip SRAM

Developer options (useful when working on FFmpeg itself):
--disable-debug disable debugging symbols
--enable-debug=LEVEL set the debug level []
--disable-optimizations disable compiler optimizations
--enable-extra-warnings enable more compiler warnings
--disable-stripping disable stripping of executables and shared libraries
--samples=PATH location of test samples for FATE

NOTE: Object files are built at the place where configure is launched.


Вот она поддержка: --enable-librtmp enable RTMP[E] support via librtmp [no]

Смотрим текущую конфигурацию ffmpeg

ffmpeg
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-version3 --enable-yasm --enable-libfaad --enable-libgsm --enable-libfaac --enable-libx264 --enable-libxvid


Конфигурим с теми же параметрами, так как необходимые библиотеки у нас есть, добавляем ьолько поддержку librtmp (параметр --enable-librtmp):

./configure --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-version3 --enable-yasm --enable-libgsm --enable-libfaac --enable-libx264 --enable-libxvid --enable-librtmp

Собираем и устанавливаем:

make
sudo make install
make clean


Пытаемся запустить:

ffmpeg
ffmpeg: error while loading shared libraries: libavcore.so.0: cannot open shared object file: No such file or directory


Смотрим зависимости (ldd - print shared library dependencies):

ldd `which ffmpeg`
linux-vdso.so.1 => (0x00007fff9fdff000)
libavdevice.so.52 => /usr/local/lib/libavdevice.so.52 (0x00007fcc383c5000)
libavfilter.so.1 => /usr/lib/libavfilter.so.1 (0x00007fcc381b8000)
libavformat.so.52 => /usr/local/lib/libavformat.so.52 (0x00007fcc37ee1000)
libavcodec.so.52 => /usr/local/lib/libavcodec.so.52 (0x00007fcc3721a000)
libswscale.so.0 => /usr/lib/libswscale.so.0 (0x00007fcc36fc5000)
libavcore.so.0 => not found
libavutil.so.50 => /usr/lib/libavutil.so.50 (0x00007fcc36db2000)
libm.so.6 => /lib/libm.so.6 (0x00007fcc36b2f000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007fcc36911000)
libc.so.6 => /lib/libc.so.6 (0x00007fcc3658e000)
libavcore.so.0 => not found
libavcore.so.0 => not found
librtmp.so.0 => /usr/lib/librtmp.so.0 (0x00007fcc36374000)
libz.so.1 => /lib/libz.so.1 (0x00007fcc3615d000)
libavcore.so.0 => not found
libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0x00007fcc35e4e000)
libx264.so.98 => /usr/lib/libx264.so.98 (0x00007fcc35bb7000)
libopencore-amrwb.so.0 => /usr/lib/libopencore-amrwb.so.0 (0x00007fcc3599a000)
libopencore-amrnb.so.0 => /usr/lib/libopencore-amrnb.so.0 (0x00007fcc35760000)
libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0x00007fcc354e5000)
libgsm.so.1 => /usr/lib/libgsm.so.1 (0x00007fcc352d6000)
libfaac.so.0 => /usr/lib/libfaac.so.0 (0x00007fcc350c4000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcc385da000)
libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0x00007fcc34e21000)
libgcrypt.so.11 => /lib/libgcrypt.so.11 (0x00007fcc34ba9000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fcc34895000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fcc3467d000)
libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0x00007fcc3446c000)
libgpg-error.so.0 => /lib/libgpg-error.so.0 (0x00007fcc34268000)


И где же наш libavcore.so.0 ?

find /usr/local/lib/ | grep -E "libavcore.so.0"

/usr/local/lib/libavcore.so.0.9.0
/usr/local/lib/libavcore.so.0


Далее

cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf


Добавим:

sudo nano /etc/ld.so.conf
/usr/local/libevent-1.4.14b/lib
/usr/local/lib

sudo ldconfig



Запускаем ffmpeg:

ffmpeg
FFmpeg version git-120610e, Copyright (c) 2000-2010 the FFmpeg developers
built on Sep 21 2010 16:50:07 with gcc 4.4.3
configuration: --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-version3 --enable-yasm --enable-libgsm --enable-libfaac --enable-libx264 --enable-libxvid --enable-librtmp
libavutil 50.27. 0 / 50.27. 0
libavcore 0. 9. 0 / 0. 9. 0
libavcodec 52.89. 0 / 52.89. 0
libavformat 52.78. 5 / 52.78. 5
libavdevice 52. 2. 2 / 52. 2. 2
libavfilter 1.39. 0 / 1.39. 0
libswscale 0.11. 0 / 0.11. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'


Собран, работает :)

В процессе поиска неисправностей читался источник.

вівторок, 21 вересня 2010 р.

Установка librtmp-dev в Ubuntu 10.04

librtmp-dev в Ubuntu 10.04 в стандартных репозиториях я не смог обнаружить, хотя в maveriсk этот пакет есть.

Пошастав по UbuntuUpdates.org

нашел необходимый пакет в 3rd Party Repository: Lucidbleed.

Есть также в 3rd Party Repository: Xbmc

Добавляем репозиторий и устанавливаем необходимый пакет, входящий в rtmpdump.

sudo add-apt-repository ppa:lucid-bleed/ppa
sudo aptitude update
sudo aptitude install rtmpdump
sudo aptitude install librtmp-dev

понеділок, 20 вересня 2010 р.

Ubuntu 10.04 + Sun Java 6

В Ubuntu 10.04 исчезла из официальных репозиториев Sun-вская Java 6.
В замен предлагают openjdk. Однако, почему-то, не все, что требует Java, переваривает openjdk, без извращений.
Как вариант - собрать пакет, взятый с оригинального сайта, но есть пути попроще.
В /etc/apt/sources.list раскомментировать строку:

deb http://archive.canonical.com/ubuntu lucid partner

Далее, как обычно:

sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-bin sun-java6-plugin

суботу, 18 вересня 2010 р.

UPD: Linux (Ubuntu) + ffmpeg with amr, mp3, faac, libgsm

Дополнительно к заметке.

п.6. В версии Ubuntu 10.04 Package libopencore-amrnb-dev и libopencore-amrwb-dev

Если хотим добавить libgsm :

sudo apt-get install libgsm1-dev libgsm-tools

Информация о пакетах (Ubuntu libgsm package):

libgsm-tools: User binaries for a GSM speech compressor
libgsm1: Shared libraries for GSM speech compressor
libgsm1-dbg: Shared libraries for GSM speech compressor (debug symbols)
libgsm1-dev: Development libraries for a GSM speech compressor



UPD 30.09.2010: В Ubuntu 10.04 ("Lucid Lynx") если необходимо установить libxvid.

Необходимо вместо libxvidcore4-dev указывать в комманде libxvidcore-dev т.е.

sudo apt-get install libxvidcore-dev