[文章作者:张宴 本文版本:v1.0 最后修改:2009.04.13 转载请注明原文链接:http://blog.zyan.cc/post/409/]

  上周五,我们基于开源Flash Server:Red5(http://osflash.org/red5)的Flash流媒体服务平台上线,内容涉及视频上传、视频分发、调用接口、Flash播放器等。

  一、Flash RTMP流媒体播放演示(播放时进度条可以自由拖动):

  

  生产环境更多 Flash RTMP 流媒体视频演示:http://jx3.xoyo.com/xgxz/video/



  二、安装步骤简要说明:
  ①、安装JDK
  打开http://java.sun.com/javase/downloads/,下载最新的Java SE Development Kit (JDK),安装在/usr/local/jdk/下。
chmod +x jdk-6u13-linux-i586.bin
./jdk-6u13-linux-i586.bin


  ②、安装Red5
  打开http://osflash.org/red5/070final,下载red5-0.7.0.tar.gz,解压缩后执行./red5.sh,然后访问http://yourdomain:5080/,有演示。



  三、服务器带宽消耗比较:
  ①、客户端 1.5M ADSL 环境,HTTP 方式播放单个视频,服务器所消耗的带宽:
[root@localhost ~]# ./net.sh eth0 1
IN: 3318 Byte/s OUT: 259984 Byte/s
IN: 3486 Byte/s OUT: 249470 Byte/s
IN: 3332 Byte/s OUT: 259984 Byte/s
IN: 3090 Byte/s OUT: 252528 Byte/s
IN: 3000 Byte/s OUT: 252474 Byte/s
IN: 3000 Byte/s OUT: 253976 Byte/s
IN: 2940 Byte/s OUT: 255478 Byte/s
IN: 3004 Byte/s OUT: 252474 Byte/s
IN: 3452 Byte/s OUT: 252528 Byte/s
IN: 3270 Byte/s OUT: 260038 Byte/s
IN: 3586 Byte/s OUT: 252474 Byte/s


  ②、客户端 1.5M ADSL 环境,RTMP 流媒体方式播放单个视频,服务器所消耗的带宽:
[root@localhost ~]# ./net.sh eth0 1
IN: 3900 Byte/s OUT: 27878 Byte/s
IN: 4200 Byte/s OUT: 30868 Byte/s
IN: 4380 Byte/s OUT: 27801 Byte/s
IN: 4080 Byte/s OUT: 29965 Byte/s
IN: 4080 Byte/s OUT: 26450 Byte/s
IN: 3960 Byte/s OUT: 27143 Byte/s
IN: 3000 Byte/s OUT: 10061 Byte/s
IN: 3960 Byte/s OUT: 16166 Byte/s
IN: 3660 Byte/s OUT: 26480 Byte/s
IN: 4020 Byte/s OUT: 23127 Byte/s


  HTTP 方式播放,如果服务器端不限速,客户端的带宽越大,服务器消耗的带宽也越大,但限速又会影响用户体验;
  RTMP 流媒体方式播放,只要客户端达到最低带宽要求,不管客户端的带宽如何,服务器消耗的带宽都一样。

  如果播放10M以内大小的视频,HTTP 能够在较短的时间内下载完视频,能够降低并发观看用户数;
  如果播放10M以上大小的视频,RTMP 要比 HTTP 方式节省不少带宽。

  RTMP 播放时进度条可以自由拖动,虽然Lighttpd和Nginx目前也可以使用somevideo.flv?start=xxx的方式从指定位置下载视频,但还是不如 RTMP 灵活。



  四、带宽测试Shell脚本(net.sh):
#!/bin/bash

# test network width

function usage

{

        echo "Usage: $0  "

        echo "    e.g. $0 eth0 2"

        exit 65

}


if [ $# -lt 2 ];then
usage
fi
typeset in in_old dif_in
typeset out out_old dif_out
typeset timer
typeset eth

eth=$1
timer=$2

in_old=$(cat /proc/net/dev | grep $eth | sed -e "s/\(.*\)\:\(.*\)/\2/g" | awk ' { print $1 }' )
out_old=$(cat /proc/net/dev | grep $eth | sed -e "s/\(.*\)\:\(.*\)/\2/g" | awk ' { print $9 }' )

while true
do
sleep ${timer}
in=$(cat /proc/net/dev | grep $eth | sed -e "s/\(.*\)\:\(.*\)/\2/g" | awk ' { print $1 }' )
out=$(cat /proc/net/dev | grep $eth | sed -e "s/\(.*\)\:\(.*\)/\2/g" | awk ' { print $9 }' )
dif_in=$(((in-in_old)/timer))
dif_out=$(((out-out_old)/timer))
echo "IN: ${dif_in} Byte/s OUT: ${dif_out} Byte/s"
in_old=${in}
out_old=${out}
done
exit 0


Tags: , ,



技术大类 » 其他Unix技术 | 评论(79) | 引用(3) | 阅读(131994)
smarteng
2009-6-27 17:33
请问这个可以做一个视频直播的服务器吗?
视频直播的一般用的是什么服务器软件?
jiezi
2009-7-3 14:15
大侠,red5在实现点播大文件的时候会比较卡,是什么原因?谢谢
nikeclubs Homepage
2009-9-20 15:59
图书 Homepage
2009-10-10 10:23
回家试试去, 不懂俺再来问问


图书批发
cha Email
2009-11-4 14:23
上传的flv视频,如何防止客户端下载,防止嗅觉, 不知道博主有没有解决办法
姚志斌
2010-1-25 14:49
张老师,怎么我用这个播放器就好卡一个,都是在局域里面,不应该这么卡的,是不是播放器还要设置呢!谢指点一下!
水水
2010-3-7 02:43
只是有个小小疑问,这个demo真的是基于rtmp的吗?
我刚接触这块,还一直以为有进度条在pause时可以缓存的都是HTTP方式播放的呢,以前一直以为如果RTMP方式的是不会有进度条缓存的,好像FMS实现了smart pause能有一定的缓存,red5不支持。

能给解释下不?在下在这里谢谢了。
张宴 回复于 2010-3-7 10:44
RTMP方式是不会有进度条缓存的。写这篇文章时,这个DEMO是RTMP的。2009年12月,因为需要CDN提供商提供更多节点,而国内的CDN厂商RTMP点播使用的是FMS,而非开源的Red5,FMS每台服务器需要购买Adobe的授权,成本较高,所以后来XML配置文件中已经更改为Nginx+HTTP方式。
所以你现在看到的Demo是HTTP的,而非RTMP。
水水
2010-3-7 12:23
谢谢你的回复!
这样说来RTMP方式是不可以在pause状态下缓存了(除了FMS smartpause机制),前后拖动都会刷新缓存区重新load,这样的话必然影响客户收看体验。另一方面,按照您上面的阐述,HTTP方式播放会影响服务短效率,不知道你在这个问题上是怎么考虑的。采用什么样的手段回避这些问题。谢谢!
张光明 Email
2010-6-4 15:02
张宴大师,你好。我是深圳南油通诺实业发展有限公司 ,张光明.该公司Flash RTMP流媒体相关项目组长。想请教阁下几个问题.
1)目前,Red5服务器 如何读取stream视频文件服务器的文件,是否有相关方法可循。(red5和视频文件位于不同服务器上)
2)在使用falsh播放器时,播放器,暴露了服务器rmtp://servername.com/  或者 http://servername.com/ ,这个问题是不是很严重,可能会导致什么问题呢?
     期待阁下回答。
ZDW
2010-9-10 15:36
你演示的地址是http://cache.v.xoyo.com/streams/2009/04/15/22.flv ,这是nginx提供的,不是RTMP的,怎么回事呢?
hh8
2011-1-27 13:45
碰到郁闷的事情。我们网站有很多景区的视频,每个视频大约有50M左右。都是flv格式的。目前我们用的是http+jwplayer播放。不知道这种环境部署red5是不是优化网站性能
打火机!
2011-6-3 17:19
你好,我想请教你搭建好red5后怎么实现你上图的效果
海星
2011-7-5 13:49
步骤能否详细一点哇。unhappyunhappy
猿人 Email
2011-7-12 15:51
求张宴大师修改过的JM Player 代码。
网上邻居 Email
2011-8-5 10:31
张宴你好:
    看了你写的red5教程,刚好我们也需要,装好自带的oflaDemo组件,rtmp连接后播放页面可以正常播放但没有视频进度条无法看到拖拽效果,按照你说的方式下载了mediaplayer-5.7-viral(jw-flv-player),仿照着更改了下flowplayer.html文件内容

改成http方式播放可以
flowplayer("player", "flowplayer-3.0.3.swf", {
  clip: {
    url: 'http://192.168.91.131:5080/flv/video.flv',
    provider: 'h264streaming'
  },

-----------------------------
但改成rtmp方式不可以播放
flowplayer("player", "flowplayer-3.0.3.swf", {
  clip: {
    url: 'rtmp://192.168.91.131/oflaDemo/video.flv',
    provider: 'h264streaming'
  },


找了个flvPlayer.exe播放软件也无法实现拖拽播放,请问如何实现,第一次尝试用,还请指点,谢谢
QQ:6562157
e-mail:fzhy163@163.com


应用环境
redhat4.6 .32
jdk-6u13-linux-i586.bin
red5-1.0.0-RC1.zip
louis vuitton uk Email Homepage
2011-11-23 09:12
This louis vuitton uk for sale belongs to the sounding just what are termed as Louis Vuitton vintage best sellers, many other products and services for the reason that range appearing companies.You will easily notice the unfold zippers of this coach outlet store online. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.Let us inspire your inner beauty with fine christian louboutin sale. Purse the elegance in bridal wedding. Enjoy the fashion.
同一片蓝天 Email
2012-1-13 17:02
你好,我是使用Flash Media Server服务器,使用rtmp协议虽然能托动进度条,但是不能将视频缓冲动本地,不知,你是怎么实现缓冲与托动的的,还请多多指教下。还有我也想问一下你是用什么软件来修改flash的
同一片蓝天 Email
2012-1-13 17:19
你好,我是使用Flash Media Server rtmp协议来实现播放的,但是不能实现在本地缓存,不知道你是怎么实现缓存与托动的呢,望多多指教。
df
2012-3-6 13:55
我的延时6,7秒,不知咋办了
分页: 2/5 第一页 上页 1 2 3 4 5 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]