因為工作上,有用到 Streaming 的東西。

這裡來記錄一下怎麼在 Lighttpd 上安裝 Mod-H264 Module 。

環境:
    Lighttpd - 使用 lighttpd-1.4.26
    OS - SLES 11

H264 網站:H264 Streaming Module for Lighttpd

安裝方式,其實就照H264網站上面寫的做就可以了。

下面簡單記錄一下:

# wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.26.tar.gz
# tar -zxvf lighttpd-1.4.26.tar.gz

 

# wget http://h264.code-shop.com/download/lighttpd-1.4.18_mod_h264_streaming-2.2.9.tar.gz
# tar -zxvf lighttpd-1.4.18_mod_h264_streaming-2.2.9.tar.gz

 

# cp lighttpd-1.4.18/src/mod_h264_streaming.c lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/mod_streaming_export.h lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/moov.c lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/moov.h lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/mp4_io.c lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/mp4_io.h lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/mp4_reader.c lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/mp4_reader.h lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/mp4_writer.c lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/mp4_writer.h lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/mp4_process.c lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/mp4_process.h lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/output_bucket.c lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/output_bucket.h lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/output_mp4.c lighttpd-1.4.26/src/
# cp lighttpd-1.4.18/src/output_mp4.h lighttpd-1.4.26/src/

 

# vi lighttpd-1.4.26/src/Makefile.am

 

#(for example, just 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)

 

# cd lighttpd-1.4.26
# ./autogen.sh
// The 'enable-maintainer-mode will trigger a rebuild of all makefiles by autoconf ...
# ./configure --enable-maintainer-mode --prefix=/home/lighttpd
# make
# make install

 

接著設定一下 lighttpd.conf

# vi lighttpd.conf
server.modules = ( 
  ...,
  "mod_h264_streaming",
  ...
)
h264-streaming.extensions = ( ".mp4" )

然後啟動 Lighttpd ,就搞定了。

測式方式:可參考 - Testing the H264 Streaming Module

Ex: 抓test.mp4,從150秒開始
wget -O test-1.mp4 "http://10.10.10.1/test.mp4?start=150"

得到的檔案跟原本的檔案比,應該會比較小,這就表示正確了。

 

最後再把這個Lighttpd + Mod_H264包成 RPM。

以後只要 rpm -Uvh lighttpd 就搞定了,耶~~

 

arrow
arrow
    全站熱搜

    Ching-Wei 發表在 痞客邦 留言(0) 人氣()