麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 系統(tǒng) > Ubuntu > 正文

ubuntu下使用nginx搭建流媒體服務(wù)器,實(shí)現(xiàn)視頻點(diǎn)播

2024-06-28 16:00:01
字體:
供稿:網(wǎng)友

為了實(shí)現(xiàn)視頻點(diǎn)播和直播,整了一天,看了N多博客,終于有了不小進(jìn)展,在這里分享給大家。 什么是視頻點(diǎn)播?可能你對這個名詞不熟悉,但是愛奇藝,騰訊視頻等這些視頻播放軟件想必你肯定知道。沒錯,視頻點(diǎn)播就是在線觀看某個視頻。額,視頻直播?這個就不解釋了吧,美女直播,游戲直播等等,哈哈。

首先我們看如何實(shí)現(xiàn)視頻點(diǎn)播,視頻點(diǎn)播支持flv文件及H264編碼視頻,ACC編碼音頻的mp4文件: 第一步,創(chuàng)建單獨(dú)的目錄(因?yàn)檐浖^多,容易混亂),下載需要的軟件: 我們需要下載nginx,pcre,zlib,openssl以及nginx-rtmp-module

mkdir workcd workwget http://nginx.org/download/nginx-1.10.3.tar.gzwget http://zlib.net/zlib-1.2.11.tar.gzwget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gzwget https://www.openssl.org/source/openssl-1.0.2k.tar.gzwget https://github.com/arut/nginx-rtmp-module/archive/master.zip

第二步,分別解壓這四個文件:

tar -zxvf 文件名

第三步,編譯安裝nginx:

./configure --PRefix=/usr/local/nginx --with-debug --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.0.2k --add-module=../nginx-rtmp-module-mastermakesudo make install

第四步,進(jìn)入 /usr/local/nginx/conf,配置nginx.conf文件,在文件末尾添加如下內(nèi)容:

rtmp { server { listen 1935; application vod { play /var/flvs; #指定存放視頻文件的路徑 } application vod_http { #myserver.com及服務(wù)器地址,如果只是本地播放,填寫127.0.0.1:端口號 就行,端口好看配置文件中http監(jiān)聽的端口下同 play http://myserver.com/vod; } application vod_mirror { play /var/local_mirror http://myserver.com/vod; } }}

示例完整版:

#user nobody;worker_processes 1;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events { worker_connections 1024;}rtmp { server { listen 1935; application vod { play /video_test; } application vod_http { play http://192.168.1.102:8080/vod; } application vod_mirror { # try local location first, then access remote location play /var/local_mirror http://192.168.1.102:8080/vod; } }}http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 8080; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the php scripts to Apache listening on 127.0.0.1:80 # #location ~ /.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ /.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ //.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!md5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #}}

然后,進(jìn)入與conf文件夾同級的sbin目錄下,運(yùn)行:

sudo ./nginx

至此,服務(wù)器搭建完成,可以實(shí)現(xiàn)視頻點(diǎn)播了。 視頻點(diǎn)播測試: 播放位于 /video_test 下的file.flv視頻文件:

ffplay rtmp://localhost/vod//file.flv

可以使用VLC這個播放器或者ffplay(需要安裝ffmpeg),VLC自行百度安裝即可。 ffmpeg安裝:

sudo apt-add-repository ppa:jon-severinsson/ffmpegsudo apt-get updatesudo apt-get install ffmpeg
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 被啪羞羞视频在线观看 | 免费观看的毛片手机视频 | 免费看成年人视频在线 | 国产精品6区 | av在线免费播放 | 亚洲午夜视频在线 | 久久久久中文字幕 | 九九视屏| 国产美女视频免费 | 俄罗斯16一20sex牲色另类 | 久久久成人999亚洲区美女 | 性高湖久久久久久久久aaaaa | 国产亚洲精品美女久久久 | 久久久久久久久久91 | 亚洲成人国产综合 | 一级毛片在线免费观看视频 | 国产午夜精品一区二区三区免费 | 国产亚洲黑人性受xxxx精品 | 孕妇体内谢精满日本电影 | av噜噜在线 | www国产成人免费观看视频,深夜成人网 | 亚洲午夜久久久久 | 国产成年人视频 | 亚洲成人精品久久 | 禁漫天堂久久久久久久久久 | 污黄视频在线观看 | 免费a观看 | 最污网站 | 有色视频在线观看 | 少妇一级淫片高潮流水电影 | 亚洲精品在线观看免费 | 一级做受大片免费视频 | 深夜毛片免费看 | 国产精品久久久久久一区二区三区 | 国产精品久久久免费 | 国产视频在线观看免费 | 亚洲无av| 国产精品亚洲欧美一级在线 | 欧洲精品久久 | 成人福利在线看 | 欧美 亚洲 激情 |