海康摄像头视频rtsp转化rtmp

海康摄像头默认只支持IE的,并且还须要使用ActiveX插件,很是麻烦,现使用red5发布服务实现rtmp的实时视频流的播放,须要用到的工具是fmpegjavascript

第一步 下载安装red5 ffmpeg 其中red5是基于java的须要提早下载sdk并配置好环境变量 安装Red5时附带的下载oflaDemo示例 ffmpeg须要配置环境变量 (不嫌麻烦的话每次均可以用cmd打开ffmpeg.exe再进行操做)。java

第二部 双击red5安装目录下的red5.bat开启服务git

微软+R 输入cmd进入命令行(意思是把视频流转化格式后发布到red5中)github

输入ffmpeg  -re -rtsp_transport tcp -i "rtsp://admin:12345678@localhost:554/h264/ch1/main/av_stream" -f flv -r 25 -s 640x480 -an "rtmp://localhost/oflaDemo/hello"tcp

第三步 修改red5的oflaDemo示例,让它显示本身的url工具

<script type='text/javascript'>
  /* jwplayer('mediaspace2').setup({
    'flashplayer': 'player.swf',
    'file': 'Avengers2.mp4',
    'streamer': 'rtmpt://localhost:5080/oflaDemo',
    'controlbar': 'bottom',
    'width': '848',
    'height': '360'
  }); */
  jwplayer('mediaspace2').setup({
    'flashplayer': 'player.swf',
    'file': 'hello',
    'streamer': 'rtmpt://localhost:5080/oflaDemo',
    'controlbar': 'bottom',
    'width': '848',
    'height': '360'
  });
</script>

完成测试

另外 我发现了一个新的方法 尚未测试  地址是https://github.com/daniulive/SmarterStreaming 感兴趣的能够看看url