用 lighttpd 建立 FLV 影片網站

用 lighttpd 建立 FLV 影片網站

  • 影片轉 FLV 檔, 並製作影片截圖
  • 在 lighttpd web server 使用加密網址, 隱藏實際影片路徑
  • 免費的 Flash FLV Player

影片轉檔

安裝 ffmpeg

安裝 flvtool2

影片轉 FLV 檔

ffmpeg -i myvideo.wmv -s 320x240 -r 15 -b 128k -ar 22050 -ab 32k -ac 2 -f flv myvideo.flv

參數說明

-iinput file name
-sset video frame size
-rset video frame rate
-bset video bit rate
-arset audio sampling rate
-abset audio bit rate
-acset number of audio channels
-fforce format

加入 metadata

flvtool2 -U myvideo.flv myvideo.flv

製作影片截圖

#截錄第一個畫面 (frame)
ffmpeg -i
myvideo.mpg -vframes 1 -s 320x240 -f image2 myvideo.jpg

#截錄第 18.5 秒的畫面
ffmpeg -i myvideo.mpg -ss 18.5 -vframes 1 -s 320x240 -f image2 myvideo.jpg

參數說明

-iinput file name
-vframesset the number of video frames to record
-sset frame size
-ssset the start time offset
-fforce format
-yoverwrite output files

Ref: [DB75]: Using FFmpeg to Extract PNG Files

建置影片播放平台

環境:

  • lighttpd 1.4.11 以上
  • DocumentRoot: /var/www/html

lighttpd 環境設定

安裝 lighttpd

vi lighttpd.conf

#注意順序: mod_secdownload 須在 mod_flv_streaming 之上
server.modules = (
    ...
    "mod_secdownload",
    "mod_flv_streaming",
    ...
)

flv-streaming.extensions = ( ".flv" )

secdownload.secret = "your_secret"
secdownload.document-root = "/var/www/videos/" #.flv 存放的位置
secdownload.uri-prefix = "/dl/" #編碼後的虛擬路徑
secdownload.timeout = 120

#Ref: LightTPD Docs -- Module: mod_secdownload

mkdir /var/www/videos :: 將 .flv 檔案置入 /var/www/videos

/etc/init.d/lighttpd restart :: 重新啟動 lighttpd

取用加密路徑

JW FLV Player 使用範例

JW FLV Player 播放實例

border="0" marginwidth="0" marginheight="0" src="http://cha.homeip.net/videos/test.php" frameborder="0" width="320" scrolling="no" height="240">

備註:

  • 若本頁面載入後超過 120 秒未點選播放, 需重新整理頁面才能正常播放
  • 以上影片係用 Nikon Coolpix 4300 攝錄, 只有畫面沒有聲音
  • 本站對外頻寬僅 256kbps, 下載緩慢敬請見諒

JW FLV Player 相關網頁


Free Flash Video Players

參考資料

相關網頁

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值