red5+ffmpeg

1. download and install jdk-1.7

2. download and install jre-1.7

3. download and install apache-ant-1.9

4. set home environment variable

insert these into /etc/profile
JAVA_HOME=/usr/local/jdk1.7.0_11
JRE_HOME=/usr/local/jre1.7.0_11
ANT_HOME=/usr/local/ant
export JAVA_HOME
export JRE_HOME
export ANT_HOME

5. download and install red5-1.0.0

   mv red5-1.0.0 /usr/local/red5

6. run red5

/usr/local/red5/red5.sh

7. install red5 demo

http://192.168.137.66:5080/

click install

choose oflaDemo and click install

8. change webapps/oflaDemo/index.html file

<script type='text/javascript'>^M
  jwplayer('mediaspace').setup({^M
    'flashplayer': 'player.swf',^M
    'file': 'hobbit_vp6.flv',^M
    'streamer': 'rtmp://192.168.137.66/oflaDemo',^M
    'controlbar': 'bottom',^M
    'width': '848',^M
    'height': '360'^M
  });^M
</script>^M

<script type='text/javascript'>^M
  jwplayer('mediaspace2').setup({^M
    'flashplayer': 'player.swf',^M
    'file': 'hobbit_vp6.flv',^M
    'streamer': 'rtmpt://192.168.137.66:5080/oflaDemo',^M
    'controlbar': 'bottom',^M
    'width': '848',^M
    'height': '360'^M
  });^M
</script>^M


9. web player

http://192.168.137.66:5080/oflaDemo/index.html

 

A. ffmpeg + red5

A.1 streaming ffmpeg rtmp output to red5

ffmpeg -re -f mpegts -i film.ts -c:a libfaac -ac 1 -c:v libx264 -s 352x288 -aspect 4:3 -b:v 300k -f flv 'rtmp://localhost/live/sss1 live=1'

A.2 setup live player

cd webapps/live

cp ../oflaDemo/index.html .

cp ../oflaDemo/jwplayer.js .

cp ../oflaDemo/player.swf .

A.3 edit live/index.html

<script type='text/javascript'>^M
  jwplayer('mediaspace').setup({^M
    'flashplayer': 'player.swf',^M
    'file': 'sss1.flv',^M
    'streamer': 'rtmp://192.168.137.66/live',^M
    'controlbar': 'bottom',^M
    'width': '848',^M
    'height': '360'^M
  });^M
</script>^M

<script type='text/javascript'>^M
  jwplayer('mediaspace2').setup({^M
    'flashplayer': 'player.swf',^M
    'file': 'sss1.flv',^M
    'streamer': 'rtmpt://192.168.137.66:5080/live',^M
    'controlbar': 'bottom',^M
    'width': '848',^M
    'height': '360'^M
  });^M
</script>^M

A.4 web player

http://192.168.137.66:5080/live/index.html

A.5 ffmpeg decode rtmp stream from red5

ffmpeg -re -i 'rtmp://192.168.137.66/live/sss1 live=1' -an -c:v rawvideo -s 352x288 -f rawvideo tt.yuv

Notes:

Above, the live=1 is a must, or ffmpeg will fail on connect red5 rtmp stream server.

 the live stream should be packeted with audio and video, or if only with video data, 

above command will hung long time, or delay long time.

for example:

stream only video to red5

ffmpeg -re -f mpegts -i film.ts -an -c:v libx264 -s 352x288 -aspect 4:3 -b:v 300k -f flv 'rtmp://localhost/live/sss1 live=1'

decode stream from red5

ffmpeg -re -i 'rtmp://192.168.137.66/live/sss1 live=1' -an -c:v rawvideo -s 352x288 -f rawvideo tt.yuv

ffmpeg will hung long time or delay long time.



but.

ffmpeg -re -f mpegts -i film.ts -c:a libfaac -ac 1 -c:v libx264 -s 352x288 -aspect 4:3 -b:v 300k -f flv 'rtmp://localhost/live/sss1 live=1'

ffmpeg -re -i 'rtmp://192.168.137.66/live/sss1 live=1' -an -c:v rawvideo -s 352x288 -f rawvideo tt.yuv

this will be ok.


 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值