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: 
majormal
Visitor

Adobe Media Server 5 HLS Adaptive

Hi,

I'm trying to use the example 'videoplayer' code to access HLS content from an out-of-box install of AMS 5.

I've tweaked a set of channels to look like:

        
<item sdImg="file://pkg:/images/test-streams.png" hdImg="file://pkg:/images/test-streams.png">
<title>Adobe HLS Test Stream - 1000 kbps</title>
<contentId>20001</contentId>
<contentType>Test</contentType>
<contentQuality>SD</contentQuality>
<streamFormat>hls</streamFormat>
<media>
<streamQuality>SD</streamQuality>
<streamBitrate>1000</streamBitrate>
<streamUrl>http://192.168.1.223/hls-vod/sample1_1000kbps.f4v.m3u8</streamUrl>
</media>
<synopsis>Test HLS - 1000 kbps</synopsis>
<genres>TV</genres>
<runtime>0</runtime>
</item>
<item sdImg="file://pkg:/images/test-streams.png" hdImg="file://pkg:/images/test-streams.png">
<title>Adobe HLS Test Stream - 1500 kbps</title>
<contentId>20002</contentId>
<contentType>Test</contentType>
<contentQuality>SD</contentQuality>
<streamFormat>hls</streamFormat>
<media>
<streamQuality>SD</streamQuality>
<streamBitrate>1500</streamBitrate>
<streamUrl>http://192.168.1.223/hls-vod/sample1_1500kbps.f4v.m3u8</streamUrl>
</media>
<synopsis>Test HLS - 1500 kbps</synopsis>
<genres>TV</genres>
<runtime>0</runtime>
</item>
<item sdImg="file://pkg:/images/test-streams.png" hdImg="file://pkg:/images/test-streams.png">
<title>Adobe HLS Test Stream - Adaptive Bitrate</title>
<contentId>20003</contentId>
<contentType>Test</contentType>
<contentQuality>HD</contentQuality>
<streamFormat>hls</streamFormat>
<media>
<streamQuality>HD</streamQuality>
<streamBitrate>0</streamBitrate>
<streamUrl>http://192.168.1.223/hls-vod/hls_sample1_manifest.m3u8</streamUrl>
</media>
<synopsis>Test HLS - Adapative 150kbps - 1500kbps</synopsis>
<genres>TV</genres>
<runtime>0</runtime>
</item>


All the channels work fine except the last one, which won't play. Debug console says 'Unspecified or invalid track path/url.'

Putting the URL 'http://192.168.1.223/hls-vod/hls_sample1_manifest.m3u8' into safari on an iphone works fine, so I know the URL is good.

manifest looks like:


#EXTM3U

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=150000

/hls-vod/sample1_150kbps.f4v.m3u8

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=500000

/hls-vod/sample1_500kbps.f4v.m3u8

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=700000

/hls-vod/sample1_700kbps.f4v.m3u8

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1000000

/hls-vod/sample1_1000kbps.f4v.m3u8

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1500000

/hls-vod/sample1_1500kbps.f4v.m3u8



I've also added


If item.StreamFormat="hls"
item.SwitchingStrategy="full-adaptation"
End If


to showFeed.brs as per another post here, with no joy.

Any ideas?

Thanks,
mm
0 Kudos
13 REPLIES 13
RokuJoel
Binge Watcher

Re: Adobe Media Server 5 HLS Adaptive

Hi, try plugging this:

url=["http://192.168.1.223/hls-vod/hls_sample1_manifest.m3u8"]
srt=""

into the simplevideoplayer example and see if it works there. if not, then I would look into your server configuration. Also, does it play in VLC and if it does, are there any error messages logged?

- Joel
0 Kudos
majormal
Visitor

Re: Adobe Media Server 5 HLS Adaptive

Hi Joel,

Playing in VLC revealed that the url was getting mangled and an extra 'hls-vod' was being tacked on (but I assume that's just a VLC thing):


$ vlc http://192.168.1.223/hls-vod/hls_sample1_manifest.m3u8
VLC media player 2.0.8 Twoflower (revision 2.0.8a-0-g68cf50b)
[0x21a1108] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0x7f6c20007178] stream_filter_httplive stream: HTTP Live Streaming (192.168.1.223/hls-vod/hls_sample1_manifest.m3u8)
[0x7f6c20007178] stream_filter_httplive stream: Meta playlist
[0x7f6c20007178] stream_filter_httplive stream: bandwidth adaptation detected (program-id=1, bandwidth=150000).
[0x7f6c200062d8] access_http access error: error: HTTP/1.1 404 Not Found
[0x7f6c200062d8] access_http access error: error: HTTP/1.1 404 Not Found
[0x7f6c200062d8] access_mms access error: error: HTTP/1.1 404 Not Found
[0x7f6c20007178] main stream error: no suitable access module for `http://192.168.1.223/hls-vod//hls-vod/sample1_150kbps.f4v.m3u8'


I therefore moved the manifest file to the root of the webserver and it now plays fine in VLC:


$ vlc http://192.168.1.223/hls_sample1_manifest.m3u8
VLC media player 2.0.8 Twoflower (revision 2.0.8a-0-g68cf50b)
[0x1acb108] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0x7f95c00072c8] stream_filter_httplive stream: HTTP Live Streaming (192.168.1.223/hls_sample1_manifest.m3u8)
[0x7f95c00072c8] stream_filter_httplive stream: Meta playlist
[0x7f95c00072c8] stream_filter_httplive stream: bandwidth adaptation detected (program-id=1, bandwidth=150000).
[0x7f95c00072c8] stream_filter_httplive stream: VOD Playlist HLS protocol version: 2
[0x7f95c00072c8] stream_filter_httplive stream: video on demand (vod) mode
[0x7f95c00072c8] stream_filter_httplive stream: bandwidth adaptation detected (program-id=1, bandwidth=500000).
[0x7f95c00072c8] stream_filter_httplive stream: VOD Playlist HLS protocol version: 2
[0x7f95c00072c8] stream_filter_httplive stream: video on demand (vod) mode
[0x7f95c00072c8] stream_filter_httplive stream: bandwidth adaptation detected (program-id=1, bandwidth=700000).
[0x7f95c00072c8] stream_filter_httplive stream: VOD Playlist HLS protocol version: 2
[0x7f95c00072c8] stream_filter_httplive stream: video on demand (vod) mode
[0x7f95c00072c8] stream_filter_httplive stream: bandwidth adaptation detected (program-id=1, bandwidth=1000000).
[0x7f95c00072c8] stream_filter_httplive stream: VOD Playlist HLS protocol version: 2
[0x7f95c00072c8] stream_filter_httplive stream: video on demand (vod) mode
[0x7f95c00072c8] stream_filter_httplive stream: bandwidth adaptation detected (program-id=1, bandwidth=1500000).
[0x7f95c00072c8] stream_filter_httplive stream: VOD Playlist HLS protocol version: 2
[0x7f95c00072c8] stream_filter_httplive stream: video on demand (vod) mode
[0x7f95c00072c8] stream_filter_httplive stream: Choose segment 0/15 (sequence=2)
[0x7f95c00072c8] stream_filter_httplive stream: downloaded segment 0 from stream 0
[0x7f95c00072c8] stream_filter_httplive stream: detected faster bandwidth (1500000) stream
[0x7f95c00072c8] stream_filter_httplive stream: downloaded segment 1 from stream 4
[0x7f95c00072c8] stream_filter_httplive stream: playing segment 0 from stream 0


But not in simplevideoplayer:


Unknown event: 11 msg: Unspecified or invalid track path/url.
play failed:
Closing video screen


As previously mentioned, this plays fine on an iphone and I've now also tried it on a Samsung smart TV which works, although for some reason only at the lowest bit rate.

Is it possible to get more detailed debugging from the Roku play function to see why it's rejecting the stream?

cheers,
Adam
0 Kudos
RokuJoel
Binge Watcher

Re: Adobe Media Server 5 HLS Adaptive

Yes, you can use roSystemLog and also msg.isStreamSegmentInfo()

- Joel
0 Kudos
majormal
Visitor

Re: Adobe Media Server 5 HLS Adaptive

Thanks Joel...

I've added some more logging and it looks like it retrieves the manifest OK, but then doesn't go on to try and get any of the actual stream URLs:


Status: ok
LogType: http.connect
TargetIp: 192.168.1.223
HttpCode: 200
Datetime: <Component: roDateTime>
OrigUrl: http://192.168.1.223/hls_sample1_manifest.m3u8
Url: http://192.168.1.223/hls_sample1_manifest.m3u8
Method: GET

showHomeScreen | msg = Unspecified or invalid track path/url. | index = 0
Video status: 0 0
showHomeScreen | msg = | index = -5
Video request failure: -5 1
<Component: roVideoScreenEvent>
showHomeScreen | msg = | index = 0
Screen closed
Button pressed: 2 0



Here is my code:



Function showVideoScreen(episode As Object)

if type(episode) <> "roAssociativeArray" then
print "invalid data passed to showVideoScreen"
return -1
endif

port = CreateObject("roMessagePort")
screen = CreateObject("roVideoScreen")
screen.SetMessagePort(port)

screen.SetPositionNotificationPeriod(30)
screen.SetContent(episode)
screen.Show()


' debugging
syslog = CreateObject("roSystemLog")
syslog.SetMessagePort(port)
syslog.EnableType("http.error")
syslog.EnableType("http.connect")

while true
msg = wait(0, port)

if type(msg) = "roVideoScreenEvent" then
print "showHomeScreen | msg = "; msg.getMessage() " | index = "; msg.GetIndex()
if msg.isScreenClosed()
print "Screen closed"
exit while
elseif msg.isRequestFailed()
print "Video request failure: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isStatusMessage()
print "Video status: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
elseif msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
RegWrite(episode.ContentId, nowpos.toStr())
else
print "Unexpected event type: "; msg.GetType()
end if
elseif type(msg) = "roSystemLogEvent" then
print msg.GetInfo()
else
print "Unexpected message class: "; type(msg)
end if
end while

End Function



So, just to clarify... According to the documentation, the roku player should be able to handle adaptive bitrates:

http://sdkdocs.roku.com/display/sdkdoc/Encoding+Guide#EncodingGuide-40HLSHTTPLiveStreaming

All the individual streams mentioned in the manifest file play fine, so the only thing left is processing of the manifest which I assume is done by the low level video event handler? Or do I need to start it with some special options?

BTW, if you want to cut to the chase and just try this out for yourself you can download a free version of AMS here:

http://www.adobe.com/cfusion/tdrc/index.cfm?product=adobemediaserver

Just unpack, run the install script and then "/opt/adobe/ams/server start" as root and you're up and running - the test stream URLs should then be live and hopefully you'll quickly spot where we're going wrong! 🙂

cheers & thanks again for your help,
Adam
0 Kudos
RokuMarkn
Visitor

Re: Adobe Media Server 5 HLS Adaptive

The problem is probably the full path names you're using as URLs. What firmware version are you using? I think the 3.x firmware doesn't support this. I'm not sure the 5.x firmware does either. Try using either full URLs (with http: and the domain name), or partial pathnames relative to the location of the manifest file, without a leading slash.

--Mark
0 Kudos
majormal
Visitor

Re: Adobe Media Server 5 HLS Adaptive

Hi Mark,

I've changed the manifest to use the full path and also I print msg.GetInfo(), and now I get:


Status: ok
LogType: http.connect
TargetIp: 192.168.1.223
HttpCode: 200
Datetime: <Component: roDateTime>
OrigUrl: http://192.168.1.223/hls_sample1_manifest.m3u8
Url: http://192.168.1.223/hls_sample1_manifest.m3u8
Method: GET

StreamBitrate: 0
MeasuredBitrate: 9765
Url: http://192.168.1.223/hls_sample1_manifest.m3u8

showHomeScreen | msg = An unexpected problem (but not server timeout or HTTP error) has been detected. | index = -3
Video request failure: -3 0
invalid
showHomeScreen | msg = | index = 0
Screen closed
Button pressed: 2 0


So the error has changed from -5 to -3 but still no stream...

cheers,
Adam
0 Kudos
majormal
Visitor

Re: Adobe Media Server 5 HLS Adaptive

Perhaps we should simplify the question:

Given this list of valid URLs, known to be working with the Roku player, what manifest file do I have to create to use HLS adaptive bitrates?

http://192.168.1.223/hls-vod/sample1_150kbps.f4v.m3u8
http://192.168.1.223/hls-vod/sample1_500kbps.f4v.m3u8
http://192.168.1.223/hls-vod/sample1_700kbps.f4v.m3u8
http://192.168.1.223/hls-vod/sample1_1000kbps.f4v.m3u8
http://192.168.1.223/hls-vod/sample1_1500kbps.f4v.m3u8

Sorry if this is a dumb question, but I''ve looked high and low for an example manifest file and all I can find is pointers to tools I can't run (as I don't have a Mac) that will create one for me...

Thanks,
Adam
0 Kudos
RokuMarkn
Visitor

Re: Adobe Media Server 5 HLS Adaptive

Here is the HLS spec. There are some example playlists in the appendix. One problem with your playlist is you have no EXT-X-TARGETDURATION tag as required by section 3.2.1.

--Mark
0 Kudos
majormal
Visitor

Re: Adobe Media Server 5 HLS Adaptive

Manifests (i.e. Variant Playlists) don't seem to need that, and the example from the standard doesn't have it:

http://tools.ietf.org/html/draft-pantos-http-live-streaming-04#section-8.5

The individual variants are correct, and, as discussed earlier, all play fine on the Roku.

e.g.


$ cat sample1_150kbps.f4v.m3u8
#EXTM3U
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:NO
#EXT-X-VERSION:2
#EXT-X-TARGETDURATION:8
#EXTINF:8,
sample1_150kbps.f4vFrag1Num0.ts
#EXTINF:8,
sample1_150kbps.f4vFrag1Num1.ts
#EXTINF:8,
sample1_150kbps.f4vFrag2Num2.ts
#EXTINF:8,
sample1_150kbps.f4vFrag3Num3.ts
#EXTINF:8,
sample1_150kbps.f4vFrag4Num4.ts
#EXTINF:8,
sample1_150kbps.f4vFrag5Num5.ts
#EXTINF:8,
sample1_150kbps.f4vFrag6Num6.ts
#EXTINF:8,
sample1_150kbps.f4vFrag7Num7.ts
#EXTINF:8,
sample1_150kbps.f4vFrag8Num8.ts
#EXTINF:8,
sample1_150kbps.f4vFrag9Num9.ts
#EXTINF:8,
sample1_150kbps.f4vFrag10Num10.ts
#EXTINF:8,
sample1_150kbps.f4vFrag11Num11.ts
#EXTINF:8,
sample1_150kbps.f4vFrag12Num12.ts
#EXTINF:8,
sample1_150kbps.f4vFrag13Num13.ts
#EXTINF:3,
sample1_150kbps.f4vFrag14Num14.ts
#EXT-X-ENDLIST
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.