Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of requests per second to the same .ts files #930

Closed
DavidVentura opened this issue Apr 6, 2016 · 26 comments
Closed

Lots of requests per second to the same .ts files #930

DavidVentura opened this issue Apr 6, 2016 · 26 comments
Labels

Comments

@DavidVentura
Copy link

Browser: Chrome/Firefox

OS: Linux

Clappr Version: latest from cdn

Steps to reproduce:

When playing video I get lots of request for the same files yet the video doesn't seem to play (plays, finishes a segment, gets stuck for 1-2 segments, plays a single segment... )
Did you try to reproduce this issue at http://cdn.clappr.io/: Yes, same thing

Playing the m3u8 file on mpv/vlc works wonderfully. Looks like a player issue..
2016-04-06-103320_897x484_scrot

Edit, this doesn't happen (multiple requests per file) on https://cdn.jsdelivr.net/clappr/latest/clappr.min.js
but does on
http://cdn.clappr.io/latest/clappr.js

@leandromoreira
Copy link
Member

@DavidVentura jsdelivr is hosting an old version of Clappr, can you provide the stream for testing?

@lordcris
Copy link

This happens for me as well ( Chrome on Arch linux)
I'm using wowza with DVR enabled.

untitled

@leandromoreira
Copy link
Member

@lordcris can you try to reproduce this error at http://dailymotion.github.io/hls.js/demo/ ?

@lordcris
Copy link

I can't.
It works fine on http://dailymotion.github.io/hls.js/demo/
Using clappr this issue presents itself once I try and and click on random point on the timeline.
If you give me an exact time I will be happy to provide you with a testing stream.

@leandromoreira
Copy link
Member

leandromoreira commented Apr 23, 2016

Thanks @lordcris while using the https://cdn.jsdelivr.net/clappr/latest/clappr.min.js does any errors happens?

@lordcris
Copy link

yes, they do.
I've made a test page http://testing.atanassov.net/
Once the video is playing you have to click on the timeline back and forth multiple times and the "HD" indicator will start flashing and the player will start downloading the same segments over and over again.

@leandromoreira
Copy link
Member

leandromoreira commented Apr 24, 2016

@lordcris I think the player is canceling the request and issuing a new request, it looks legit.

  1. trying to play a video the player chose an initial quality (1920x1080)
  2. then it can't play it (it took too long to download the chunk), it tries to play a lower quality (640)
  3. the problem persists (it's trying to play the same chuck for two different qualities but over the same single quality bitrate stream)
  4. loop

The thing I've noticed was that your master playlist seems to be malformed, all bitrates qualities are pointing to the same quality (1080p), making the adaptation stream not work properly. For instance you have a 426x240 pointing to a 1080p and so on and so forth.

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=3978000,CODECS="avc1.100.41,mp4a.40.2",RESOLUTION=1920x1080
http://cdn1.atanassov.net/myliveorigin/mystream_1080p/chunklist_DVR.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2328000,CODECS="avc1.100.40,mp4a.40.2",RESOLUTION=1280x720
http://cdn1.atanassov.net/myliveorigin/mystream_1080p/chunklist_DVR.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1228000,CODECS="avc1.100.31,mp4a.40.2",RESOLUTION=854x480
http://cdn1.atanassov.net/myliveorigin/mystream_1080p/chunklist_DVR.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=678000,CODECS="avc1.100.30,mp4a.40.2",RESOLUTION=640x360
http://cdn1.atanassov.net/myliveorigin/mystream_1080p/chunklist_DVR.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=403000,CODECS="avc1.100.21,mp4a.40.2",RESOLUTION=426x240
http://cdn1.atanassov.net/myliveorigin/mystream_1080p/chunklist_DVR.m3u8

I think, it is trying to download multiple times the same chunk mostly because all qualities are the same single bitrate (therefore player will try to download 1.ts from multiple qualities, trying to adapt, ) you can either solve this issue, giving each bitrate its real chunk list or just point to the 1080p.

@lordcris
Copy link

Great catch!
I fixed the malformed playlist but unfortunately the error keep appearing.

screenshot from 2016-04-24 16-32-38

@leandromoreira
Copy link
Member

leandromoreira commented Apr 24, 2016

I could reproduce it here, pasting the log for future reference. I'm gonna try to see what's happening.

[debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][Container] container:stats:report Object {startupTime: 6145, rebuffers: 4, rebufferingTime: 15784, watchingTime: 866, height: 360…}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [warn][hlsjs: non-fatal error occurred, evt hlsError, data [object Object] ]
log.js:75 [debug][hls] playback:levels:switch:end
log.js:75 [debug][hls] playback:level:switch Object {level: 0}
log.js:75 [debug][hls] playback:highdefinitionupdate false
log.js:75 [debug][Container] container:highdefinitionupdate false
log.js:75 [debug][hls] playback:bitrate Object {height: 240, width: 426, bandwidth: undefined, bitrate: 403000, level: 0}
log.js:75 [debug][Container] container:bitrate Object {height: 240, width: 426, bandwidth: undefined, bitrate: 403000, level: 0}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][hls] playback:levels:switch:end
log.js:75 [debug][hls] playback:level:switch Object {level: 1}
log.js:75 [debug][hls] playback:highdefinitionupdate false
log.js:75 [debug][Container] container:highdefinitionupdate false
log.js:75 [debug][hls] playback:bitrate Object {height: 360, width: 640, bandwidth: undefined, bitrate: 678000, level: 1}
log.js:75 [debug][Container] container:bitrate Object {height: 360, width: 640, bandwidth: undefined, bitrate: 678000, level: 1}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [warn][hlsjs: non-fatal error occurred, evt hlsError, data [object Object] ]
log.js:75 [debug][hls] playback:levels:switch:end
log.js:75 [debug][hls] playback:level:switch Object {level: 0}
log.js:75 [debug][hls] playback:highdefinitionupdate false
log.js:75 [debug][Container] container:highdefinitionupdate false
log.js:75 [debug][hls] playback:bitrate Object {height: 240, width: 426, bandwidth: undefined, bitrate: 403000, level: 0}
log.js:75 [debug][Container] container:bitrate Object {height: 240, width: 426, bandwidth: undefined, bitrate: 403000, level: 0}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][hls] playback:levels:switch:end
log.js:75 [debug][hls] playback:level:switch Object {level: 1}
log.js:75 [debug][hls] playback:highdefinitionupdate false
log.js:75 [debug][Container] container:highdefinitionupdate false
log.js:75 [debug][hls] playback:bitrate Object {height: 360, width: 640, bandwidth: undefined, bitrate: 678000, level: 1}
log.js:75 [debug][Container] container:bitrate Object {height: 360, width: 640, bandwidth: undefined, bitrate: 678000, level: 1}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [warn][hlsjs: non-fatal error occurred, evt hlsError, data [object Object] ]
log.js:75 [debug][hls] playback:levels:switch:end
log.js:75 [debug][hls] playback:level:switch Object {level: 0}
log.js:75 [debug][hls] playback:highdefinitionupdate false
log.js:75 [debug][Container] container:highdefinitionupdate false
log.js:75 [debug][hls] playback:bitrate Object {height: 240, width: 426, bandwidth: undefined, bitrate: 403000, level: 0}
log.js:75 [debug][Container] container:bitrate Object {height: 240, width: 426, bandwidth: undefined, bitrate: 403000, level: 0}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][hls] playback:levels:switch:end
log.js:75 [debug][hls] playback:level:switch Object {level: 1}
log.js:75 [debug][hls] playback:highdefinitionupdate false
log.js:75 [debug][Container] container:highdefinitionupdate false
log.js:75 [debug][hls] playback:bitrate Object {height: 360, width: 640, bandwidth: undefined, bitrate: 678000, level: 1}
log.js:75 [debug][Container] container:bitrate Object {height: 360, width: 640, bandwidth: undefined, bitrate: 678000, level: 1}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [warn][hlsjs: non-fatal error occurred, evt hlsError, data [object Object] ]
log.js:75 [debug][MediaControl] mediacontrol:mousemove:seekbar Object {originalEvent: MouseEvent, isTrusted: true, screenX: 406, screenY: 261, clientX: 406…}
log.js:75 [debug][hls] playback:levels:switch:end
log.js:75 [debug][hls] playback:level:switch Object {level: 0}
log.js:75 [debug][hls] playback:highdefinitionupdate false
log.js:75 [debug][Container] container:highdefinitionupdate false
log.js:75 [debug][hls] playback:bitrate Object {height: 240, width: 426, bandwidth: undefined, bitrate: 403000, level: 0}
log.js:75 [debug][Container] container:bitrate Object {height: 240, width: 426, bandwidth: undefined, bitrate: 403000, level: 0}
log.js:75 [debug][MediaControl] mediacontrol:mouseleave:seekbar Object {originalEvent: MouseEvent, isTrusted: true, screenX: 404, screenY: 266, clientX: 404…}
log.js:75 [debug][MediaControl] mediacontrol:mousemove:seekbar Object {originalEvent: MouseEvent, isTrusted: true, screenX: 404, screenY: 266, clientX: 404…}
log.js:75 [debug][MediaControl] mediacontrol:show MediaControl
log.js:75 [debug][Container] container:mediacontrol:show
log.js:75 [debug][MediaControl] mediacontrol:mouseleave:seekbar Object {originalEvent: MouseEvent, isTrusted: true, screenX: 396, screenY: 274, clientX: 396…}
log.js:75 [debug][MediaControl] mediacontrol:show MediaControl
log.js:75 [debug][Container] container:mediacontrol:show
log.js:75 [debug][MediaControl] mediacontrol:show MediaControl
log.js:75 [debug][Container] container:mediacontrol:show
log.js:75 [debug][MediaControl] mediacontrol:show MediaControl
log.js:75 [debug][Container] container:mediacontrol:show
log.js:75 [debug][MediaControl] mediacontrol:hide MediaControl
log.js:75 [debug][Container] container:mediacontrol:hide
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][hls] playback:levels:switch:end
log.js:75 [debug][hls] playback:level:switch Object {level: 1}
log.js:75 [debug][hls] playback:highdefinitionupdate false
log.js:75 [debug][Container] container:highdefinitionupdate false
log.js:75 [debug][hls] playback:bitrate Object {height: 360, width: 640, bandwidth: undefined, bitrate: 678000, level: 1}
log.js:75 [debug][Container] container:bitrate Object {height: 360, width: 640, bandwidth: undefined, bitrate: 678000, level: 1}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [debug][hls] playback:fragment:loaded Object {payload: ArrayBuffer, frag: Object, stats: Object}
log.js:75 [warn][hlsjs: non-fatal error occurred, evt hlsError, data [object Object] ]

@leandromoreira
Copy link
Member

It seems that the player is falling on a non-fatal error on hls.js and it's retrying forever (or at least many and many times) to recover.

@leandromoreira
Copy link
Member

The hls.js error is a non-fatal "fragLoopLoadingError"

@leandromoreira
Copy link
Member

leandromoreira commented Apr 24, 2016

@lordcris

I could reproduce it on hls.js demo page http://dailymotion.github.io/hls.js/demo/ I think this is not a clappr's problem and maybe not even a hls.js problem, it seems like a problem on your stream creation.

@mangui what are you thoughts on this problem:

hls.js keeps retrying to download the same .ts files over and over again.

Steps:

  1. go to http://dailymotion.github.io/hls.js/demo/ and try to play http://testing.atanassov.net/playlist.m3u8
  2. wait for 4 seconds and then seek to the middle of the video
  3. wait for 4 seconds and then seek to near of the initial of the video
  4. the error "fragLoopLoadingError" will happen and player tries to re-download the same .ts files over and over again.

@clappr/core

Or maybe we should stop retrying after X times of a non-fatal error too. (and zeroed this X time on time_update event)

@lordcris

You can try to force the flash usage:

plugins: [Clappr.FlasHLS]

@lordcris
Copy link

I see. It's a stream generated using wowza media server. Do you think it's related?

@leandromoreira
Copy link
Member

leandromoreira commented Apr 24, 2016

I think it is... mostly because I never faced such thing and if you use a stable stream of hls (ex: http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8 ) you probably will not be able to reproduce the same error. (I could not)

What's the source are you using to generate this hls? (rtmp, mp4... is it in your hand? can you run a mediainfo or any other tool to help understand the problems with this input??)

I don't know much of wowza to help you though.

@DavidVentura
Copy link
Author

I get this error on a livestream, playlist generated by nginx-rtmp. Other
players (such as mpv) can play the .m3u8 playlist just fine and they don't
complain about it being malformed

On 24 April 2016 at 12:09, Leandro Moreira notifications@github.com wrote:

I think it's because if I never faced such thing and if you use a stable
stream of hls (http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8)
you probably will not be able to reproduce the same error. (I could not)

What's the source are you using to generate this hls? (rtmp, mp4... is it
in your hand? can you run a mediainfo or any other tool to help understand
the problems with this input??)

I don't know much of wowza to help you though.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#930 (comment)

Stack is the new term for "I have no idea what I'm actually using".

@leandromoreira
Copy link
Member

@DavidVentura it's hard to compare one player with another, for instance VLC plays almost anything it can, it "ignores" errors and even intelligently guesses things to make the video

If we're able to reproduce this issue and we think this is a playback problem, we should open an issue on hls.js project. What do you think?

@lordcris
Copy link

this is the mediainfo of the file

mediainfo Youre.the.Worst.S01E10.Fists.and.Feet.and.Stuff.1080p.WEB-DL.DD5.1.H.264-NTb.mkv
General
Unique ID : 184771822280485480539114549867318716125 (0x8B01C22FBC7F258E96D767597725A6DD)
Complete name : Youre.the.Worst.S01E10.Fists.and.Feet.and.Stuff.1080p.WEB-DL.DD5.1.H.264-NTb.mkv
Format : Matroska
Format version : Version 4 / Version 2
File size : 1 004 MiB
Duration : 26mn 23s
Overall bit rate : 5 318 Kbps
Encoded date : UTC 2014-09-19 08:26:52
Writing application : mkvmerge v6.9.1 ('Blue Panther') 64bit built on Apr 18 2014 18:23:38
Writing library : libebml v1.3.0 + libmatroska v1.4.1
Cover : Yes
Attachments : small_cover.jpg / cover.jpg / cover_land.jpg / small_cover_land.jpg
Released by : BLiN@BTN/HDB

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 26mn 23s
Bit rate : 4 828 Kbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.097
Stream size : 911 MiB (91%)
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Audio
ID : 2
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : A_AC3
Duration : 26mn 23s
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Frame rate : 31.250 fps (1536 spf)
Compression mode : Lossy
Delay relative to video : -25ms
Stream size : 72.5 MiB (7%)
Language : English
Default : Yes
Forced : No

Text
ID : 3
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Language : English
Default : Yes
Forced : No

I send it to wowza using this command:

ffmpeg -re -i Youre.the.Worst.S01E10.Fists.and.Feet.and.Stuff.1080p.WEB-DL.DD5.1.H.264-NTb.mkv -vcodec libx264 -preset veryfast -maxrate 5000k -bufsize 10000k -acodec aac -b:a 128k -strict -2 -flags +global_header -g 48 -f flv "rtmp://_:_@wowza2.atanassov.net:1935/myliveorigin/mystream"

then the mediaserver transrates it in the stream you are seeing ( with the DVR option enabled)

@leandromoreira
Copy link
Member

Try to add a gop for each 30 frames -g 30 -r 30 instead of 48.

@DavidVentura
Copy link
Author

DavidVentura commented Apr 26, 2016

Can you test with this live stream? I'm seeing the 'bug' with clappr.
https://plataforma.especificosba.com.ar/hls/test.m3u8

It'll be up for about one hour and a half, after that I can reset it if you ask.

The playlist seems fine.

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:38
#EXT-X-TARGETDURATION:15
#EXT-X-DISCONTINUITY
#EXTINF:9.985,
test-38.ts
#EXT-X-DISCONTINUITY
#EXTINF:9.985,
test-39.ts

Testing on hls.js I see 'gaps' between segments. On every gap the bug occurs, I can manually skip ahead of the gap and the video works

2016-04-26-131637_1062x764_scrot

@DavidVentura
Copy link
Author

Looks like it has something to do with the hls.js version being used.
https://github.com/dailymotion/hls.js/issues/407#issuecomment-214815377

Can you upgrade hls.js to 0.6.1 on clappr?

@leandromoreira
Copy link
Member

@DavidVentura nice catch :) I don't know since it's a pre-release build I don't feel comfortable, what do you think @clappr/core ?

@tjenkinson
Copy link
Contributor

I agree @leandromoreira I don't think we should use the pre release because it's not been as well tested as the major version. It sounds like a bug though so @mangui might be able to backport the fix into v0.5.x if you create an issue with hlsjs.

the other option is that you build clappr manually with 0.6.x by updating the package.json before you npm update.

@leandromoreira
Copy link
Member

I suppose we'll migrate when makes sense :)

@cdgraff
Copy link

cdgraff commented Oct 22, 2016

Hi, I reach here with similar Issue on liveStreaming... after test on Dailymotion demo page, all works well with current stable relase of hls.js

Some plans to upgrade?

@leandromoreira
Copy link
Member

@cdgraff yeah we're planning to do a major upgrade that should include this (we'll try to organize and follow a flow of tasks here https://github.com/clappr/clappr/projects/1 )

@edemir206
Copy link

Hi,

I'm facing the exact same issue, i'm using NGINX + RTMP module and clappr.

My stream has EXT-XDISCONTINUITY and after this the player just starts trying to get the same 27.ts and 28.ts over and over again.

#EXT-X-DISCONTINUITY
#EXTINF:1.001,
/conteudo/hls/9t8huwb_recordall/27.ts
#EXTINF:9.992,
/conteudo/hls/9t8huwb_recordall/28.ts
#EXT-X-DISCONTINUITY

Does anyone know a solution for this ?

in vlc it plays fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants