---
title: "wowza doc of multi-bitrate streaming"
author: "tedeyang"
date: "2011-11-06T11:49:08Z"
tags: ["wowza multi-bitrate"]
categories: ["互联网"]
slug: "wowza-doc-of-multi-bitrate-streaming"
draft: false
lastmod: "2011-11-06T12:06:07Z"
id: 1236651
url: "https://hitery.iteye.com/blog/1236651"
---

http://www.wowza.com/forums/content.php?36-How-to-publish-and-play-a-live-stream-(RTMP-or-RTSP-RTP-based-encoder)

 

关于如何实现流媒体的multi-bitrate播放，文档中并没有完整的描述，只是告诉你如何配置。

文档提到：你需要有一个能从一个视频流中编码出多种码率的编码器。

写道

Multi-bitrate live streaming to Flash, Apple iOS devices and Silverlight requires that you have an encoder that can generate multiple bitrate streams from the same source that are properly key-frame aligned.

 然后用SMIL文件来描述码率配置。

 

但什么例子也没有，什么样的encoder满足key-frame aligned?客户端怎么做？

有点参考性的是帖子的回复，第二页回复的最后有位venoushcz用H.264，mp3

写道

I use FMLE, h.264 and MP3:

&lt;encode&gt;  
&lt;video&gt;  
&lt;format&gt;H.264&lt;/format&gt;  
&lt;datarate&gt;500;200;100;&lt;/datarate&gt;  
&lt;outputsize&gt;768x432;512x288;512x288;&lt;/outputsize&gt;  
&lt;advanced&gt;  
&lt;profile&gt;Main&lt;/profile&gt;  
&lt;level&gt;4.0&lt;/level&gt;  
&lt;keyframe\_frequency&gt;4 Seconds&lt;/keyframe\_frequency&gt;  
&lt;/advanced&gt;  
&lt;autoadjust&gt;  
&lt;enable&gt;false&lt;/enable&gt;  
&lt;maxbuffersize&gt;1&lt;/maxbuffersize&gt;  
&lt;dropframes&gt;  
&lt;enable&gt;false&lt;/enable&gt;  
&lt;/dropframes&gt;  
&lt;degradequality&gt;  
&lt;enable&gt;false&lt;/enable&gt;  
&lt;minvideobitrate&gt;&lt;/minvideobitrate&gt;  
&lt;preservepfq&gt;false&lt;/preservepfq&gt;  
&lt;/degradequality&gt;  
&lt;/autoadjust&gt;  
&lt;/video&gt;  
&lt;audio&gt;  
&lt;format&gt;MP3&lt;/format&gt;  
&lt;datarate&gt;96&lt;/datarate&gt;  
&lt;/audio&gt;  
&lt;/encode&gt;

I stream to origin server. It is connected to edge server. I can stream each of the substreams to the demo player succesfully so the config origin - edge should be OK. I created the setup for the o-e multibitrate as you described in the post.

my live1.stream etc. files contain just the link to the origin server as you described:

rtmp://originsrv:1935/LIVESTREAM/livestream1

 似乎能行

 

因为我没有亲手写过flash中camera encode，不太了解这些环节，

还是等需要介入时把代码拿来看看。

 

另外，2010年的时候有人说flash不能做h.264编码，到了2011年9月就有人在回复中指出最新的flash已经提供了支持。确实如此，我们前段时间修改为h.264后带宽节省了很多。

写道

Originally Posted by cnynracer1  
“Thanks Roger. Yes I understand Flash player doesn't encode in H.264, but I am curious if we can do this without asking our users to download a plugin such as this.“

The latest (pre-release - coming soon - honestly ;-) ) does a nice job of encoding with H.264.

Get it here: http://labs.adobe.com/downloads/flashplayer11.html

It takes some fiddling to get flash building in your dev environment:  
Flex instructions here: http://www.youtube.com/watch?v=LlME1tUrDTo  
Flash Professional CS5.5 instructions here: http://forums.adobe.com/message/3906794#3906794

Here are some snippets for your flash code that will effect the changes:  
Code:  
// Settings for H.264 - this is all there is to it. Sadly no AAC :-(  
var h264Settings:H264VideoStreamSettings = new H264VideoStreamSettings();

h264Settings.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL\_2);  
nsPublish.videoStreamSettings = h264Settings;  
I"ve used this successfully with some Xuggler code that I fire off from a module to post process streams for IOS availability. This could have been done as a distinct server, but I felt it better to manage one app than two.

 可见跟对一个技术流派是多么重要。。。

 

从以上可以推测出，我们可以在客户端做multi-bitrate encode，也可以在服务器上做，具体如何实施还需要详细论证，需要匹配不同的业务场景，由于编码是个CPU密集型运算，client-origin-edge各自的负载能力需要仔细测试和规划。