Skip navigation
jennissss
Currently Being Moderated

Multi-bitrate live streaming?

Jan 23, 2009 4:32 AM

Hi, does anybody know the syntax for the FMS URL -parameter when streaming multiple bitrate live streams with FMLE 3 to FMIS 3.5? E.g. when I select the FMLE-preset: Multiple Bitrate - 3 streams (1500Kbps), for the FMS URL Flash Media Encoder just tells me that:

"On replacing tags in stream name with their values, two or more streams have the same name. Please us %i tag in stream name to prevent this from happening"

So does anybody know the correct form for the FMS URL in this case, thanks!
 
Replies
  • Currently Being Moderated
    Jan 23, 2009 5:25 AM   in reply to jennissss
    All the stream names should be unique. You can solve this problem in 2 ways:
    1. Separate multiple stream names by semicolon - streamA; streamB; mystream
    2. Use parametrized naming convention - stream%i (this is equivalent to stream1;stream2;stream3)
    There are many other pre-defined parameters also (refer to the help file)
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 29, 2009 11:49 AM   in reply to fmeuser

    Could you shed a little more light on the subject? 

     

    I read the help documentation, but I'm confused as to how to the syntax and placement.

     

    Does the reference to streamA; streamB; mystream  go in the "stream" field in FME?

     

    If so, then how is the "Source" parameter worded in the .fla file's component inspector?   rtmp://myserver/myLiveApp/instance1/mylivestream%i

     

    or how?

     

    I'm assuming this will automatically recognize the user's bandwidth and serve up the appropriate video (bitrate)?

     

    Any help would be appreciated.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 30, 2009 5:46 AM   in reply to mrwizzer2

    In the source field you cannot give a variable name. You will have to replace %i with a value (1, 2, etc).

     
    |
    Mark as:
  • Currently Being Moderated
    May 18, 2009 3:18 PM   in reply to jennissss

    OK,

    So let's get REALLY specific here.

    I tried waht was stated as "The Answer" with no luck.

     

    What I am doing:

    1. In FLME I am setting my FMS URL: rtmp://my rtmp path
    2. Steam: liveStream%i/live authorization code

    Everything seems to work fine here.

     

    On the player side I am doing this:

    ( code is retyped, but in original code it has been compiled so any misspellings or typos are just human error in retyping )

    private var vid:FLVPlayback;

     

    *farther down

     

    vid = new FLVPlayback();

     

    var dynamicStream:DynamicStreamItem = new SynamicStreamItem();

    dynamicStream.uri = rtmp://my rtmp path/;

    dynamicStream.addStream("liveStream1",300);

    dynamicStream.addStream("liveStream2",700);

     

     

    vid.play2(dynamicStream);

     

    First Question:

    What should the stream names look like?

    is dynamicStream.addStream("liveStream1"300); incorrect?

     

    Second Question:

    Could this be a bug with using Live Authorization code in stream name?

     
    |
    Mark as:
  • Currently Being Moderated
    May 19, 2009 10:57 AM   in reply to fmeuser

    If you read my question you would see this is specific to Live encoding and the syntax needed for a live stream to be played back, not for VOD. My question was pretty specifc.I am asking for the syntax needded to add multibitrate live streams to a dynamic stream item when using the addStream() method. I am also asking what if any impact a authorization token has on the name of the stream when used with the DynamicStreamItem class.

     

    What I am looking for, so there is no confusion, is:

    1. What is the syntax for adding a multi bitrate live streams to a DynamicStreamItem when using the addStream() method.
      1. It is not the same syntax as VOD I know this because I tried it.

       2. What impact does adding a live authorization token have ( if any ) on the stream names.

     

    Any help is appreciated

     
    |
    Mark as:
  • Currently Being Moderated
    May 20, 2009 12:15 AM   in reply to ConnectSolutions

    1. Try setting DynamicStreamItem.start parameter to '-1'

    2. How are you adding the authorization token? You should append it using '?'. Everything before ? will be considered as stream name and the appended parameters can be extracted by wrting a script on server.

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2009 2:01 PM   in reply to fmeuser

    Ok, I'm getting close, thanks to:

     

    A) Using David Hassoun's tutorial on Dynamic Streaming in Flash Media Server 3 and using his DynamicStreamingSample.as file as the basis for my video player (instead of using a flash component as I was before).

     

    B) FMEuser's suggestion to put -1 as a dsi.start parameter, written like this:   dsi.start = -1; (necessary to make it live streaming, I assume).

     

    and C) Revisiting what was given at the top as "the answer" above, which did actually help, (when using Hassoun's playback approach anyway).

     

    So, for those following, I've determined that one successful approach to the syntax to name your various streams in the Flash Media Live Encoder's "Stream" field is simply different names separated by semicolons, like:  myStreamLow; myStreamMed; myStreamHigh

    (notice the semicolons, not commas).

     

    Thus far, that has at least given me some live video in my player!  So I'm getting close.

     

    Problem now is, the videos are not changing to a higher quality video on higher quality connections.  : /

     

    When the video player is first instantiated, I see the video changes from the big size video for high bandwidths, to medium size, to the tiny size for low bandwidth connections (all in the blink of an eye), but it's not changing back up to the high or medium bandwidth size, despite the fact that I'm on a blazing internet connection.

     

    Can anyone tell me where I'm going wrong?  Is there yet another setting that needs to be set?

     

    SOOO CLOSE...

     

    I've attached my .as file, which is simply Houssoun's code with my rmtp url and video files swapped in, plus the dsi.start=-1 tidbit.  

     

    Please advise if you can.  Thanks!

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2009 2:02 PM   in reply to fmeuser

    Ok, I'm getting close, thanks to:

     

    A) Using David Hassoun's tutorial on Dynamic Streaming in Flash Media Server 3 and using his DynamicStreamingSample.as file as the basis for my video player (instead of using a flash component as I was before).

     

    B) FMEuser's suggestion to put -1 as a dsi.start parameter, written like this:   dsi.start = -1; (necessary to make it live streaming, I assume).

     

    and C) Revisiting what was given at the top as "the answer" above, which did actually help, (when using Hassoun's playback approach anyway).

     

    So, for those following, I've determined that one successful approach to the syntax to name your various streams in the Flash Media Live Encoder's "Stream" field is simply different names separated by semicolons, like:  myStreamLow; myStreamMed; myStreamHigh

    (notice the semicolons, not commas).

     

    Thus far, that has at least given me some live video in my player!  So I'm getting close.

     

    Problem now is, the videos are not changing to a higher quality video on higher quality connections.  : /

     

    When the video player is first instantiated, I see the video changes from the big size video for high bandwidths, to medium size, to the tiny size for low bandwidth connections (all in the blink of an eye), but it's not changing back up to the high or medium bandwidth size, despite the fact that I'm on a blazing internet connection.

     

    Can anyone tell me where I'm going wrong?  Is there yet another setting that needs to be set?

     

    SOOO CLOSE...

     

    I've attached my .as file, which is simply Houssoun's code with my rmtp url and video files swapped in, plus the dsi.start=-1 tidbit.  

     

    Please advise if you can.  Thanks!

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2009 2:02 PM   in reply to fmeuser

    Ok, I'm getting close, thanks to:

     

    A) Using David Hassoun's tutorial on Dynamic Streaming in Flash Media Server 3 and using his DynamicStreamingSample.as file as the basis for my video player (instead of using a flash component as I was before).

     

    B) FMEuser's suggestion to put -1 as a dsi.start parameter, written like this:   dsi.start = -1; (necessary to make it live streaming, I assume).

     

    and C) Revisiting what was given at the top as "the answer" above, which did actually help, (when using Hassoun's playback approach anyway).

     

    So, for those following, I've determined that one successful approach to the syntax to name your various streams in the Flash Media Live Encoder's "Stream" field is simply different names separated by semicolons, like:  myStreamLow; myStreamMed; myStreamHigh

    (notice the semicolons, not commas).

     

    Thus far, that has at least given me some live video in my player!  So I'm getting close.

     

    Problem now is, the videos are not changing to a higher quality video on higher quality connections.  : /

     

    When the video player is first instantiated, I see the video changes from the big size video for high bandwidths, to medium size, to the tiny size for low bandwidth connections (all in the blink of an eye), but it's not changing back up to the high or medium bandwidth size, despite the fact that I'm on a blazing internet connection.

     

    Can anyone tell me where I'm going wrong?  Is there yet another setting that needs to be set?

     

    SOOO CLOSE...

     

    I'll follow this post with my code, which is simply Houssoun's code with my rmtp url and video files swapped in, plus the dsi.start=-1 tidbit.  

     

    Please advise if you can.  Thanks!

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2009 2:03 PM   in reply to mrwizzer2

    //written by David Houssoun

     

    package  com.realeyes.media

    {

     

    //-------------------------------------------------

    //IMPORTS

    //-------------------------------------------------

     

    import flash.display.MovieClip;

    import flash.events.NetStatusEvent;

    import flash.media.Video;

    import flash.net.NetConnection;

    import flash.net.NetStream;

    import flash.system.Capabilities;

     

    /**

    * ...

    * @author David Hassoun | RealEyes Media | david@realeyes.com

    *

    * USE AT YOUR OWN RISK.

    */

    public class DynamicStreamingSample extends MovieClip

    {

     

    //-------------------------------------------------

    //DECLARATIONS

    //-------------------------------------------------

     

    private var _nc:NetConnection;

    private var _ns:NetStream;

    private var _ds:DynamicStream;

    private var _vidDisp:Video;

    private var _connClient:ConnectionClient;

    private var _isServerCapable:Boolean;

     

    //private var _uri:String = "rtmp://flash.my.net/vod";

    private var _uri:String = "rtmp://flash.my.net/live";

    //private var _startingBitrate:Number = 150;

    private var _startingBitrate:Number = 150;

    private var _targetFMSVersion:Number = 3.5;

    private var _targetFPVersion:Number = 10;

     

    //-------------------------------------------------

    //CONSTRUCTOR

    //-------------------------------------------------

     

    public function DynamicStreamingSample()

    {

    _init();

    }

     

     

    //-------------------------------------------------

    //INIT METHODS

    //-------------------------------------------------

     

     

    private function _init():void

    {

    _initConnection();

    }

     

    private function _initConnection():void

    {

    _nc = new NetConnection();

    _connClient = new ConnectionClient( this );

    _nc.client = _connClient;

    _nc.addEventListener( NetStatusEvent.NET_STATUS, _onNetStatus );

    _nc.connect( _uri );

    }

     

    private function _initStream():void

    {

    trace( "-INIT STREAM -");

     

    if ( !_vidDisp )

    {

    _vidDisp = new Video();

    this.addChild( _vidDisp );

    }

     

    var fpVersion:Number = getFlashPlayerMajorVersion();

     

    trace("fpVersion: " + fpVersion + " && _isServerCapable: " + _isServerCapable );

     

    if ( fpVersion >= _targetFPVersion && _isServerCapable )

    {

    _initDynamicStream()

    }

    else

    {

    _initNetStream();

    }

     

    }

     

     

    private function _initNetStream():void

    {

    trace("_initNetStream()");

     

    _ns = new NetStream( _nc );

    _ns.client = _connClient;

    _ns.addEventListener( NetStatusEvent.NET_STATUS, _onNetStatus );

     

     

     

    _vidDisp.attachNetStream( _ns );

     

     

    /*_ns.play( "mp4:sample1_700kbps.f4v" );*/

    _ns.play( "mystreamHIGH", -2 );

    }

     

    private function _initDynamicStream():void

    {

    trace("_initDynamicStream()");

     

    _ds = new DynamicStream( _nc );

    _ds.client = _connClient;

    _ds.addEventListener( NetStatusEvent.NET_STATUS, _onNetStatus );

     

     

     

    _vidDisp.attachNetStream( _ds );

     

    /* var dsi:DynamicStreamItem = new DynamicStreamItem();

    dsi.addStream( "mp4:sample1_150kbps.f4v", 150 );

    dsi.addStream( "mp4:sample1_500kbps.f4v", 500 );

    dsi.addStream( "mp4:sample1_700kbps.f4v", 700 );

    dsi.addStream( "mp4:sample1_1000kbps.f4v", 1000 );

    dsi.addStream( "mp4:sample1_1500kbps.f4v", 1500 );*/

     

    var dsi:DynamicStreamItem = new DynamicStreamItem();

    dsi.addStream( "mystreamLOW", 150 );

    dsi.addStream( "mystreamMED", 500 );

    dsi.addStream( "mystreamHIGH", 700 );

     

     

    //OPTIONAL

    dsi.startRate = _startingBitrate;

     

    //COMMAND TO STREAM _LIVE_ VIDEO! (set to -1)

    dsi.start = -1;

    //end live command

     

     

    _ds.startPlay( dsi );

    }

     

     

    //-------------------------------------------------

    //CONTROL METHODS

    //-------------------------------------------------

     

     

    public function setVideoSize( p_w:Number, p_h:Number ):void

    {

    trace("Set video Size: " + p_w + " x " + p_h);

    _vidDisp.width = p_w;

    _vidDisp.height = p_h;

     

    if ( _ds )

    {

    trace("Current Bitrate: " + _ds.currentStreamBitRate );

    }

    }

     

     

     

    private function _verifyServerVersion( p_version:String ):void

    {

    var fmsVersion:Number = Number( p_version.split(",", 2).join(".") );

     

    trace("fmsVersion: " + fmsVersion);

     

    if ( fmsVersion >= _targetFMSVersion )

    {

    _isServerCapable = true;

    }

    else

    {

    _isServerCapable = false;

    }

    }

     

     

    public function getFlashPlayerMajorVersion():Number

    {

     

    var fpVersionStr:String = Capabilities.version;

     

    return Number( fpVersionStr.split(" ")[1].split(",", 1) );

     

    }

     

    //-------------------------------------------------

    //EVENT HANDLERS

    //-------------------------------------------------

     

     

     

    private function _onNetStatus( p_evt:NetStatusEvent ):void

    {

     

    trace( "NetStatus.info: " + p_evt.info.code );

     

     

    /*for ( var i:String in p_evt.info )

    {

    trace( i + " : " + p_evt.info[i] );

    }*/

     

    switch( p_evt.info.code )

    {

    case "NetConnection.Connect.Success":

    {

    trace( "VERSION: " + p_evt.info.data.version );

     

    _verifyServerVersion( p_evt.info.data.version );

     

     

    _initStream();

    break;

    }

    }

     

     

    }

     

    }

     

    }

     

     

    //-------------------------------------------------

    //CONNECTION/STREAM CLIENT CLASSES

    //-------------------------------------------------

     

    import com.realeyes.media.DynamicStreamingSample;

     

    class ConnectionClient

    {

    private var _owner:DynamicStreamingSample;

     

    public function ConnectionClient( p_owner:DynamicStreamingSample )

    {

    _owner = p_owner;

    }

     

    public function onBWCheck(... rest):Number

    {

    return 0;

    }

     

     

    public function onBWDone(... rest):void

    {

    //rest[0]; //is the available bw

     

    }

     

     

    public function onMetaData( p_metaData:Object ):void

    {

    trace("- Meta Data Received - ");

    _owner.setVideoSize( p_metaData.width, p_metaData.height );

    }

     

     

    public function onCuePoint( p_data:Object ):void

    {

    trace( "client.onCuePoint() " + p_data );

    }

     

    public function onImageData( p_data:Object ):void

    {

    trace( "client.onImageData() " + p_data );

    }

     

     

    public function onPlayStatus( p_data:Object ):void

    {

    trace( "client.onPlayStatus() " + p_data );

    trace("////////////////////");

    for ( var i:String in p_data )

    {

    trace( i + " : " + p_data[i] );

    }

     

     

    trace("////////////////////");

    }

     

    public function onTextData( p_data:Object ):void

    {

    trace( "client.onTextData() " + p_data );

    }

    }

     
    |
    Mark as:
  • Currently Being Moderated
    May 28, 2009 11:57 AM   in reply to mrwizzer2

    *BUMP*

     

    Anyone?

     
    |
    Mark as:
  • Currently Being Moderated
    May 28, 2009 12:28 PM   in reply to fmeuser

    fmeuser, Your response still has nothing to do with what I am asking.

     

    It is true that when rolling your own live player you need to set the start parameter to -1. When using the FLVPlayback 2.5 component though this is the same as setting isLive to true.

     

    As for the Authorization token the question was not about how to set it and furthermore your advice was wrong. To set the auth token you merely append it to the stream name input box in the Flash Live Media Encoder as such: streamName/authtoken. Again, this wasn't a question about how to set it though. I am able to set it fine and it works with a single live stream without issue.

     

    The question again, is:

    What is the syntax needed to play a multi bitrate encoded live stream when using the Dynamic stream class? I am able to connect to a single live encoded stream without issue, but a multi stream does not work. I am merely missing the syntax needed.

    I am using the addStream method of the DynamicStreamItem class like so:

    dynamicStream.addStream("livestream_1",300);
    dynamicStream.addStream("livestream_2",700);

     

    But when I call play2( dynamicStream ) I get a stream not found message.

     

    I am wondering if it is choking on setting the bitrate. I am wondering if the bitrate needs to be exact taking into account the audio overhead as well. I tried this out though by removing the audio portion of the stream and still get a stream not found error.

     

     

    I have seen this syntax, but this is only needed for mov movies played via VOD nit for live streams.

    dynamicStream.addStream("mp4:livestream_1.f4v",300);

     

    I found an article with updates to the FLVPlayback component making it 2.50015 which might fix this issue, since it adds fixes for DVR capabilities of multi bitrate encoded streams. Link: http://www.flashstreamworks.com/archive.php?post_id=1243361305

    And of course the Flash Media Server Productivity Tools Page is the best place to look for updates on these matters: http://www.adobe.com/go/fms_tools/

     

    Again, any help is appreciated. Read the question first though.

     
    |
    Mark as:
  • Currently Being Moderated
    May 28, 2009 1:10 PM   in reply to ConnectSolutions

    Another interesting update:

    So I know the encoding is working because I can see it in the logs:

    Stream[livestream1/auth] Status: Success
    Thu May 28 2009 12:46:13 : Primary - Network Command: onFCPublish
    Thu May 28 2009 12:46:13 : Primary - Stream[livestream1/auth] Status: NetStream.Publish.Start

    Stream[livestream2/auth] Status: Success
    Thu May 28 2009 12:46:13 : Primary - Network Command: onFCPublish
    Thu May 28 2009 12:46:13 : Primary - Stream[livestream2/auth] Status: NetStream.Publish.Start

     

    So I went ahead and tested that by setting the FLVPlaybacks source property:

    vid.source = "rtmp://myrtmppath/applicationname/livestream1";

    vid.source = "rtmp://myrtmppath/applicationname/livestream2";

    Both work fine

    So again it is defiitely something wrong with the DynamicStreamItem class or the syntax for addStream

     

    I have no idea what it is though, just that it should work.

     
    |
    Mark as:
  • Currently Being Moderated
    May 29, 2009 8:32 AM   in reply to ConnectSolutions

    Now THAT'S what I'm talking about!

     

    Huge thanks, ConnectSolutions! 

     

    We approached it from different angles, but apparently it was the naming of the stream that was throwing me off.  For some reason, putting in "stream1; stream2; stream3" didn't work, but by replacing those three stream names with simply "stream%i" in the FMLS but still referring to them as "stream1" "stream2" etc. in the actionscript file did the trick.

     

    Sweet!

     

    Thanks for the post!

     

    Mike

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points