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

July 10, 2009 on 2:58 pm | Tags: , , , , , | In Development, Flash, General, Multimedia | No Comments

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 :-D

Weekend Post on Team Fortress 2: Meet the Spy

May 31, 2009 on 12:05 pm | Tags: , , , , | In Games, General | No Comments

The TF2 team has prepared another great video on the gameplay characters. Now the spy is the one every looks (or tries to look) at :)

You’ve met the Scout, the Soldier, the Demoman, the Heavy, the Engineer, and the Sniper. Then, for some reason, a sandwich. But now it’s time to meet the stealthiest, shiftiest, most secretive, suit-wearing TF team member of all…

…again…

That’s right, it’s finally time to Meet the Suit-Wearing Secret Sandwich!

No, it’s Meet the Spy.

via Team Fortress 2.

Links

WIAMIS 2008 talk: Video summarization through acceleration

May 8, 2008 on 8:22 am | Tags: , , , , | In Conference, Science, Workshop | No Comments

With the contribution “Redundancy Removing by Adaptive Acceleration and Event Clustering for Video Summarization” Bernard Mérialdo presented a very interesting approach to video summarization. Beside other methods the video is accelerated. Based on the overall motion the actual amount of acceleration is adapted. Furthermore they apply hierarchical clustering on fixed size segments to select most important parts. Therefore the video is faster when not very much motion is going on and slower if fast motion is characteristics for a video segment. Nice added value was hat he described the RUSHES track of TRECVID and the evaluation process. Experts evaluate the accuracy of the summaries and weight them with extraction time and size of the summary.

Enhancing the YouTube Experience.

April 24, 2008 on 3:48 pm | Tags: , , | In General, YouTube | No Comments

:en:YouTube :en:headquarters at 1000 Cherry Avenue in :en:San Bruno, California. YouTube moved into this building in October 2006, after outgrowing their previous headquarters in a loft above a pizzeria.Image via WikipediaLifehacker recently gave two tips on the use of YouTube. The first one targets at watching videos from outside the region where they are allowed (mainly US :-D ). You just need to change the URL and everything works fine.

The other one features a bookmarklet for downloading the mp4 files of the videos. You just need to add it to your bookmarks and on click it will add a download link for the mp4 file.

Furthermore there is a “Better YouTube” Firefox plugin, which already does a lot of the things the articles describe.

H.264 compression test published

March 10, 2008 on 9:58 am | Tags: , , , , , , , | In General, Multimedia, Video | 2 Comments

Today I found a compression test on different H.264 (and one MPEG-4 ASP) encoders. They tested the compression to visual quality ratio and found out that the MainConcept encoder (German company, recently acquired by DivX) performs best. The difference to the next rank however is marginal and x264 is second. Deciding based on a compression to price ratio will therefore be very easy :)

Related Links:

Metadata for the MP4 container

March 7, 2008 on 11:20 am | Tags: , , , | In MPEG, Mpeg-4, Video | 2 Comments

Have you ever wondered why there is no title or description in your AVI files just like you expect it to be there in your MP3 files? Well AVI does not really support these things. However the Moving Pictures Expert Group has defined the MP4 container format for audiovisual information (which is very much like the MOV container) and did not forget about metadata: They defined a way to put it in there. However as it always comes with standards, where a whole lot of people talk and try to find common ground, there is not one simple way (like ID3), but several complicated ways to choose from. Therefore applications like VLC or Winamp do not support MP4 metadata out of the box. Due to the string relation to the MOV format however iTunes supports MP4 metadata.

Thanks to Markus Waltl I got some links for tools reading and manipulating MP4 metadata. They all have in common that they are rather slow:

  • AtomicParsley – A command line tool for reading and setting metadata in MPEG-4 files. Has also a good explanation of the MP4 atoms here.
  • Yamb – A GUI tool using MP4box and AtomicParsley.
  • mp4tag – Part of mpeg4ip, a framework for handling mp4 files.

© 2004-2007 by Mathias Lux
>> Contents of this page are licensed under the CreativeCommons Attribution 2.5 license <<