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

Issues with HLS streaming close to end of file

I'm trying to use the Roku to play a live HLS stream. I start streaming, and then launch the player on roku (I'm using the simple video player example with my own local server put in). If I fast-forward to try to get closer to the end of the stream (so less delay between the video and the source), it will frequently lock up when I reach the end of the stream- the "Loading, Please Wait" screen stays up with the progress bar stuck around 1/3 progress. If I rewind, I can see stuff that I had already played, but can never go past the point where it stopped. Eventually, it will get unstuck and play again.

I have the web server showing requests live, and when this happens, the Roku stops requesting the m3u8 playlist or any .ts files (normally, it is fetching them every few seconds). Eventually after seeking through the stream a little, it "wakes up".

I'd ideally like to go right up to the end of the stream to minimize the delay from the live source.

I'm creating the files with ffmpeg to do the encoding and Apple's mediastreamsegmenter to do the HLS segmenting. I'm using 5 second segments, and keeping them all in the playlist (we need to be able to go back and play the content again if we want). There is no CDN- I'm serving the files directly off of my computer from the folder that mediastreamsegmenter is writing them to.

The command I'm using to generate the HLS files is:
ffmpeg -re -i <input file> -c:a copy -c:v libx264 -b:v 900k -bsf:v h264_mp4toannexb -f mpegts - | mediastreamsegmenter -f /Volumes/web/stream -i out2.m3u8 -s 10000 -S 1 -t 5

I have a Roku 3 (4200X) with software version 5.6, build 60.

There aren't any error messages in the debug console (port 8085)
The web server request logs look like:

---- It is playing fine here----
192.168.1.108 - - [03/Jan/2015 03:31:35] "GET /stream/fileSequence362.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:31:40] "GET /stream/out2.m3u8 HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:31:40] "GET /stream/fileSequence363.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:31:45] "GET /stream/out2.m3u8 HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:31:45] "GET /stream/fileSequence364.ts HTTP/1.1" 200 -
--- Now it get stuck, after seeking back and forth a little, it realizes that it should refresh the playlist, and then it grabs the backlog of chunks
192.168.1.108 - - [03/Jan/2015 03:33:34] "GET /stream/out2.m3u8 HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:40] "GET /stream/out2.m3u8 HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:40] "GET /stream/fileSequence372.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:40] "GET /stream/fileSequence373.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:40] "GET /stream/fileSequence374.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:40] "GET /stream/fileSequence375.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence376.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence377.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence378.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence379.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence380.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence381.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence382.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence383.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence384.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence385.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence386.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:41] "GET /stream/fileSequence387.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:45] "GET /stream/out2.m3u8 HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:45] "GET /stream/fileSequence388.ts HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:50] "GET /stream/out2.m3u8 HTTP/1.1" 200 -
192.168.1.108 - - [03/Jan/2015 03:33:50] "GET /stream/fileSequence389.ts HTTP/1.1" 200 -

EDIT: The stream plays fine in Quicktime on my computer.
0 Kudos
2 REPLIES 2
RokuJoel
Binge Watcher

Re: Issues with HLS streaming close to end of file

You could try setting playstart a little in the future before you start playing, this should push the start of play as close as the device will get to real time (which is still probably 15-30 seconds behind real time):


time=createobject("rodatetime")
now=time.asseconds()
videoclip.playstart=now+1800

- Joel
0 Kudos
SoN9ne
Visitor

Re: Issues with HLS streaming close to end of file

Were you able to resolve this issue? I am having this issue too

This code does nothing for getting the "Loading, please wait" message.
time=createobject("rodatetime")
now=time.asseconds()
videoclip.playstart=now+1800
0 Kudos