Wowza Community

iOS GoCoder Adaptive Bitrate not working

I am currently trying to livestream using the iOS GoCoder SDK with my network link conditioner turned on to 3g, with an output bandwidth of 330kbps.

I start the live stream with the presets for 1280x720, and within a few seconds I get the event that the bandwidth has been decreased. My bandwidth scale multiplier is low, 0.3, and it drops down to the bandwidth to 1125kbps.

After that, I get the low bandwidth event, followed by the encoding paused event, and then nothing else.

How come the bandwidth does not continue to drop after the encoder has been paused? Should I be manually setting the bandwidth myself based off of the currentBroadcastingNetworkBitrateThroughput?Or should I be trying to load a lower preset when I know my connection is bad?

Are there optimal settings that should be set for the configuration? Here is what I have now

        WowzaGoCoder.setLogLevel(.verbose)

        streamerConfig = WowzaConfig()

        streamerConfig.broadcastVideoOrientation = lockedOrientation.videoOrientation

        streamerConfig.load(WOWZFrameSizePreset.preset1280x720)

        streamerConfig.videoFrameBufferSizeMultiplier = 0

        streamerConfig.videoFrameRateLowBandwidthSkipCount = 15

        streamerConfig.videoBitrateLowBandwidthScalingFactor = 0.30

        streamerConfig.videoFrameRate = 30

        streamerConfig.videoKeyFrameInterval = 60

        streamerConfig.audioSampleRate = 44100

Here are some logs from the WOWZCallback:

~ on wowz status: Optional(Status is starting )

~ on wowz status: Optional(Status is running )

~ wowza bitrate decreased: 

~ previous bitrate: 3750000 -- new bitrate: 1125000

~ wowza bitrate decreased: 

~ previous bitrate: 3750000 -- new bitrate: 1125000

~ wowza has low bandwidth

~ wowza encoding is paused

I checked with Tech support @Kyle Kirkland and they said that 3g normally is around 360kbps not 1.1mbps so a 720p stream will not fit through a 3g pipe…

It was suggested I share this doc with you:

https://www.wowza.com/docs/how-to-configure-a-broadcast-with-gocoder-sdk-for-ios#bitrate

Please let me know if this helped you or not. We may need to run some additional tests for you on this. Thanks Kyle.

Yeah I understand that 720p will not fit into a 3g pipe but doesn’t the GoCoder have adaptive bitrate streaming capabilities? Where if it detects the bitrate is too low for the current settings it reduces things such as the quality - 720p down to 480p for example, the video bitrate, and frame rate?

Or do I need to set those values after I notice a stream has paused encoding?

If you have some documentation pointing to a better explanation of that, that would be helpful.

Also does wowza provide a way to check the current network bandwidth before starting a stream up?

Oh sure, I can help you with that. The stream renditions in an ABR file must have aligned keyframes for stream-switching to work properly in Apple iOS devices. This can be done at encoding time by setting the keyframe interval and frame rate values to be the same for each encoded file or stream.

The Wowza Player has built in intelligence to automatically switch bitrates based on any fluctuating network conditions. When you create a SMIL file in the Engine manager or manually, the different bitrate files are created and available to the player- you don’t have to monitor it to switch them.

Here is a tutorial and doc to explain how to set up adaptive bitrate streaming. When you are creating the stream in Engine, just select GoGoder as the video source and then follow the directions in the link to create a SMIL file for ABR streaming.

https://www.wowza.com/docs/how-to-do-adaptive-bitrate-streaming#live-adaptive-bitrate-streaming

Please reach out with any more questions and let me know if this helping you.

Please see this as well for playback:

https://www.wowza.com/docs/how-to-customize-video-quality-choices-for-adaptive-bitrate-streams-in-wowza-player

We do not, but it was suggested you look into Reachability:

https://github.com/ashleymills/Reachability.swift

https://www.wowza.com/docs/how-to-do-adaptive-bitrate-streaming#live-adaptive-bitrate-streaming

The link above looks more like setting up a SMIL file for live playback, but you are saying we must do this to allow the GoCoder to support ABR correctly as well?

If we do do that, how do we connect the GoCoder to the file?

Yes @Kyle Kirkland, I am saying when you create your live application (ex. “MyStream”) in the Engine or Cloud manager, you are selecting GoCoder as the source ENCODER from the options given. Once you create the application, enable the transcoder and create the SMIL file, you use the connection settings provided in the manager to connect the GoCoder SDK stream to the Wowza server. That’s how they connect to each other.

This video tutorial will show you how to connect the GoCoder SDK stream to Wowza.

https://www.youtube.com/watch?v=N89QpOQzbQ4&list=PLDA4I83jF6ZtUazHsXHIvgJaKY9I4AGK4

The video in my previous replies then show how to create a SMIL file as the additional step you need to take for ABR streaming. They are connected because the ABR SMIL file was created in that live application. “My Stream”.

I want to emphasize this point once more to you in order for your ABR files to work correctly:

The renditions in an ABR stream must have aligned keyframes for stream-switching to work properly in Adobe Flash Player, Apple iOS devices, MPEG-DASH players, and Microsoft Silverlight. This can be done at encoding time by setting the keyframe interval and frame rate values to be the same for each encoded file or stream.

So let me clarify exactly what I mean when I say ABR:

What I’m saying is I really want Adaptive bitrate control, where the client encoder reduces the bitrate when network congestion is detected or hardware power is insufficient. Only 1 stream will be sent up to the server.

Is this something that still requires a SMIL file, and/or work on the server?

For Cloud:

  • If you want ABR streaming, it will do almost all of the work for you:

When using Wowza Streaming Cloud, you create one bitrate rendition, also called a source encode, of the stream you’re publishing to Wowza Streaming Cloud. This is the master bitrate rendition, if you will. Wowza Streaming Cloud uses the master rendition to create one or more renditions of equal or smaller size that it delivers to your audience.

In other words, Wowza Streaming Cloud transcodes the stream and creates multiple, keyframe-aligned, adaptive-bitrate output renditions that play seamlessly regardless of where the audience is watching, or what device or connectivity they’re using.

https://www.wowza.com/docs/How-to-encode-source-video-for-Wowza-Streaming-Cloud

Sorry for the long answer, but I hope that is clear now. You can alway submit a support ticket if you’d like assistance from our engineers in setting up the files.

For Engine:

  • If you want ABR streaming, you have to create a SMIL file and enter the info for the different streams:

Here is how you do it once you select GoCoder as the source encoder in Engine,

https://www.wowza.com/docs/how-to-do-adaptive-bitrate-streaming#live-adaptive-bitrate-streaming

Yes it does. One single bitrate stream will be sent to either Cloud or Engine from the client and then you need a SMIL file created so a player has access to all the different renditions (bitrates, formats resolutions etc.,) of the original stream.

In Engine it is a bit more manual of a process. But, if you prefer, in Cloud, it will automatically build the SMIL for you and all the stream renditions. But, there are processing hours you need to factor in if you go with Cloud.

I added more info at the bottom of this post. Hope you can now find a solution that works best for you @Kyle Kirkland.

We already have a transcoder that creates different playlists at different bitrates for client consumption.

We are using engine, and what we want is the broadcaster to send the best video possible up that it’s network will allow.

I checked with out engineer @Kyle Kirkland:

You still need to create a SMIL file. Our media server needs that manifest file to communicate with a player to select the appropriate stream rendition.

3rd party source/transcoder --ABR stream–> WSE --ABR stream via SMIL–> player

Wowza GoCoder does not support adaptive bitrate streaming from the device. If your available bandwidth drops it will switch to a lower quality ONCE and then it will stay there, if it still can’t stream it will be stuck. See https://www.wowza.com/community/questions/46719/gocoder-fails-to-reconnect-when-switching-from-wi.html

SMIL files don’t come into this, those are for transcoding files from your input stream into different output formats/sizes to be played back on another device.

You will have to do it manually or use something else.

Thanks @Henry Pate for contributing. The conversation can get confusing with the SDK in a broadcast app and ABR and I thank you for clarifying. Kyle, I misunderstood your question at first and I apologize. You cannot do any adaptive bitrate control from the GoCoder encoder at this time as Henry has said. You can only control frame rate/bitrate throttling.

Sorry for any inconvenience. For those in the community following, the SMIL file for Adaptive bit rate streaming only involves playback on the Wowza Player. As Henry stated, the SMIL file has no role at the encoder.

Having said that: tech support would like to share this with you regarding low bandwidth for broadcast:

The LowBandwidthScalingFactor property is the factor by which to scale the desired bitrate in low bandwidth conditions. Valid range is 0.0 to 1.0; any other value will be ignored. Setting a value of 0.0 indicates that the encoder should choose the best value; setting a value of 1.0 indicates that bitrate will never be throttled. The default is 0.75.
The FrameBufferSizeMultiplier property is the value by which to multiply the video frame rate to derive the number of video frames to buffer before the encoder starts to throttle bitrate and/or frame rate. For example: if the frame rate is 30 and the videoFrameBufferSizeMultiplier is 5, the encoder will buffer 150 (5 * 30) frames before throttling. Setting a value of 0 indicates that the encoder should choose the best value. The default value is 4. 
The FrameRateLowBandwidthSkipCount property is the number of frames to skip when the encoder cannot keep up with the broadcaster. In low bandwidth conditions the encoder will skip frames to conserve bandwidth but still send consistent frames so the encoder can produce smooth playback. The maximum number of frames that can be skipped is equal to the key frame interval minus one - i.e. setting this to 29 with a key frame interval of 30 will produce a key frame only stream, setting to 1 will never skip frames. The default is 4 meaning skip 1 of every 4 frames.