Compiling FFMPEG 0.6 with RTMP Support for OSX

June 30, 2010 | Video | 10 Comments

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.

Flash Video Streaming Solutions

November 8, 2009 | Projects | 4 Comments

So one of my secret obsessions is with video. I like to record video. I like to watch it. I like everything about it. But what I really like about it is the technology behind it. Call me crazy but I love to figure out how to encode a clip or video and see how good I can compress it using different codecs. Maybe that’s why I love working where I work. Since I ‘m a Flash / Flex programmer I have been wanting to investigate different streaming solutions for flash and see what is available and what will work with my little at home project.

This little project I’ve been playing around with is trying to get my HDHomeRun (HDHR) to rebroadcast its live feed to flash. I’ve been investigating technologies like Red5, C++ RTMP Server and Flash Media Server. With anything that requires multiple pieces of different technologies. The hard part is integrating these different pieces together. Luckily the HDHR is open source. So that provides a lot of avenues for development. The only hard part is trying to get the MPEG-TS from the HDHR and convert it on the fly to something flash can use.

So far I haven’t been able to get any of the solutions to work. but as soon as I do I’ll post something here.

Fork me on GitHub