wowza 录制直播流

Wowza2.2.43.0使用对应的zip包)

 

描述

开始、停止录制直播流的API方法:

  • startRecording(streamName,recordOptions);
  • stopRecording(streamName);

 

  • 有两种方式可以调用录制接口,一种是flash应用,一种是通过HTTPPost方式触发开始录制和停止录制

 

  • append 附加的录制文件是否存在,默认是false
  • version/overwrite 开始录制时,version表示如果已经存在文件(myStream.flv),那么会以myStream_0.flv存放新的文件;overwrite表示,如果存在文件,那么覆盖。
  • startonkeyframe 录制关键帧。默认false
  • recorddata 包含cuepoints和元数据,默认是true
  • ouput:录制文件的绝对路径+名称+扩展名。默认为录制到application.xml配置的路径中,以流名称作为文件名,并添加适当的扩展名(flvMP4

 

安装引用模块

一、Flash应用调用方式

1、复制lib/wms-plugin-integrationrecord.jar and lib/wms-plugin-livestreamrecord.jar 

 [install-dir]/lib/目录中。

2、编辑 [install-dir]/conf/[application]/Application.xml并添加下面<Module><Modules>列表中的最后:

 

<Module>
        <Name>ModuleLiveStreamRecord</Name>
        <Description>ModuleLiveStreamRecord</Description>
        <Class>com.wowza.wms.plugin.livestreamrecord.ModuleLiveStreamRecord</Class>
</Module>

 

3、双击录制模块压缩包中的client\livestreamrecord.html,修改ServerStream等信息,然后点击“Start Recording”按钮开始录制,点击“Stop Recording”停止录制。

 

二、HTTP调用方式

 

1、复制lib/wms-plugin-integrationrecord.jar and lib/wms-plugin-livestreamrecord.jar 

 [install-dir]/lib/目录中。

2、编辑 [install-dir]/conf/[application]/Application.xml并添加下面<Module><Modules>列表中的最后:

 

<Module>
        <Name>ModuleLiveStreamRecord</Name>
        <Description>ModuleLiveStreamRecord</Description>
        <Class>com.wowza.wms.plugin.livestreamrecord.ModuleLiveStreamRecord</Class>
</Module>

3、添加下面的HTTProvider/conf/VHost.xml /HostPort (Port 8086)下的 /HTTProviders容器中,把它放到最后一个HTTProvider的上面,在HTTProviders中的顺序应该是倒数第2HTTProvider

 

<HTTPProvider>
        <BaseClass>com.wowza.wms.plugin.livestreamrecord.HTTPLiveStreamRecord</BaseClass>
        <RequestFilters>livestreamrecord*</RequestFilters>
        <AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>

 

4、可以在浏览器中打开clientHTTP/HTTPLiveStreamRecord.html页面进行开始和停止操作。或者直接使用URL的方式也是可以的。如下:

 

http://[wowza-address]:8086/livestreamrecord?app=live&streamname=myStream&action=stopRecording&version=false&output=/usr/local/WowzaMediaServer/content/c.mp4&fromat=mp4

 

所有选项配置间用&符号链接:

 

请求选项:

app=[app-name]  直播应用名

streamname=[stream-name] 流名称,必须是直播流

action=startRecording|stopRecording 动作

 

配置选项和他们的默认值:

append=true|false (default is false)

version=true|false (default is true. If set to false, and append is false, an existing file will be overwritten)

startonkeyframe=true|false (default is false)

recorddata=true|false (default is true)

output=[path]/[filename].[ext] (default is empty, files are recorded to content folder)

format=flv|mp4 (default is flv)

 

5、添加安全选项

修改HTTP方式中第三步<AuthenticationMethod>none</AuthenticationMethod>

为:

<AuthenticationMethod>admin-basic</AuthenticationMethod>

这样就要求验证用户名密码才可以触发。

 

需要添加用户名和密码到URL中才可以触发

 

http://username:password@[wowza-address]:8086/livestreamrecord?app=live&streamname=myStream&action=stopRecording&version=false&output=/usr/local/WowzaMediaServer/content/c.mp4&fromat=mp4

 

注意:只有H.264视频格式和AACMP3音频格式才可以被录制到.mp4文件中。

注意:这个API可以调用服务端控制录制进程

Note: There are three operations exposed through JConsole/JMX: recordStream, stopRecording, getRecorderNames. This enables starting and stopping of recording through the Module interface exposed in JMX. The second parameter of recordStream (format) has the following values: 0=Use original stream format, 1=Record in FLV container, 2=Record in MP4 container.

转载于:https://my.oschina.net/fengjihu/blog/181945

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值