开源Flash Server:Red5构建RTMP流媒体播放平台
2009-12-04 09:16
459 查看
基于开源Flash Server:Red5(http://osflash.org/red5)的Flash流媒体服务平台上线,内容涉及视频上传、视频分发、调用接口、Flash播放器等
一、Flash RTMP流媒体播放演示(播放时进度条可以自由拖动):
二、安装步骤简要说明:
①、安装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
一、Flash RTMP流媒体播放演示(播放时进度条可以自由拖动):
二、安装步骤简要说明:
①、安装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
相关文章推荐
- 基于开源Flash Server:Red5构建RTMP流媒体播放平台
- 基于开源Flash Server:Red5构建RTMP流媒体播放平台
- 使用Red5和FFMpeg搭建在线Flash流媒体分享平台
- 关于red5——开源的Flash流媒体服务器red5简介
- tomcat+geoserver+postgis构建开源Webgis平台(windows)
- 开源的Flash流媒体服务器red5简介
- RTMP协议发布H264 + AAC的实时流媒体,可以用FLASH直接播放
- Java:tomcat+geoserver+postgis构建开源Webgis平台(windows)
- 【集】使用Red5和FFMpeg搭建在线Flash流媒体分享平台
- SRS(simple-rtmp-server)流媒体服务器源码分析--RTMP消息play
- 构建位置(地图)服务平台的相关开源资源
- EasyNVR RTSP转RTMP-HLS流媒体服务器前端构建之:内部搜索功能的实现
- 播放基于流媒体服务器的视频,本例基于 RED5
- 微软开源Malmo AI项目平台 利用Minecraft构建复杂机器人任务
- 最简单的基于Flash的流媒体示例:网页播放器(HTTP,RTMP,HLS)
- 利用开源的Gearman框架构建分布式图片处理平台
- LVS开源创始人之淘宝低碳平台构建
- 应用SuperIO(SIO)和开源跨平台物联网框架ServerSuperIO(SSIO)构建系统的整体方案
- SRS(simple-rtmp-server)流媒体服务器源码分析--RTMP信息Publish