Compiling FFMPEG 0.6 with RTMP Support for OSX
The other day FFMPEG released version 0.6 nick named “Works with HTML5″. Today I’m going to try to describe the steps on how to compile this new release in OSX with RTMP support. This wont be for the faint of heart.
First you will need to download and install Xcode and then MacPorts. Please go here for MacPort download and install instructions.
Once when MacPorts is done being installed you will need to install a few packages. They include yasm, pkgconfig and openssl. So lets begin getting those installed first. Type the following command into terminal and then press enter.
sudo port install yasm pkgconfig openssl
Once when this is complete you will need to download a few extra files. We are going to compile these manually so we make sure we have the latest and greatest.
FAAC v1.28
FAAD2 v2.7
Lame
LIBRTMP
x264 (download the latest build)
FFMPEG 0.6
First you will want to extract each archive. In OSX you can double-click on the archive to extract or else in terminal use the following command.
tar xzf FILE_NAME.tar.gz
Now it’s time to compile each library. Don’t worry its very easy. For the rest of the steps we will only be working in terminal. So open it up and navigate to where you downloaded your files. Mine are located in my Downloads folder.
cd ~/Downloads
Enter the following commands to navigate to your faac folder, configure, compile and install.
cd faac-1.28/
./configure
make
make install
Now to compile Faad
cd ../faad2-2.7/
./configure
make
make install
Lames turn
cd ../lame-3.98.4/
./configure
make
make install
RTMP is a little different.
cd ../rtmpdump-2.2e/
make SYS=MacOSX
make install
Your path to h264 will most likely be different from mine.
cd ../x264-snapshot-20100629-2245/
./configure
make
make install
Finally FFMPEG 0.6. This also requires a few more steps.
cd ../ffmpeg-0.6/
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libx264 --enable-libvpx --enable-librtmp
make
make install
Done! now you are ready to encode your file and send it to an RTMP server. I’ve been using the following command to test this.
ffmpeg -i INPUT_FILE -re -ac 2 -acodec libfaac -vcodec libx264 -vpre default -s 480x320 -f flv rtmp://localhost:1935/rtmp/test
Just replace INPUTE_FILE with the video you want to transcode and rtmp://localhost:1935/rtmp/test with the RTMP server you want to publish to. This could be a Flash Media Server, Wowza Server, Red5, Erlyvideo or any other server that supports this functionality.
[...] I posted about compiling FFMPEG with RTMP support. Now I'm going to describe what you have to do to view that content with Erlyvideo running [...]
Thanks Nate. I had to install libSDL and libvpx as well …
git clone git://review.webmproject.org/libvpx.git
cd libvpx
autoreconf -i
./configure
make
make install
cd ..
wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz
tar xvfz SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure
make
make install
isn’t librtmp statically compiled with ffmpeg?
As far as i know you have to have the libraries compiled and installed before you can compile ffmpeg. or else the flag –enable-librtmp wont work.
I have compiled rtmpdump-2.2e and dragged the librtmp folder into ffmpeg-0.6 folder, then,
I tried compiling ffmpeg-0.6 with –enable-librtmp for iphone but getting error ERROR: librtmp not found. Can you please tell me what am I doing wrong.
Thank u.
I’m not sure how to compile ffmpeg and rtmpdump for iphone… To compile them on the mac. It sounds like you skipped the “make install” step.
longlong@longlong:~/Doc/workspace/ffmpeg$ ffmpeg -i avatar.flv -re -ac 2 -acodec libfaac -vcodec libx264 -vpre default -s 480×320 -f flv rtmp://localhost/oflaDemo
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
built on Mar 30 2011 01:58:38 with gcc 4.4.3
configuration: –enable-gpl –enable-nonfree –enable-pthreads –enable-libfaac –enable-libmp3lame –enable-libx264 –enable-libvpx –enable-librtmp
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0
avatar.flv: No such file or directory
The command is wrong….why? I just do what you said…
It can’t find your input file “avatar.flv: No such file or directory”
haha,thanks~ I success ^^
I already install “mac port” & “sudo port install yasm pkgconfig openssl”, i succes until this step but when i go to the next step, which is
cd faac-1.28/
./configure
make
make install
when run the “make” the result is
make all-recursive
Making all in include
make[2]: Nothing to be done for `all’.
Making all in libfaac
make[2]: Nothing to be done for `all’.
Making all in common
Making all in mp4v2
make[3]: Nothing to be done for `all’.
make[3]: Nothing to be done for `all-am’.
Making all in frontend
make[2]: Nothing to be done for `all’.
and when i execute the “make install”
Making install in include
make[2]: Nothing to be done for `install-exec-am’.
test -z “/usr/local/include” || /Users/livingworld/Downloads/faac-1.28/install-sh -d “/usr/local/include”
/usr/bin/install -c -m 644 ‘faac.h’ ‘/usr/local/include/faac.h’
/usr/bin/install -c -m 644 ‘faaccfg.h’ ‘/usr/local/include/faaccfg.h’
Making install in libfaac
test -z “/usr/local/lib” || /Users/livingworld/Downloads/faac-1.28/install-sh -d “/usr/local/lib”
/bin/sh ../libtool –mode=install /usr/bin/install -c ‘libfaac.la’ ‘/usr/local/lib/libfaac.la’
/usr/bin/install -c .libs/libfaac.0.0.0.dylib /usr/local/lib/libfaac.0.0.0.dylib
(cd /usr/local/lib & })
(cd /usr/local/lib & })
/usr/bin/install -c .libs/libfaac.lai /usr/local/lib/libfaac.la
/usr/bin/install -c .libs/libfaac.a /usr/local/lib/libfaac.a
chmod 644 /usr/local/lib/libfaac.a
ranlib /usr/local/lib/libfaac.a
———————————————————————-
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR’
flag during linking and do at least one of the following:
– add LIBDIR to the `DYLD_LIBRARY_PATH’ environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-
make[2]: Nothing to be done for `install-data-am’.
Making install in common
Making install in mp4v2
make[3]: Nothing to be done for `install-exec-am’.
make[3]: Nothing to be done for `install-data-am’.
make[3]: Nothing to be done for `install-exec-am’.
make[3]: Nothing to be done for `install-data-am’.
Making install in frontend
test -z “/usr/local/bin” || /Users/livingworld/Downloads/faac-1.28/install-sh -d “/usr/local/bin”
/bin/sh ../libtool –mode=install /usr/bin/install -c ‘faac’ ‘/usr/local/bin/faac’
/usr/bin/install -c .libs/faac /usr/local/bin/faac
test -z “/usr/local/share/man/man1″ || /Users/livingworld/Downloads/faac-1.28/install-sh -d “/usr/local/share/man/man1″
/usr/bin/install -c -m 644 ‘./../docs/faac.1′ ‘/usr/local/share/man/man1/faac.1′
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
i keep try with the other
FAAC v1.28
FAAD2 v2.7
Lame
LIBRTMP
x264
FFMPEG 0.6
but until the end, when i tried to check the version of my FFMPEG the result is
“-bash: ffmpeg: command not found”
Can you solve me to solve this problem? did i need to upload the “./configure” either?
thank you