Thursday, July 29, 2010

FFMpeg - Building on Windows

FFMpeg is probably the most widely used Encoder/Decoder library. It helps you when are working in a project that involves video processing. As with any open source project, it has very limited documentation. An article by by Martin Böhme (Using libavformat and libavcodec) and Stephen Dranger (FFmpeg and SDL Tutorial) were the only good articles available around. Apart from this, you might need to look into OutputExample.c that comes with the FFMpeg source code. I had a very hard time trying to learn from these tutorials and use 'libavcodec' library in my programs.This has been my prime motivating factor to start this blog.

The first thing about Open Source projects is, they dont distribute binaries. They distribute only the source code. So it makes your life harder to understand to download the source code, setup the build environment and then take a build. This process, though, is inevitable. If you really wish to skip the building process and get only a build, you can get them here. (P.S. these builds are outdated. If you plan to use it in your commercial application, you might need to search for an LGPL build. Else you will end up in FFMpeg's Hall of Shame)

Let's start with the build process. :)

Stuff to Download
  1. Download MinGW from here.
  2. Download MSYS from here.
  3. Download updated bash for MSYS from here.
  4. Get the latest snapshot of ffmpeg from here

Installing MinGW
  1. Click 'Next'
  2. Choose 'Download and Install' and click 'Next'
  3. Click 'I Agree'
  4. Choose 'Current' and then 'Next'
  5. Choose 'MinGW base tools' and 'MinGW Make'
  6. Choose Destination folder as 'C:\MinGW'
  7. Click 'Install'. The download will take some time and then will complete the installation.
  8. Click 'Next' and then 'Finish' to complete the installation.
Installing MinSys
  1. Click 'Yes'
  2. Click 'Next'
  3. Agree to the license agreement by clicking 'Yes'
  4. Click 'Next'
  5. Choose 'C:\msys\1.0' as destination folder and click 'Next'. Click 'Yes' to create a directory if not already there
  6. 'Installation for i386 based CPUs' should be selected, Click 'Next'
  7. Click 'Next' and then 'Install'
  8. The command window that opens will ask if you wish to continue with post install, type 'y'and press enter.
  9. Type 'y' and press enter when it asks if you have MinGW installed.
  10. Type 'C:/mingw' when it asks for your MinGW installation. (without quotes)
  11. Type 'y' when if it asks for adding mount bindings.
  12. Press enter and then Click 'Finish' to complete the installation.
Building FFMpeg
  1. Extract CoreUtils to a folder. Copy the contents in the extracted 'bin' folder to "C:\msys\1.0\bin"
  2. Extract the ffmpeg sources. I’ll assume you’ve extracted them to c:\work\ffmpeg .
  3. Open MSYS and navigate to C:\work\ffmpeg
  4. Type "./configure --enable-memalign-hack --enable-shared" and press Enter. --enable-memalign-hack is to specify that you need windows binaries and --enable-shared is to specify to build 'libavcodec.dll' and 'libavformat.dll'
  5. By default, it is an LGPL build. You need specify -enable-gpl. For more info on command line arguments, type ./configure --help
  6. Type 'make' and press 'Enter'
And there you have it, your ffmpeg binaries are ready to be used.

I have personally verified all the above mentioned steps, but then you may face problems during the whole process. The following links might of use in that case.

Installing MSYS

Building ffmpeg on windows

Building FFMpeg on linux is fairly easy. I have not tried building it on other platforms.

Wednesday, July 28, 2010

WAMP : Windows - Apache - MySQL - PHP

I have been using phptriad 2.2.1 on Windows for a very long time. It just made my work so easy. The combination of PHP, MySQL and Apache is extremely powerful when you need to quickly develop web pages.

Unfortunately, there were no newer versions of the triad available on the internet, and therefore I was not able to work with PHP5. As I searched for alternative solutions, I came across WAMP Server.

The WAMP Server looks a compact solution. The features (upgrade, opening up localhost, PHPMyAdmin) available in the System Tray menu make your life lot easier. For people who used the 'htdocs' folder to copy your PHP scripts, you must create a folder in the 'www' directory and paste your code in there.

Let us Explore

It was 10 years back that I wrote my first 'Hello World' program in C and the world of software programming has fascinated me ever since.

I have come across various software, open source tools, languages which I find useful in my day to day work. Few of those have been easy to learn and use, while others have not been easy. This blog is my effort to write a bit about the stuff that I learn. A good friend of mine recently said, 'Knowledge multiplies when shared'. Hope you guys find it useful too.

Cheers !!