Comments (23)
Is it possible to get PTS from the underlying stream through the API?
from hls.js.
@nireshkumar regarding https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HTTP_Live_Streaming_Metadata_Spec/HTTP_Live_Streaming_Metadata_Spec.pdf, extracting ID3 PES is not a big deal. they could eventually be parsed and returned along with their PTS through a specific event.
currently we have FRAG_PARSING_DATA
that handles Audio/Video,
we could add a FRAG_PARSING_METADATA
event, that would return an array of ID3 PES, along with their PTS
from hls.js.
then it would be up to your application to listen to this event and handle those metadatas (parse, and display them )
from hls.js.
@mangui is the PTS available on a frame-by-frame basis (for video) even if there no ID3 metadata? For example, is it possible to implement a video.currentTimePTS() call or similar?
from hls.js.
PTS reported by hls.js events are always relative to start position, and expressed in ms.
basically you will always have video.currentPTS = 1000*video.currentTime
so that it will be straightforward to sync metadata and video.
from hls.js.
Is it possible to obtain the PTS from the decoding (the PTS written by the encoder, for example)?
from hls.js.
the real PTS is parsed, but not exposed. just curious, why would you need it ?
from hls.js.
One of our use cases involves tagging live-DVR streams. Relative PTS has no meaning in this scenario, however, typically the CDN will cycle the encoding PTS every 24 hours so we'd like to experiment using the frame PTS plus date data to get frame accurate tagging.
from hls.js.
I see, indeed it make sense in that case.
anyway the values are there, it is just a matter of exposing them.
from hls.js.
Can you advise on how this might be accomplished? I'd like to give it a go.
from hls.js.
@dstieglitz, please find guidelines below :
- retrieve ID3 PID from PMT ( stream type : 0x15) : add a case 0x15 here https://github.com/dailymotion/hls.js/blob/master/src/demux/tsdemuxer.js#L179
- parse/retrieve ID3 PES packet : add a else if(pid === id3id) and do similar processing than for audio or video (refer to https://github.com/dailymotion/hls.js/blob/master/src/demux/tsdemuxer.js#L88-L99 for audio processing)
- add a new method this._parseID3PES() that will just push the parsed PES in an array. pes.pts is the absolute PTS value.
- add a new method flushID3Samples() that should be called from end() : https://github.com/dailymotion/hls.js/blob/master/src/demux/tsdemuxer.js#L126-L141
- in this method, fire a new event FRAG_PARSING_METADATA, which data should contain your array of ID3 packets
- add some logic in demuxer.js and tsdemuxerworker.js so that this event could work with and without webworker
from hls.js.
also, if you just want to expose absolute PTS, you need to play with
this._initPTS
and this._initDTS
https://github.com/dailymotion/hls.js/blob/master/src/demux/tsdemuxer.js#L824-L828
from hls.js.
@mangui thanks!
from hls.js.
@mangui Thanks for the reply. Guidelines for implementation looks great.
from hls.js.
Is there a test manifest for a live-dvr playlist?
from hls.js.
http://dailymotion.github.io/hls.js/demo/?src=http%3A%2F%2Fonline.video.rbc.ru%2Fonline%2Frbctv.m3u8
on Chrome with https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi
from hls.js.
@mangui, Our live encoder inject ID3 tags into stream every second. We used to listen to flashls's ‘HLSEvent.ID3_UPDATED’ event and consume ID3 tag data, its working fine. When I added 'case 0x15' here https://github.com/dailymotion/hls.js/blob/master/src/demux/tsdemuxer.js#L179 and played the same stream, ID3 tag id detected only once at the beginning stream or on bitrate switch. Am I missing something ? is it possible replicate the same behaviour as in flashhls in hls.js as well?
from hls.js.
ID3 tags should be parsed and dispatched through an event; but it is not hls.js responsability to dispatch individual event at the right timings. it is up to the application to do it.
the difference is that flash allows to inject custom metadata in the NetStream. NetStream will trigger an event with each individual tag at the right timings. but MediaSource does not support this.
from hls.js.
Got it. Thanks
Any pointers on how I can extract injected ID3 Tags ?
from hls.js.
for tags extraction from tsdemuxer, plz refer to my yesterday's comment.
for id3 tag parsing, i guess there should be JS libs available around.
from hls.js.
@mangui I followed the implementation guidelines and its working. As well added FRAG_INIT_SEGMENT_TS_CHANGED event which fires when _initPTS and _initDTS gets set, this exposes absolute PTS.
Here is the change set link : nireshkumar@d8617bc
I would be glad to raise a PR if you want to add metadata parsing feature. Let me know if I need to make more changes to make it PR ready.
from hls.js.
@nireshkumar nice !
regarding absolute timestamps, do you need them only for ID3 ?
you should already have absolute PTS/DTS in your ID3 PES packets, dispatched by FRAG_PARSING_METADATA
I would suggest to:
either convert all timestamps to relative ones, and add initPTS/initDTS in FRAG_PARSING_INIT_SEGMENT
, no need to create a new event
from hls.js.
Hey, could you give me a call to discuss syncing multiple HLS streams together ? 805.499.1994
from hls.js.
Related Issues (20)
- SSR broken in HLS 1.4.12 and Next 13 HOT 4
- gg
- How can I show word by word captions/subtitles? HOT 2
- link can play in HLS extension, but can not work with hls.js HOT 3
- Decode video Using WebCodecs API
- Issue with HLS.js PIPELINE_ERROR_DECODE and MEDIA_ELEMENT_ERROR HOT 3
- DRM Video decoding failed HOT 1
- ipone Xr and iPonh 12 mini issues HOT 2
- Can I play videos of the hlsll protocol? HOT 1
- Improving initial video quality based on previous sessions HOT 4
- Long 608 Captions are are not displayed properly, and sometimes not at all. HOT 3
- Can i swap SSD writing of files with writing to memory? HOT 1
- Can hls.js play HLS streams from Amazon IVS and Tencent live streams? HOT 1
- Issue where CMAF DRM videos cannot be played HOT 1
- "Discontinuity sliding from playlist, take drift into account" log meaning HOT 6
- The EWMA algorithm used to estimate the current bandwidth used for the abr controller seems to be wrong HOT 2
- Can I play HLS stream with auto removing segments? HOT 3
- Subtitle cues appearing 1.5s earlier than indicated in the VTT file HOT 3
- Apple AirPlay only plays Audio in Safari on iPadOS HOT 3
- Don't change text track mode back to `showing` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hls.js.