用 lighttpd 建立 FLV 影片網站
- 影片轉 FLV 檔, 並製作影片截圖
- 在 lighttpd web server 使用加密網址, 隱藏實際影片路徑
- 免費的 Flash FLV Player
影片轉檔
安裝 flvtool2
影片轉 FLV 檔
ffmpeg -i myvideo.wmv -s 320x240 -r 15 -b 128k -ar 22050 -ab 32k -ac 2 -f flv myvideo.flv
參數說明
-i input file name -s set video frame size -r set video frame rate -b set video bit rate -ar set audio sampling rate -ab set audio bit rate -ac set number of audio channels -f force 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參數說明
-i input file name -vframes set the number of video frames to record -s set frame size -ss set the start time offset -f force format -y overwrite output files
建置影片播放平台
環境:
- lighttpd 1.4.11 以上
- DocumentRoot: /var/www/html
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 = 120mkdir /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
參考資料
相關網頁