9 Replies Latest reply on Mar 20, 2015 4:27 AM by Win 8.1 debugger | Adobe

    Slow manual bitrate switching

    abeymg Level 1

      When specifying a manual bitrate, in our app that uses OSMF1.5, we notice the switch takes some time to occur in the cleint.

       

      For e.g

       

      We see the stream switch on FMS (using the admin console) in about ~5 secs. In the client app it takes ~20 secs.

       

      Is there a way to force the client switch to happen faster? Even if it means losing the seamless switch transitions (in other words we are ok with pausing the stream during the switch for)?

       

      Thanks,

       

      - Abey

        • 1. Re: Slow manual bitrate switching
          weizhangstrobe Level 2

          Hi Abey,

           

          Are you referring to RTMP bit rate switching or http streaming bit rate switching?

           

           

          --Wei Zhang

          Senior Computer Scientist

          Adobe Systems, Inc.

          weizhang@adobe.com

          • 2. Re: Slow manual bitrate switching
            abeymg Level 1

            Sorry should have been clearer. Referring to RTMP bit-rate streaming.

             

            - Abey

            • 3. Re: Slow manual bitrate switching
              charles_newman-GG8xMm Level 1

              Hi Abey,

               

              With FMS (Flash Media Server) versions below 4, the switching time is a function of key frame placement and buffer length in the client. When the client makes a request to switch, the server acknowledges the request with a "NetStream.Play.Transition", which means it has accepted the request and has begun looking for a key frame to perform the switch. When the server makes the switch, it appends the new stream to the current buffer. The switch is visible to the end user when the buffer plays through. When the client receives an onPlayStatus info message of "NetStream.Play.TransitionComplete", the switch is visible to the user. This is an in-stream call back that has been inserted into the stream.

               

              The time between the "NetStream.Play.Transition" and the "NetStream.Play.TransitionComplete" will be roughly the size of the buffer during playback. You can measure this by turning logging on in OSMF and in your player and watch for these events. If you trace out or display your buffer length (mediaPlayer.bufferLength) you should see the switch time roughly equal this value.  Note that your buffer length may grow beyond the mediaPlayer.bufferTime you set. The switching rules in OSMF will throttle the connection to keep the buffer from growing too large and therefore creating more time between switches.

               

              Depending on your deployment plans for your player, you'll have to play with buffer sizes. I recommend a buffer size of 8 (mediaPlayer.bufferTime) for general deployment of a player when playing dynamic streaming content over RTMP. If your buffer size is too small, you'll have trouble maintaining a higher quality stream because the switching rules in OSMF will switch down to the lowest quality stream if the buffer empties during playback.

               

              Thanks,

              - charles

              • 4. Re: Slow manual bitrate switching
                abeymg Level 1

                Thank you for that detailed explanation. I added in logging and sure enough as you stated, the diff between between the "NetStream.Play.Transition" and the "NetStream.Play.TransitionComplete" is equal to the current value of mediaPlayer.bufferLength. (The buffer time is set to 5 secs, but bufferLength gets up to 45 secs)

                 

                In the case of a manual stream switch, is there some way for us to clear/reduce the buffer just before executing the switch?

                 

                Thanks,

                - Abey

                • 5. Re: Slow manual bitrate switching
                  Andrian Cucu Adobe Employee

                  Hi,

                   

                  You can make the switch faster by using 'fast switching': http://help.adobe.com/en_US/flashmediaserver/devguide/WS3f305989b15d10dc44125e8c12a5fb2d1d a-8000.html

                   

                  You'll need to use your custom SwitchManager for this.

                   

                  hth,

                  Andrian

                  • 6. Re: Slow manual bitrate switching
                    abeymg Level 1

                    Thanks.  "fast switching" seems tied to FMS 4.0. Is there a way to achieve this in FMS 3.5?

                     

                    - Abey

                    • 7. Re: Slow manual bitrate switching
                      charles_newman-GG8xMm Level 1

                      Your buffer length is getting large. Have you double checked your bitrate settings in your switching profile (SMIL file or DynamicStreamingResource)? The SMIL file should specify the bitrates in bits per second, while the DynamicStreamingItem class expects bitrates in kilobits per second. If the bitrate you tell OSMF is much higher than the actual bitrate of the stream, OSMF will throttle the connection too high and your buffer will grow too fast.

                       

                      OSMF throttles the connection between client and server to 1.4 x the current bitrate. But it only knows the bitrate as you've specified it in the SMIL or the DynamicStreamingResource.  So if you are playing a 500kbps stream, but you told OSMF the bitrate is 5000kpbs, it is going to throttle the connection to 7000kbps and your buffer will grow very large during playback.

                       

                      - charles

                      • 8. Re: Slow manual bitrate switching
                        abeymg Level 1

                        Bitrate settings are all fine. That's not the issue (would have been nice if that was all  )

                         

                        In any case, I tested it with an FMS 4.0, using the offset property and it was a little better but not that great. So for now I ended up restarting the stream and seeking to the old location when a manual bitrate is specified and it switches near instantly. There is a pause in the video when we do this, but its acceptable and works with FMS 3.5.