1. 程式人生 > >nginx + ffmpeg 搭建m3u8伺服器

nginx + ffmpeg 搭建m3u8伺服器

1、 安裝nginx

nginx

nginx-rtmp-module:

增加:http_ssl_module:

configure --add-module=<path-to-nginx-rtmp-module>  --with-http_ssl_module

make

sudo make install

2、編譯ffmpeg

ffmpeg

先編譯 x264 

./configure --enable-static

make

sudo make install

編譯ffmpeg

./configure --enable-libx264 --enable-gpl

 3、啟動

啟動nginx

sudo /user local/nginx/sbin/nginx

ffmpeg 切片

本地檔案:

ffmpeg -i 檔案 -c:v libx264 -c:a aac -strict -2 -f hls /html/test.m3u8

ts流:

ffmpeg -i udp://@:1234 -c:v libx264 -c:a aac -strict -2 -f hls /html/test.m3u8

4、vlc 測試

開啟網路串流

http://192.168.12.205/test.m3u8

如果不出差錯便可以觀看