Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
joetesta
Roku Guru

issue with higher bitrate content

Hi,
Our channel has mp4 h.264 content encoded with HandbrakeCLI in two bitrates; 600kbps and 2500kbps. Now we want to experiment with higher bitrates and I encoded one file with a 5000kbps stream and added it to the xml file, but roku only gets the 2500kbps stream even though we have 15mbps download speed, and the content is served from CDN.

I added it to the XML like this,
<media>
<streamQuality>SD</streamQuality>
<streamBitrate>600</streamBitrate>
<streamUrl>09512_600.mp4</streamUrl>
</media>
<media>
<streamQuality>HD</streamQuality>
<streamBitrate>2500</streamBitrate>
<streamUrl>09512_2500.mp4</streamUrl>
</media>
<media>
<streamQuality>HD</streamQuality>
<streamBitrate>5000</streamBitrate>
<streamUrl>09512_5000.mp4</streamUrl>
</media>


Can anyone suggest what might be going wrong? thank you in advance,
Joe
aspiring
0 Kudos
10 REPLIES 10
RokuChris
Roku Employee
Roku Employee

Re: issue with higher bitrate content

Connection speed is only one of many factors that can affect stream selection. The box maintains an average bandwidth measurement that it uses to choose a stream.

The isStreamStarted event will tell you what the current measured bitrate is. http://sdkdocs.roku.com/display/sdkdoc/ ... layerEvent
0 Kudos
joetesta
Roku Guru

Re: issue with higher bitrate content

Thanks RokuChris -
I'm back looking at this and I tried getting the values from 'isStreamStarted' but must be doing something wrong; I put this

            elseif msg.isStreamStarted()
msgInfo = msg.GetInfo()
? "GOT Stream Info!!"
? "measured: "; msgInfo.MeasuredBitrate
? "stream avg: "; msgInfo.MeasuredBitrate
? "underrun?: "; msgInfo.IsUnderrun


in what seemed like the right place but I always get

measured:  39267
stream avg: 39267
underrun?: false


which can't be right, since it plays a 2.5 mbps stream without trouble.

Ultimately I found that by reversing the media order in the XML, roku chooses the highest bitrate. I don't understand why, but glad to have figured it out.

<media>
<streamQuality>SD</streamQuality>
<streamBitrate>5000</streamBitrate>
<streamUrl>09512_5000.mp4</streamUrl>
</media>
<media>
<streamQuality>HD</streamQuality>
<streamBitrate>2500</streamBitrate>
<streamUrl>09512_2500.mp4</streamUrl>
</media>
<media>
<streamQuality>HD</streamQuality>
<streamBitrate>600</streamBitrate>
<streamUrl>09512_600.mp4</streamUrl>
</media>
aspiring
0 Kudos
destruk
Binge Watcher

Re: issue with higher bitrate content

In that XML you have SD for the quality for the 5mbps stream. I think it should be HD for that bitrate.
One of your streams needs to be listed as SD so people with their roku device set to SD mode will have something to play.

As for your code you posted in regards to the numbers being the same, it's because you are using the same variable for both.
elseif msg.isStreamStarted()
msgInfo = msg.GetInfo()
? "GOT Stream Info!!"
? "measured: "; msgInfo.MeasuredBitrate
? "stream avg: "; msgInfo.MeasuredBitrate
? "underrun?: "; msgInfo.IsUnderrun

Your stream avg line is using .measuredbitrate instead of .streambitrate to print a result.
0 Kudos
joetesta
Roku Guru

Re: issue with higher bitrate content

Thanks destruk,
although repeating the var was in error, I was curious about the actual number - why is the measured bandwdith only 40k while we are watching a 2.5mbps stream?
best regards,
Joe
aspiring
0 Kudos
destruk
Binge Watcher

Re: issue with higher bitrate content

It's in kilobits

39267 / 8 = 4908.375 kilobytes
4908.375 / 1024 =~ 4.7 megabytes/second
0 Kudos
joetesta
Roku Guru

Re: issue with higher bitrate content

oh! I was looking at the description for StreamBitrate; "average bitrate of stream, in bits per second"
http://sdkdocs.roku.com/display/sdkdoc/ ... layerEvent
Now I see it, "MeasuredBitrate measured network bandwidth in kibibits per second"
Thanks for clearing that up 🙂
aspiring
0 Kudos
destruk
Binge Watcher

Re: issue with higher bitrate content

Well, I had another thread on this issue, but it hasn't been answered yet. I think their descriptions or sdk is wrong for what each one is really doing. 😞
0 Kudos
RokuMarkn
Visitor

Re: issue with higher bitrate content

What specifically do you think is wrong? I didn't understand your other thread; I thought you were just objecting to the use of the word kibibits. The value is the measured bits per second divided by 1024.

--Mark
0 Kudos
joetesta
Roku Guru

Re: issue with higher bitrate content

Mark I think he means this thread: viewtopic.php?f=34&t=64576&p=414382#p414382
I think that kibibits was another one?
aspiring
0 Kudos