Howto: Installing Lighttpd and enable Mod-h264 streaming module for Lighttpd

Posted on

The H264 Streaming Module is a plugin for your existing Apache/Lighttpd/Nginx webserver, below steps to  building the H264 Streaming Module for Lighttpd.

To make sure you have all dependencies (configuration files, startup scripts) installed it’s best to first install Lighttpd.

Download Old Lighttpd 1.4.18 with mod h264 streaming

[root@rc-090 ~]#cd root
[root@rc-090 ~]#wget
[root@rc-090 ~]#tar -zxvf lighttpd-1.4.18_mod_h264_streaming-2.2.0.tar.gz

Download New Lighttpd 1.4.26

[root@rc-090 ~]#cd /root
[root@rc-090 ~]# wget
#tar -zxvf lighttpd-1.4.30.tar.gz

Note : new lighttpd-1.4.30.tar.gz didn’t have mod h264 streaming modules so we need to take the modules from lighttpd 1.4.18

We copy a few files useful sources to compile the module h264 streaming.

[root@rc-090 ~]#cd /root/lighttpd-2.2.0/src/

[root@rc-090 ~]cp mod_h264_streaming.c mod_streaming_export.h moov. * mp4_io. * mp4_process. * \

>mp4_reader. * mp4_writer. * output_bucket. * output_mp4. * lighttpd-1.4.30/src/


Copy the module’s files from the 1.4.18 source distribution to your source distribution (lighttpd-1.4.x).

[root@rc-090 ~] cp lighttpd-2.2.0/src/mod_h264_streaming.c lighttpd-2.2.0/src/mod_streaming_export.h

[root@rc-090 ~]#cp lighttpd-2.2.0/src/mod_h264_streaming.c lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/mod_streaming_export.h lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/moov.c lighttpd-1.4.30src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/moov.h lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/mp4_io.c lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/mp4_io.h lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/mp4_reader.c lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/mp4_reader.h lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/mp4_writer.c lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/mp4_writer.h lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/mp4_process.c lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/mp4_process.h lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/output_bucket.c lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/output_bucket.h lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/output_mp4.c lighttpd-1.4.30/src/
[root@rc-090 ~]#cp lighttpd-2.2.0/src/output_mp4.h lighttpd-1.4.30/src/


#vi lighttpd-1.4.30/src/

### (Add few lines below after ‘mod_flv_streaming’)
mod_h264_streaming_la_SOURCES = mod_h264_streaming.c \
mod_streaming_export.h \
moov.c moov.h \
mp4_io.c mp4_io.h \
mp4_reader.c mp4_reader.h \
mp4_writer.c mp4_writer.h \
mp4_process.c mp4_process.h \
output_bucket.c output_bucket.h \
output_mp4.c output_mp4.h
mod_h264_streaming_la_CFLAGS = $(AM_CFLAGS) -DBUILDING_H264_STREAMING
mod_h264_streaming_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
mod_h264_streaming_la_LIBADD = $(common_libadd)

Kill all process lighttpd

[root@rc-090 ~]#killall -9 lighttpd

Recompiling lighttpd 1.4.30

[root@rc-090 ~]#cd lighttpd-1.4.30
[root@rc-090 ~]#./
[root@rc-090 ~]#./configure –enable-maintainer-mode
[root@rc-090 ~]#make && make install

Backup & Edit lighttpd.conf

[root@rc-090 ~]#vi /etc/lighttpd/lighttpd.conf
# change on server.modules
server.modules = (

# add this h264 streaming extensions
h264-streaming.extensions = ( “.mp4”, “.flv” )

Starting Up Lighttpd Daemon

[root@rc-090 ~]#/usr/local/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf &

Testing open a mp4 streaming files

[root@rc-090 ~]#cd /var/www/html/
[root@rc-090 ~]#wget

Try to access videofile.mp4 files from browser like example below :

We also can testing out from console like below

[root@rc-090 ~]# wget -S “”
–2012-05-21 10:28:00–
Connecting to… connected.
HTTP request sent, awaiting response…
HTTP/1.0 200 OK
Connection: keep-alive
X-Mod-H264-Streaming: version=2.2.0
Content-Type: video/mp4
ETag: “-144150195”
Last-Modified: Fri, 18 May 2012 11:27:23 GMT
Content-Length: 26908528
Date: Mon, 21 May 2012 04:58:00 GMT
Server: lighttpd_RC-090
Length: 26908528 (26M)
Saving to: `ntmonitor.mp4

Thants it..:)



4 thoughts on “Howto: Installing Lighttpd and enable Mod-h264 streaming module for Lighttpd

    Cristian Rusu said:
    August 20, 2012 at 6:24 pm

    I downloaded the older version, but there is no such file in src other than first to copy and moov ones… any idea?

    Liju Mathew said:
    November 16, 2012 at 5:53 pm

Leave a Reply to Cristian Rusu Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s