9th October 2008

Notes and links concerning the creation, conversion and streaming of video on a web page, in no particular order.

Specifications

Specs for supported Flash Video formats: http://osflash.org/flv

HOWTOs

Converting uncompressed AVI to high quality FLV using AviSynth This HOWTO refers to Flash 8.

Flash Players

Most players seem to come in a free version, and a licenced version with additional features.

JWPlayer – Open Source. I really like this one.

FLV Player – Free, good, but no full-screen mode.

FlowPlayer – How I missed this one, I’ll never know. Great range of display formats and features. This is the only player I know that is able to play an MP4/H.264 video and fall back to an FLV file if the Flash Player installed does not support the H.264 format. Flash 9.115 minimum is required to support H.264/MP4 containers, and not everyone has that version.

Other Tools and Converters

Avidemux for Windows provides conversion with a simple-to-use GUI interface. GUI always wins the day when experimenting with this stuff. You can go back to command-line options when converting in batch.

Another tool on the same site, ‘MakeInstantPlayer’ will encode a video into a self-contained Windows executable. That is very handy for presentations and distribution, where the end user is not expected to have their own players installed.

I use Avidemux to create MP4 videos now, using the AAC audio encoder, and the H.264 video encoder, the result plays in any of the above listed Flash players.

Follow me on Twitter

Tags: ,

15th September 2008

So, I want to stream my own video, from my own server? Why would I want to do that? Control, I guess. It cna be argued that there are enough sites around already that can host videos for you (Youtube, Flickr, et al), and it makes sense to eat into their bandwidth rather than your own, but let’s just see – can it be done using Open Source tools?

Enter Red5

Red5 is an Open Source Flash video streaming application. It is written in Java and serves the same purpose as the very expensive Adobe Flash Media Server.

Before I take it for a test run, it is worth looking at the Red5 hall of fame. Noteworthy is openmeetings, which – if it supports video – could fill a niche that clients often ask for.

In the next part I will install the server and run some tests.

————————

The next part is going to take a little longer than I expected. The installation instructions start with “download the source code, you will need Eclipse too…”. So my idea of ‘just installing, trying and tweaking’ goes out the window at the first step. It may take an hour to set up, it may take three days – that’s the way with Linux and Java, and I just don’t have the time to take a risk just to see how well something is going to work.

If anyone knows of a packaged version of Red5 that I can simply drop onto a non-GUI Linux server and run, I’d love to know.

————————

But Do I Really Need Streaming?

This is the point at which a realisation that I have been chasing the wrong horse hits me. I have been imaginging that YouTube is streamed to the browser. It turns out it is not. It is delivered in pseudo stream through HTTP, which is probably one of the main reasons for its success, since HTTP gets through firewalls without a thought.

So, to deliver Flash videos from a website, and allow the user to fast-forward to any point in that video, only a simple PHP script is needed. The PHP script will start streaming, byte-by-byte, the Flash video file from any given point. The Flash player then handles the rest; it just makes GET requests: give me the file X starting at byte Y; keep going until I break the connection.

The xmoov-php script here can deliver this stream, and there is an associated xmoov FLV player that hooks up to it. At the time of writing, the player has not been released, so it is difficult to take it for a test-run. However, the JW FLV Player supports the same protocol and that is available under an Open Source licence for non-profit organisations (though check out the definition of ‘non-profit’ before assuming your organisation counts as one), or under a commercial licence for a small and reasonable fee. As a bonus, the player now supports true RTMP streaming, as provided by the Red5 server.

Having tried to get this player working, I am having some Java troubles am waiting for a response to my bug report.

————————

‘bug’ fixed: it turns out the FLV file needs metadata added to it to list where all the keyframes are. The FLVMDI tool does that nicely by scanning the file and inserting the metadata. Once the FLV video was post-processed to add this metadata, the whole pseudo-streaming worked like a dream.

The demo can be seen here. Try to random-access parts of the video; it works. What would be a nice addition would be for the player to cache each downloaded section and be able to piece them together. At the moment it will cache just one segment of the video, and you can seek to any point within that cache, but if you click outside of it (i.e. after the current loading point or before the segment starting point) then the cache is thrown away completely, forcing the player to start downloading – quite possible – the whole segment again.

————–

See also ffmpeg FLV converter.

Follow me on Twitter

Tags: ,