Category Archives: Development

Converting video for flash video players to H.264/AAC

Have you ever tried to put a video online? Well actually it is quite easy if you user YouTube. No matter what codec you use you have a good chance to get a decent result. If you want to host the video yourself you basically need a flash video player (assuming that flash is the most widely spread tool on multiple platforms) like the JW FLVPlayer. Finally you’ll need to get your video file to a format flash can play using progressive download (which means you can watch it while downloading, just like on YouTube).

Since Adobe Flash Player 9 Update 3Flash can play back MP4 files with H.264 video and AAC audio streams [see here], so we can just focus on this one. First step is to get a ffmpeg version compiled with libx264 and libfaac. You might check this on the command line, just execute ffmpeg without parameters:

FFmpeg version SVN-r16573, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: […] –enable-libfaac –enable-libgsm –enable-libx264 […]

The bold ones should be there to support the needed codecs. I used FFmpeg Revision 16537 from this page, which works fine.

If the libraries are there you can proceed to the next step:

ffmpeg -i <inputfile> -b 1024k -vcodec libx264 \\
-acodec libfaac -ab 160k <output.mp4>

This converts your input file to the needed mp4 file. You can also change the size of the file with the switch “-s”, like for instance “-s 320×240”. Take a close look on the switches “-b” and “-ab” which define video and audio bitrate. If the sum of both bitrates is too high for the network the user will not be able to watch the video smoothly.

One might think s/he’s finished, but no … unfortunately progressive download doesn’t work with too many mp4 files. The file index (an atom == “mp4 metadata unit”) containing the file index (== the description where the video and the audio stream are located in the file and how they are stored) is at the end of the MP4 file. So the flash player has to download the whole file before starting the playback, ka-ching!

Fortunately there is an ffmpeg tool called qt-faststart (linux users will find it in the tools folder of ffmpeg) moving the index from end to start. For windows user a precompiled binary can be found here. Use this to move the metadata:

qt-faststart <infile.mp4> <outfile.mp4>

Now you are done with the file. Use for instance the JW FLVPlayer setup wizard to create an HTML snippet. Note that in height you have to add 19 pixels to your video dimensions, as this is the height of the control bar of the player 😀

NetBeans Community Approves NetBeans 6.7 for Prime Time Release

The NetBeans community acceptance survey has voted for thhe last NetBeans 6.7 RC to be stable enough to be shipped. While this sounds great there is one minor details I consider critical for the significance of the survey: Only 182 people responded. (re-engineneered from 144 people being 79%). If we go with common numbers in empirical research ~5 % of the population take part in survey like these and therefore I conclude that the size of the NetBeans community is around 3.600 people.

NetBeans is actually having quite a a hard time with Eclipse pressing from open source and Idea pressing from commercial alternatives. Also the free IDEs of Microsoft’s .NET family affect the scene. However, I still think that if NetBeans manages to advance from the “I can do all” principle to a small and lean application development environment featuring a fast and intelligent editor and a WYSIWYG gui builder there is definitely a chance.


How to get a lot of photos …

I’m currently testing a new implementation of an approximate search index for content based image retrieval. Especially the performance tests have become interesting as I didn’t have access to a real big data size. So what to do?

Actually I programmed a lot of spiders and grabbers before, so I knew that there is a lot of data available on Flickr 🙂 But I was still searching for an easy way. Now here is my approach (using of course bash):

wget -q -O - | grep -o .............static.*m.jpg | wget -i -

Why should this work?

  • The first wget command gets a list of recent photos as atom feed.
  • The grep command gets out all the medium sized (suffix “m.jpeg”) pictures
  • The lot of dots and the static are just a nice trick to get the right ones, the real image content.
  • Finally the second wget downloads the images from the server.

Issuing this command one should get ~ 25 photos in one go. Using a bash loop or a cronjob you can get of course a lot more in an unattended way 🙂

Report from the Open Source Track @ ACM MM

Within the open source track of the ACM Multimedia conference the SIGMM  (Special Interest Group on Multimedia of the ACM) wants to provide a platform on discussing tools and code free to use in research as well as industry project. As I already blogged I had a presentation on Lire there. However all other contributors were nearly as interesting, if not even more 😉

Marco Lohse presented a Network-Integrated Multimedia Middleware (NMM), which was developed at Saarland University and is now available with dual licensing. He is also CEO of the company selling the non GPL license. The software is impressive and his demo was great. No surprise he won the prize of 700 $. (

Yannick Alluse presented GpuCV, an extension of OpenCV towards CUDA and shader based computing. Important thing is that the library decides whether CPU, Shader or the GPU will be used for processing. (

Andreas Berger showed a framework for DVB-* transmission. It allows for inexpensive setup of for instance a DVB-T or DVB-H broadcasting service in labs or research projects. As its very generic one can compose the DVB stream fully free, so MHP, IP Data, EPG and so on are possible. (

Jose San Pedro Wandelmer from the University of Sheffield presented his project FOBS, which is actually a wrapper for ffmpeg for C++ and JMF. I already knew FOBS as I have used it several times, but meeting Jose and talking to him was great. (

CBIR for Facebook: img(Finder)

img(Finder) Screenshot

Recently Savvas Chatzichristofis released a Facebook app based on his tool img(Rummager) to retrieve the photos of Facebook contacts based on image content. The tool – called img(Finder) – allows to connect to a Facebook account and creates an index based on the CEDD and FCTH image features. img(Finder) indexes the images of all Facebook friends. Querying the index is done by sketch (painting tool is included) or by sample image. Best of all: The tool is open source 🙂


Visual VM is Part of Java 1.6 Update 7

visualvm.pngJava 1.6 u7 was released recently by Sun. While not bringing major changes it brought along some bug fixes and solved some security issues. However there is one main addition: The VisualVM. This is a really great developer tool: It connects to running VMs and shows “some statistics” about them. Besides memory usage and threads information it also allows to do some basic profiling. In my opinion Sun did a good job on including VisualVM in the package! Not that this thing is build on the NetBeans Platform 😉


Finding duplicate code …

I recently found myself in a scenario, where I tried to figure out how implementation clusters have been implicitly created within a group of students. All of them were given a task (with 4 sub tasks) for a whole semester. Everyone was meant to do the task alone, but collaboration was allowed. However I needed to know who helped whom and – of course – who helped whom with source code.

A colleague had a similar problem and he pointed me to PMD CPD (= PMD Copy & Paste Detector) . This tool works lightning fast and has a GUI 🙂 Also its open source -> respect!


Compiler Construction & Lord of the Rings

Recently I had an idea on compilers and code generation. Generating assembler code (I’m talking about MIPS code) and with it labels I thought: Why not using cool names for labels? Instead of

beq $a1, $v1,  LB_WH002_002G
add $a1, $a1, $v1
j  LB_WH002_001G

One could be more creative and use for instance Names from Lord of the Rings like:

beq $a1, $v1,  MORDOR
add $a1, $a1, $v1

While this definitely does not increase readability of assembler code I still think it doesn’t lessen it much. Instead it introduces “geekiness” to assembler 🙂

For those who are not creative themselves and need a lot of labels I recommend the numerous fanrtasy fantasy name generators available on the internet like this, this or this one.

Lire: Submission to the ACM Multimedia Open Source Contest 2008

I recently submitted Lire and LireDemo to the ACM Multimedia Open Source Software Competition 2008. As I’d really like to go there I hope it will judged as relevant contribution and a demo at the ACM Multimedia is requested. Note that I’ve integrated a new feature in LireDemo for the ACM Multimedia submission: Now its easier to test Lire by just indexing random photos from Flickr. By just hitting the “Index” button without giving a directory of images the download will start automatically.


Lire SVN build for Java 1.5

Due to requests I took some time and built a Java 1.5 version instead of the 1.6 versions. A simple compile with 1.5 wouldn’t help as I use the swing layout classes of NetBeans (now integrated in Java 1.6), so imports have to be re-adjusted and the library has to be added. Furthermore I created an explicit build target in Caliph to create a 1.5 version of the cbir jar file. This snapshot works fine with MacOS (as far as I’ve heard) and on Windows.