Suggestions on getting pts_time?
First: thank you so much for this project, it's going to be a huge help for something we're building.
I want to convert the dts to an actual timestamp. My understanding is that this is based on the stream timebase. My further understanding is that this defaults to 90,000 for mpegts, but I'm worried about relying on a default rather than expliclty parsing the timebase for a given stream.
Do you know if TSDecoder might eventually parse that timebase and use it to expose a pts_time?
Well, I am certainly glad this can be useful!
FYI, the current state of the master branch is not entirely functional, as I am very slowly updating the code to modern standards. If you need something that works right away, stick with the code as of https://github.com/gliese1337/HLS.js/commit/48755358b37da656f3c3948a2dc00f02df487540 (Of course, if you've already tested out the current version of TSDecoder and it's working for you, that's good to know! That module should be working in isolation, but I don't have end-to-end tests for it while the rest of the system is in flux,)
Explicitly parsing out the timebase is not a feature I ever anticipated needing. The resolution of the PTS and DTS does indeed default to 90kHz, and I believe that assumption is hardcoded in a few places. As far as I recall, there is no way of altering that, but I'd have to revisit the MPEG specs to see if the frequency can actually be read out of the stream. It definitely is, however, possible to read out the Program Clock Reference, which is also on a 90kHz base clock, but provides 9 bits of additional precision at 27MHz, and that be used to convert PTS and DTS into an absolute timestamp.
I am willing to look into that, time permitting, but I'm not actually getting paid for this anymore, so it might be a while. If you need the feature urgently, I am happy to accept pull requests,
Totally understood! We don't have an immediate need and if we do, I will happily open a PR.
And yes: TSDecoder seems to be working very well in isolation.