RTMP文件下载

本文介绍了如何利用rtmpdump工具下载RTMP文件,特别是在观看techtalks视频遇到卡顿时,提供了一种离线观看的解决方案。通过分析网页源代码发现使用了flowplayer播放器,详细解释了flowplayer的RTMP协议、URL格式以及clip和key的配置。此外,还阐述了Flash URL的结构,并提供了一些Wowza media server的示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

RTMP文件下载

今天在使用techtalks观看ACL视频时,比较卡顿,萌生了下载的想法

查看一下网页源代码,是flash播放,使用了flowplayer

1 下载

1.1 依赖

需要安装rtmpdump工具,ubuntu下apt-get即可

sudo apt-get install rtmpdump
1.2 下载
rtmpdump -r {server_url} -C B:0 -C Z: \
-C S:/{video_url} \
-C S:BounceAPI3.0 -C N:0.000000 -C S:mp4 \
-y mp4:{video_url} \
-o {save_name}

下面是stackexchange的一个例子

rtmpdump -r rtmp://flash.dce.harvard.edu/bounce -C B:0 -C Z: \
-C S:/2012/02/22872/L01/22872-20120124-L01-1-h264-av1248-16x9-852x480.mp4 \
-C S:BounceAPI3.0 -C N:0.000000 -C S:mp4 \
-y mp4:2012/02/22872/L01/22872-20120124-L01-1-h264-av1248-16x9-852x480.mp4 \
-o a.flv
RTMPDump v2.4-84-gdd57cd0
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
Starting download at: 0.000 kB
[...]
3322.127 kB / 22.03 sec (0.3%)

2. 相关知识

下面介绍一下相关知识并记录一下经过

2.1 TECHTALK

下面是techtalk视频播放的代码片段,可以看到就是使用了一下flowplayer,下面对参数进行逐个说明。

        <div id="videoplayer">
          <!--
            <embed src="/site_media/static/swf/weyplayerplus.swf" width="100%" height="480px" allowscriptaccess="always" allowfullscreen="true" id="swfContent" name="swfContent" flashvars="talkURL=rtmp://webcast.weyond.com/vod/emnlp/2016/mp4:t4 final 1.mp4#--#rtmp://webcast.weyond.com/vod/emnlp/2016/mp4:t4 final 1.mp4&ifPlayList=True&talkID=63415&startsFrom=-1&endsAt=-1"/></embed>
          -->
          <div id="collageview_videoplayer_div" class="collageview_videoplayer_div">
          <a  class="rtmp" href='emnlp/2016/mp4:t4 final 1.mp4' style="display:block;width:640px;height:480px;" id="flowplayer_presenter">
          </a>
          </div>
          <script type="text/javascript">
            $f("flowplayer_presenter", "/site_media/static/flowplayer/flowplayer.commercial-3.2.7.swf", {
              key: '#$e6dbb014a27ff12b879',
              clip: {
                scaling : 'fit',
                provider: 'rtmp',
                start: -1,
              },
              plugins: {
                rtmp: {
                  url: '/site_media/static/flowplayer/flowplayer.rtmp-3.2.3.swf',
                  netConnectionUrl: 'rtmp://webcast.weyond.com/vod'
                }
              }
            });
          </script>
2.2 flowplayer
2.2.1 简介

flowplayer是一个在线的视频播放器,可以嵌入在HTML中。

2.2.2 RTMP

RTMP是Adobe Systems开发的一种协议,用于在互联网,Flash播放器和服务器之间传输音频,视频和数据流。
flowplayer 有一个rtmp的插件,使用方式如下,详细可以参考rtmp flowplayer

<div id="wowza" style="width:644px;height:276px;margin:0 auto;text-align:center">
    <img src="/media/img/player/splash_black.jpg"
         height="276" width="548" style="cursor:pointer" />
</div>
$f("wowza", "http://releases.flowplayer.org/swf/flowplayer-3.2.18.swf", {

    // common configuration for each clip
    clip: {

        // each clip uses the rtmp provider
        provider: 'rtmp'
    },
    // flowplayer add rtmp plugin
    plugins: {
        rtmp: {
            url: "flowplayer.rtmp-3.2.13.swf", // RTMP plugin release
            netConnectionUrl: 'rtmp://flowplayer.org:1935/fastplay' // rtmp服务器的地址
        }
    }
});
2.2.3 url

flowplayer提供了两种url的方式
1.html element herf属性,可以参考multiple rtmp

    <a class="rtmp" href="mp4:bbb-800"
        style="background-image:url(/media/img/demos/bunny.jpg)">
        <img src="/media/img/player/btn/play_text_large.png" />
    </a>

2.js中clip的url属性

    $f(){
        clip: {
            url: 'mp4:vod/demo.flowplayer/buffalo_soldiers.mp4',
            scaling: 'fit',
            // configure clip to use hddn as our provider, referring to our rtmp plugin
            provider: 'hddn'
        },
    }

如通过使用了方法2,方法1中的url会被覆盖[link]。(http://flash.flowplayer.org/documentation/configuration/clips.html)

2.2.4 clip

clip代表了在flowplayer中播放的视频,clip的url属性就是视频的链接

2.2.5 key

The configuration needs to include the license key, otherwise you will be seeing a Flowplayer text showing on top of the video. The installation happens between SCRIPT tags on your HTML page. The license key goes to the 3rd parameter of the flowplayer call, it’s included in the flowplayer configuration object. link

flowplayer("player",
           "http://releases.flowplayer.org/swf/flowplayer.commercial-3.2.18.swf",{
    // license key from your account
    key: '#$7162d2d730cf607ac6d'
});
2.3 FLASH URL

格式为
rtmp://[wowza-ip-address]:[port]/[application]/[appInstance]/[prefix]:[path1]/[path2]/[streamName]

  • wowza-ip-address: Wowza media server domain name or IP address
  • port: TCP port to use for the connection (RTMP/RTMPE = 1935, RTMPT = 80, RTMPS = 443)
  • application: Application name
  • appInstance: Application instance name (defaults to definst)
  • prefix: Content type prefix (flv, mp4, mp3 - in Wowza Streaming Engine software, defaults to mp4 if omitted)
  • path1/path2/streamName: Stream path and name

如果视频流没有路径,可以简写为
rtmp://[wowza-ip-address]:[port]/[application]/[prefix]:[streamName]
值得注意的是flash的视频名前需要添加类型前缀,即[prefix]:[streamName],比如flv, mp4, mp3。例如

# RTMP URL for application name vod and stream name mycoolvideo.mov
rtmp://mycompany.com/vod/mp4:mycoolvideo.mov
# RTMP URL for application name vod and stream name myvideos/mycoolvideo.mov
rtmp://mycompany.com/vod/_definst_/mp4:myvideos/mycoolvideo.mov

更多例子可以在wowza找到。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值