H264 Streaming With Lighttpd
mod_h264_streaming is based on an already existing lighttpd module (mod_flv_streaming by Jan Kneschke). The basics are very similar and this module allows you to seek in MP4 files.
Examples
The module expects a URL which matches h264-streaming.extensions and that can handle a '?start=" part of the request.
Testing
The start position is given in seconds. So for example to request an MP4 file starting at forty-five and half a second from the beginning you would pass ?start=45.5
For testing purposes we recommend a tool like WGET. So:
wget -O test.mp4 http://h264.code-shop.com:8080/trailer2.mp4?start=45.5
saves a file (test.mp4) on your local disk that will have the first 45.5 seconds removed from the original (trailer2.mp4) file. You can use your favorite player to see if worked okay.
Flash
The information to pass into the ‘start’ parameter is extracted by the flash-player from the meta-data of the mp4-files. Note that you pass it the 'time' field and not the 'offset' field.
var url = "http://h264.code-shop.com:8080/trailer2.mp4?start=" + metadata.seekpoints[keyframe]["time"]; NetStream.play(url)
Metadata
You have to make sure that this meta-data is present in the video stream. See Encoding for more information on how to encode videos.
Lighttpd config
server.modules = ( ..., "mod_h264_streaming", ... ) h264-streaming.extensions = ( ".mp4" )
