About LIVE streaming and MPEG .TS files

Sorry if my question lacks of technical skills but something about the live system makes me wonder why since RTMP(S) streaming which is in H264/AAC is converted in MPEG2 .TS, then again in HLS mp4 segments for replay?

why not to convert the RTMP live stream in WebRTC/RTSP or WSS and connect from the client directly with this transports?
this project can be an example of how they convert RTMP to webrtc/websocket

I recently installed peertube on my server and the client cannot follow the .TS livestream even on a 100Mb internet line I really don’t know why… it can come from my server which has HD and not SSD or else.

Also why not to convert directly the RTMP stream direclty in HLS for the replay with a script like this one https://github.com/Hemisphere-Project/HLS-segmenter
or maybe it’s already done with ffmpeg isn’t it?

thanks for your answer


We chose to use a web standard to broadcast live streams which is HLS. The project you linked don’t use WebRTC, and you seem to confuse WebRTC and WSS. WSS is just HTTP so there aren’t a lot of difference with HLS.

The second project you linked if very complex, and not a NodeJS library. You should not have issues to play any HLS stream with your connection. If the live buffers then create an issue with appropriate logs.

I don’t really mix the protocols @Chocobozzz but maybe I didn’t express myself very well or I misunderstood some of logics.

  • Are the xxx.ts files mpeg2-ts or HLS encoded in H264 with a special .ts extension?

  • Is it possible to reduce the latency as a live with 30 and more sec latency is hard to be used with the live chat and if yes where can I optimize it?

  • I’m trying to understand your code where I can modify the path of the live xx.ts chunks to have a static root one as a RAMFS to light weight the HD since many live streams running is dramatically slowing down the performance of all other processes but didn’t find where to hack it…

  • About the buffer lag, where can I modify the code to test various server side or client side buffer?

thanks for your answer

would you like I create an issue at github?
I just retried a live now and it’s the same,
buffer stalled at each .TS chunks

7195.78094d2ae03871a3.js:1 HLS.js error: mediaError - fatal: false - bufferStalledError

  1. {type: ‹ mediaError ›, details: ‹ bufferStalledError ›, fatal: false, buffer: 0.058999000000000024}

  2. buffer: 0.058999000000000024

  3. details: « bufferStalledError »

  4. fatal: false

  5. type: « mediaError »

  6. [[Prototype]]: Object