nginx 搭建http协议拖动播放 FLV 视频播放服务器
生活随笔
收集整理的這篇文章主要介紹了
nginx 搭建http协议拖动播放 FLV 视频播放服务器
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
原創(chuàng)作品,允許轉載,轉載時請務必以超鏈接形式標明文章 原始出處 、作者信息和本聲明。否則將追究法律責任。http://deidara.blog.51cto.com/400447/235562 所需要的?播放器,我用的開源的?JW?FLV?Media?Player?我把我的上傳到了blog 大家可以下載。。 做了一點點改動!! shell $> wget 'http://downloads.sourceforge.net/project/yamdi/yamdi/1.4/yamdi-1.4.tar.gz?use_mirror=nchc' shell $> wget?'http://sysoev.ru/nginx/nginx-0.7.64.tar.gz' shell $> tar?zxvf?nginx-0.7.64.tar.gz shell $> cd?nginx-0.7.64 shell $> groupadd?www shell $> useradd?-g?www?www shell $> ./configure?--prefix=/usr/local/nginx?--user=www?--group=www?--with-http_flv_module?--with-http_gzip_static_module?--with-http_stub_status_module?--with-cc=gcc?--with-cc-opt="?-O3" shell $> make shell $> make?installl shell $> tar?zxvf?yamdi-1.4.tar.gz shell $> cd?yamdi-1.4 shell $> gcc?yamdi.c?-o?yamdi?-O3?-Wall shell $> mv?yamdi?/usr/bin/ 注意我們編譯的?yamdi?它起著重要的作用,因為一個FLV視頻要能夠拖拽播放,這個FLV在其?metadata中有關鍵楨的信息,但大部分FLV?是沒有的。所以,我們要甬道開源的yamdi來為視頻添加關鍵幀信息 命令為? shell $> yamdi?-i?input.flv?-o?out.flv shell $> cd?/usr/local/nginx/conf shell $> cat?nginx.conf user??www; worker_processes??1; error_log??logs/error.log; pid????????logs/nginx.pid; events?{ ????worker_connections??1024; } http?{ ????include???????mime.types; ????default_type??application/octet-stream; ????sendfile????????on; ????keepalive_timeout??65; ????server?{ ????????listen???????80; ????????server_name??localhost; ????????root????/var/www; ????????index???index.html; ????????charset?utf-8; ###???重要部分? ????????location?~?\.flv?{ ????????????flv; ????????} ????????error_page???500?502?503?504??/50x.html; ????????location?=?/50x.html?{ ????????????root???html; ????????} ????} ?shell $> mkdir?-p?/var/www? ?shell $> cd?/var/www ?shell $> cat?index.html <html> <script?type="text/JavaScript"?src=\'#\'" /script> <head> <script?type="text/JavaScript"> /*?<![CDATA[?*/ function?createPlayer()?{ var?flashvars?=?{ file:"video.flv", type:"http", image:"preview.jpg", autostart:"false", streamer:"start" } var?params?=?{ allowfullscreen:"true", allowscriptaccess:"always" } var?attributes?=?{ id:"player1", name:"player1" } swfobject.embedSWF("player.swf",?"placeholder1",?"320",?"196",?"9.0.115",?false,?flashvars,?params,?attributes); } /*?]]>?*/ </script> </head> <body?οnlοad="createPlayer();"> <div?id="placeholder1"></div> </body> </html> ####重要部分`就是黃色字體部分, ####?type參數為?"http",是表明了http方式播放、訪問 ####?streamer?參數為?“start”,這個參數用于傳遞給服務器從特定的關鍵幀開始播放,nginx編譯了?flv?模塊?所以是支持的。。 好了現在就?打開?IE?來測試吧``為了能更好的測試,你可以利用?nginx?限速功能,這樣明顯,或者你用一個比較大的FLV?來做測試,記得要用?yamdi?添加一下關鍵偵哦~! ps:現在我們的任務就是,用戶上傳各種格式的媒體文件,轉換成FLV格式,然后在由yamdi 添加播放關鍵偵~~目前就是這樣得了~~ 媒體轉換文章請看我寫的另一篇文章: ffmpeg支持常用的所有格式轉換FLV http://deidara.blog.51cto.com/400447/144681 參考: http://linux.cn/home/space-3-do-blog-id-136.html
本文出自 “l(fā)inuxer” 博客,請務必保留此出處http://deidara.blog.51cto.com/400447/235562
轉載于:https://www.cnblogs.com/chenhaib/archive/2012/12/21/2827965.html
總結
以上是生活随笔為你收集整理的nginx 搭建http协议拖动播放 FLV 视频播放服务器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用简单的5个步骤设置 Web服务器集群
- 下一篇: 滤镜混合应用