video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.98k stars 2.59k forks source link

Only play first fragment #335

Closed odaru99 closed 8 years ago

odaru99 commented 8 years ago

Hello,

I am trying to play the live m3u8 file: http://220.135.82.119:8088/hls.html (H264 + AAC 16K/16Bits) it only display the first fragement..

But it works fine when 'only video data' in .ts files.

Can you help me to solve the problem, thank you.

phloxic commented 8 years ago

Did you try setting defaultAudioCodec: "mp4a.40.2" - you don't have a variant playlist and lc aac audio with very low bit rate. It may still fail because the aac track you're delivering lacks sample rate metadata, and it's unclear to how many channels you encoded, and it seems your segments are maybe removed to early or you have some strange redirect in place:

$ ffprobe -v warning http://220.135.82.119:8088/play.m3u8
[http @ 0x7ff51be007e0] HTTP error 404 Not Found
[hls,applehttp @ 0x7ff51c00da00] Failed to open segment of playlist 0
[aac @ 0x7ff51d001000] channel element 3.0 is not allocated
    Last message repeated 59 times
[http @ 0x7ff51be0f1c0] HTTP error 404 Not Found
[hls,applehttp @ 0x7ff51c00da00] Failed to open segment of playlist 0
[mpegts @ 0x7ff51d008000] Could not find codec parameters for stream 0 (Audio: aac (LC) ([15][0][0][0] / 0x000F), mono, fltp, 64 kb/s): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[aac @ 0x7ff51d024800] channel element 3.0 is not allocated
    Last message repeated 59 times
[hls,applehttp @ 0x7ff51c00da00] Could not find codec parameters for stream 0 (Audio: aac (LC) ([15][0][0][0] / 0x000F), mono, fltp, 64 kb/s): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
odaru99 commented 8 years ago

Hi, balcktrash,

I added defaultAudioCodec: "mp4a.40.2" now, but not improved. The audio encoding is 1ch/16k/16bits The testing server is in Taiwan.

phloxic commented 8 years ago

You also need to deliver everything with CORS headers: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

You get the appropriate console messages when testing in the sample player: http://dailymotion.github.io/hls.js/demo/?src=http%3A%2F%2F220.135.82.119%3A8088%2Fplay.m3u8%3Fa%3D1&enableStreaming=true&autoRecoverError=true&enableWorker=true&levelCapping=-1&defaultAudioCodec=mp4a.40.2

odaru99 commented 8 years ago

Hi, I added CORS header, and used sample player to test. But the video is still freeze.

Here is the Chrome console log :

[log] > trigger BUFFER_RESET 2016-03-28 06:19:01.994 logger.js:37 [log] > set autoLevelCapping:-1 2016-03-28 06:19:01.994 logger.js:37 [log] > attachMedia 2016-03-28 06:19:01.996 logger.js:37 [log] > media source opened 2016-03-28 06:19:01.998 logger.js:37 [log] > manifest loaded,1 level(s) found, first bitrate:undefined 2016-03-28 06:19:01.999 logger.js:37 [log] > startLoad 2016-03-28 06:19:01.999 logger.js:37 [log] > demuxing in webworker 2016-03-28 06:19:02.004 logger.js:37 [log] > switching to level 0 2016-03-28 06:19:02.006 logger.js:37 [log] > (re)loading playlist for level 0 2016-03-28 06:19:02.017 logger.js:37 [log] > level 0 loaded [55,64],duration:20 2016-03-28 06:19:02.017 logger.js:37 [log] > live playlist - first load, unknown sliding 2016-03-28 06:19:02.017 logger.js:37 [log] > Loading 62 of [55 ,64],level 0, currentTime:14,bufferEnd:14.000 2016-03-28 06:19:02.023 logger.js:37 [log] > Demuxing 62 of [55 ,64],level 0 2016-03-28 06:19:02.093 logger.js:37 [log] > creating sourceBuffer with mimeType:audio/mp4;codecs=mp4a.40.2 2016-03-28 06:19:02.094 logger.js:37 [log] > creating sourceBuffer with mimeType:video/mp4;codecs=avc1.64001f 2016-03-28 06:19:02.094 logger.js:37 [log] > track:audio,container:audio/mp4,codecs[level/parsed]=[undefined/mp4a.40.2] 2016-03-28 06:19:02.094 logger.js:37 [log] > track:video,container:video/mp4,codecs[level/parsed]=[undefined/avc1.64001f] 2016-03-28 06:19:02.095 logger.js:37 [log] > parsed video,PTS:[14.000,16.001],DTS:[14.000/16.001],nb:60 2016-03-28 06:19:02.096 logger.js:37 [log] > parsed audio,PTS:[14.000,15.978],DTS:[14.000/15.920],nb:30 2016-03-28 06:19:02.098 logger.js:37 [log] > media buffered : [14,15.92] 2016-03-28 06:19:02.099 logger.js:37 [log] > Loading 63 of [55 ,64],level 0, currentTime:15.977622222222223,bufferEnd:15.978 2016-03-28 06:19:02.099 logger.js:37 [log] > target seek position:14 2016-03-28 06:19:02.100 logger.js:37 [log] > adjust currentTime from 0 to 14 2016-03-28 06:19:02.105 logger.js:37 [log] > Demuxing 63 of [55 ,64],level 0 2016-03-28 06:19:02.109 logger.js:37 [log] > parsed video,PTS:[16.002,18.003],DTS:[16.001/18.003],nb:60 2016-03-28 06:19:02.110 logger.js:37 [log] > parsed audio,PTS:[15.978,17.962],DTS:[15.978/17.898],nb:30 2016-03-28 06:19:02.112 logger.js:37 [log] > media buffered : [14,17.897562] 2016-03-28 06:19:02.113 logger.js:37 [log] > Loading 64 of [55 ,64],level 0, currentTime:14,bufferEnd:17.898 2016-03-28 06:19:02.120 logger.js:37 [log] > Demuxing 64 of [55 ,64],level 0 2016-03-28 06:19:02.125 logger.js:37 [log] > parsed video,PTS:[18.004,20.006],DTS:[18.003/20.006],nb:60 2016-03-28 06:19:02.126 logger.js:37 [log] > parsed audio,PTS:[17.962,19.946],DTS:[17.962/19.882],nb:30 2016-03-28 06:19:02.126 logger.js:37 [log] > media buffered : [14,19.881562] 2016-03-28 06:19:04.020 logger.js:37 [log] > level 0 loaded [56,65],duration:20 2016-03-28 06:19:04.021 logger.js:37 [log] > live playlist sliding:2.000 2016-03-28 06:19:04.021 logger.js:37 [log] > Loading 65 of [56 ,65],level 0, currentTime:14,bufferEnd:19.882 2016-03-28 06:19:04.026 logger.js:37 [log] > Demuxing 65 of [56 ,65],level 0 2016-03-28 06:19:04.027 logger.js:37 [log] > parsed video,PTS:[20.006,22.008],DTS:[20.006/22.008],nb:60 2016-03-28 06:19:04.028 logger.js:37 [log] > parsed audio,PTS:[19.946,21.994],DTS:[19.946/21.930],nb:31 2016-03-28 06:19:04.029 logger.js:37 [log] > media buffered : [14,21.929562] 2016-03-28 06:19:06.020 logger.js:37 [log] > level 0 loaded [57,66],duration:20 2016-03-28 06:19:06.020 logger.js:37 [log] > live playlist sliding:4.000 2016-03-28 06:19:06.020 logger.js:37 [log] > Loading 66 of [57 ,66],level 0, currentTime:14,bufferEnd:21.930 2016-03-28 06:19:06.025 logger.js:37 [log] > Demuxing 66 of [57 ,66],level 0 2016-03-28 06:19:06.027 logger.js:37 [log] > parsed video,PTS:[22.008,24.008],DTS:[22.008/24.008],nb:60 2016-03-28 06:19:06.027 logger.js:37 [log] > parsed audio,PTS:[21.994,23.981],DTS:[21.994/23.914],nb:30 2016-03-28 06:19:06.028 logger.js:37 [log] > media buffered : [14,23.913562] 2016-03-28 06:19:08.020 logger.js:37 [log] > level 0 loaded [58,67],duration:20 2016-03-28 06:19:08.020 logger.js:37 [log] > live playlist sliding:6.000 2016-03-28 06:19:08.021 logger.js:37 [log] > Loading 67 of [58 ,67],level 0, currentTime:14,bufferEnd:23.914 2016-03-28 06:19:08.026 logger.js:37 [log] > Demuxing 67 of [58 ,67],level 0 2016-03-28 06:19:08.027 logger.js:37 [log] > parsed video,PTS:[24.009,26.010],DTS:[24.008/26.010],nb:60 2016-03-28 06:19:08.027 logger.js:37 [log] > parsed audio,PTS:[23.981,25.962],DTS:[23.981/25.901],nb:30 2016-03-28 06:19:08.029 logger.js:37 [log] > media buffered : [14,25.900562] 2016-03-28 06:19:10.021 logger.js:37 [log] > level 0 loaded [59,68],duration:20 2016-03-28 06:19:10.021 logger.js:37 [log] > live playlist sliding:8.000 2016-03-28 06:19:10.021 logger.js:37 [log] > Loading 68 of [59 ,68],level 0, currentTime:14,bufferEnd:25.901 2016-03-28 06:19:10.026 logger.js:37 [log] > Demuxing 68 of [59 ,68],level 0 2016-03-28 06:19:10.028 logger.js:37 [log] > parsed video,PTS:[26.011,28.012],DTS:[26.010/28.012],nb:60 2016-03-28 06:19:10.028 logger.js:37 [log] > parsed audio,PTS:[25.962,28.010],DTS:[25.962/27.946],nb:31 2016-03-28 06:19:10.030 logger.js:37 [log] > media buffered : [14,27.945562] 2016-03-28 06:19:12.020 logger.js:37 [log] > level 0 loaded [60,69],duration:20 2016-03-28 06:19:12.020 logger.js:37 [log] > live playlist sliding:10.000 2016-03-28 06:19:12.020 logger.js:37 [log] > Loading 69 of [60 ,69],level 0, currentTime:14,bufferEnd:27.946 2016-03-28 06:19:12.025 logger.js:37 [log] > Demuxing 69 of [60 ,69],level 0 2016-03-28 06:19:12.026 logger.js:37 [log] > parsed video,PTS:[28.013,30.015],DTS:[28.012/30.015],nb:60 2016-03-28 06:19:12.027 logger.js:37 [log] > parsed audio,PTS:[28.010,29.994],DTS:[28.010/29.930],nb:30 2016-03-28 06:19:12.029 logger.js:37 [log] > media buffered : [14,29.929562] 2016-03-28 06:19:14.020 logger.js:37 [log] > level 0 loaded [61,70],duration:20 2016-03-28 06:19:14.020 logger.js:37 [log] > live playlist sliding:12.000 2016-03-28 06:19:14.020 logger.js:37 [log] > Loading 70 of [61 ,70],level 0, currentTime:14,bufferEnd:29.930 2016-03-28 06:19:14.026 logger.js:37 [log] > Demuxing 70 of [61 ,70],level 0 2016-03-28 06:19:14.028 logger.js:37 [log] > parsed video,PTS:[30.015,32.017],DTS:[30.015/32.017],nb:60 2016-03-28 06:19:14.028 logger.js:37 [log] > parsed audio,PTS:[29.994,31.978],DTS:[29.994/31.914],nb:30 2016-03-28 06:19:14.030 logger.js:37 [log] > media buffered : [14,31.913562] 2016-03-28 06:19:16.020 logger.js:37 [log] > level 0 loaded [62,71],duration:20 2016-03-28 06:19:16.020 logger.js:37 [log] > live playlist sliding:14.000 2016-03-28 06:19:16.020 logger.js:37 [log] > Loading 71 of [62 ,71],level 0, currentTime:14,bufferEnd:31.914 2016-03-28 06:19:16.025 logger.js:37 [log] > Demuxing 71 of [62 ,71],level 0 2016-03-28 06:19:16.026 logger.js:37 [log] > parsed video,PTS:[32.017,34.017],DTS:[32.017/34.017],nb:60 2016-03-28 06:19:16.028 logger.js:37 [log] > parsed audio,PTS:[31.978,33.963],DTS:[31.978/33.898],nb:30 2016-03-28 06:19:16.028 logger.js:37 [log] > media buffered : [14,33.897562] 2016-03-28 06:19:18.021 logger.js:37 [log] > level 0 loaded [63,72],duration:20 2016-03-28 06:19:18.021 logger.js:37 [log] > live playlist sliding:15.978 2016-03-28 06:19:18.021 logger.js:37 [log] > Loading 72 of [63 ,72],level 0, currentTime:14,bufferEnd:33.898 2016-03-28 06:19:18.027 logger.js:37 [log] > Demuxing 72 of [63 ,72],level 0 2016-03-28 06:19:18.029 logger.js:37 [log] > parsed video,PTS:[34.018,36.019],DTS:[34.017/36.019],nb:60 2016-03-28 06:19:18.029 logger.js:37 [log] > parsed audio,PTS:[33.963,36.010],DTS:[33.963/35.947],nb:31 2016-03-28 06:19:18.030 logger.js:37 [log] > media buffered : [14,35.946562] 2016-03-28 06:19:20.021 logger.js:37 [log] > level 0 loaded [64,73],duration:20 2016-03-28 06:19:20.021 logger.js:37 [log] > live playlist sliding:17.962 2016-03-28 06:19:20.021 logger.js:37 [log] > Loading 73 of [64 ,73],level 0, currentTime:14,bufferEnd:35.947 2016-03-28 06:19:20.027 logger.js:37 [log] > Demuxing 73 of [64 ,73],level 0 2016-03-28 06:19:20.028 logger.js:37 [log] > parsed video,PTS:[36.020,38.021],DTS:[36.019/38.021],nb:60 2016-03-28 06:19:20.028 logger.js:37 [log] > parsed audio,PTS:[36.010,37.994],DTS:[36.010/37.930],nb:30 2016-03-28 06:19:20.030 logger.js:37 [log] > media buffered : [14,37.929562] 2016-03-28 06:19:22.021 logger.js:37 [log] > level 0 loaded [65,74],duration:20 2016-03-28 06:19:22.021 logger.js:37 [log] > live playlist sliding:19.946 2016-03-28 06:19:22.021 logger.js:37 [log] > Loading 74 of [65 ,74],level 0, currentTime:14,bufferEnd:37.930 2016-03-28 06:19:22.025 logger.js:37 [log] > Demuxing 74 of [65 ,74],level 0 2016-03-28 06:19:22.027 logger.js:37 [log] > parsed video,PTS:[38.022,40.023],DTS:[38.021/40.023],nb:60 2016-03-28 06:19:22.027 logger.js:37 [log] > parsed audio,PTS:[37.994,39.978],DTS:[37.994/39.914],nb:30 2016-03-28 06:19:22.029 logger.js:37 [log] > media buffered : [14,39.913562] 2016-03-28 06:19:24.022 logger.js:37 [log] > level 0 loaded [66,75],duration:20 2016-03-28 06:19:24.022 logger.js:37 [log] > live playlist sliding:21.994 2016-03-28 06:19:24.022 logger.js:37 [log] > Loading 75 of [66 ,75],level 0, currentTime:14,bufferEnd:39.914 2016-03-28 06:19:24.027 logger.js:37 [log] > Demuxing 75 of [66 ,75],level 0 2016-03-28 06:19:24.028 logger.js:37 [log] > parsed video,PTS:[40.024,42.026],DTS:[40.023/42.026],nb:60 2016-03-28 06:19:24.029 logger.js:37 [log] > parsed audio,PTS:[39.978,42.026],DTS:[39.978/41.962],nb:31 2016-03-28 06:19:24.031 logger.js:37 [log] > media buffered : [14,41.961562] 2016-03-28 06:19:26.020 logger.js:37 [log] > level 0 loaded [67,76],duration:20 2016-03-28 06:19:26.021 logger.js:37 [log] > live playlist sliding:23.981 2016-03-28 06:19:26.021 logger.js:37 [log] > Loading 76 of [67 ,76],level 0, currentTime:14,bufferEnd:41.962 2016-03-28 06:19:26.026 logger.js:37 [log] > Demuxing 76 of [67 ,76],level 0 2016-03-28 06:19:26.029 logger.js:37 [log] > parsed video,PTS:[42.026,44.028],DTS:[42.026/44.028],nb:60 2016-03-28 06:19:26.029 logger.js:37 [log] > parsed audio,PTS:[42.026,44.010],DTS:[42.026/43.946],nb:30 2016-03-28 06:19:26.031 logger.js:37 [log] > media buffered : [14,43.945562] 2016-03-28 06:19:28.020 logger.js:37 [log] > level 0 loaded [68,77],duration:20 2016-03-28 06:19:28.020 logger.js:37 [log] > live playlist sliding:25.962 2016-03-28 06:19:28.020 logger.js:37 [log] > Loading 77 of [68 ,77],level 0, currentTime:14,bufferEnd:43.946 2016-03-28 06:19:28.026 logger.js:37 [log] > Demuxing 77 of [68 ,77],level 0 2016-03-28 06:19:28.029 logger.js:37 [log] > parsed video,PTS:[44.028,46.028],DTS:[44.028/46.028],nb:60 2016-03-28 06:19:28.029 logger.js:37 [log] > parsed audio,PTS:[44.010,45.993],DTS:[44.010/45.930],nb:30 2016-03-28 06:19:28.031 logger.js:37 [log] > media buffered : [14,45.929562] 2016-03-28 06:19:30.021 logger.js:37 [log] > level 0 loaded [69,78],duration:20 2016-03-28 06:19:30.021 logger.js:37 [log] > live playlist sliding:28.010 2016-03-28 06:19:32.020 logger.js:37 [log] > level 0 loaded [70,79],duration:20 2016-03-28 06:19:32.020 logger.js:37 [log] > live playlist sliding:29.994 2016-03-28 06:19:34.020 logger.js:37 [log] > level 0 loaded [71,80],duration:20 2016-03-28 06:19:34.021 logger.js:37 [log] > live playlist sliding:31.978 2016-03-28 06:19:36.020 logger.js:37 [log] > level 0 loaded [72,81],duration:20 2016-03-28 06:19:36.021 logger.js:37 [log] > live playlist sliding:33.963 2016-03-28 06:19:38.020 logger.js:37 [log] > level 0 loaded [73,82],duration:20 2016-03-28 06:19:38.020 logger.js:37 [log] > live playlist sliding:36.010

phloxic commented 8 years ago

Yes, neither does it work in Firefox (does not start), nor in native playback in Mac OS Safari (freeze) or QuickTime player for that matter. In my opinion the stream is broken, ffplay sort of manages to play it with additional warnings to the ones mentioned above, skipping 2 segments ahead, expired from playlists. Maybe @mangui has an idea how to rescue the stream, but as it doesn't even play natively, I personally think you'd be better off to sort out the issues with your stream first.

odaru99 commented 8 years ago

Hi, blacktrash,

Thanks your help, I solved the problem. The problem is that there are two adts header before aac data. (one is camera encoded, another one is my TSMux).