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 http://h264.code-shop.com/download/lighttpd-1.4.18_mod_h264_streaming-2.2.0.tar.gz
[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 http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.30.tar.gz
#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/

(OR)

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/

Edit Makefile.am

#vi lighttpd-1.4.30/src/Makefile.am

### (Add few lines below after ‘mod_flv_streaming’)
lib_LTLIBRARIES += mod_h264_streaming.la
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 ~]#./autogen.sh
[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 = (


“mod_expire”,
“mod_secdownload”,
“mod_h264_streaming”,
)
#
# 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 http://127.0.0.1/videofile.mp4

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 “http://192.168.0.90/ntmonitor.mp4”
–2012-05-21 10:28:00–  http://192.168.0.90/ntmonitor.mp4
Connecting to 192.168.0.90:80… 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..:)

 

Advertisements

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

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s