GithubHelp home page GithubHelp logo

Comments (12)

mjneil avatar mjneil commented on June 18, 2024

Hi @joeyparrish

No there currently isn't a way to configure it to not change the timestamps so that would consitute an enhancement. However, If I follow correctly, you may be able to work around it with the cuirrent build of mux.js.

Is the problem that say you have a segment with timestamp 100, which you parse out and use to set SourceBuffer.timestampOffset, but the mp4 output has a timestamp of 0, which causes it to be incorrectly placed on the timeline when appending to the buffer?

If this is the case, then I think you might be able to use Transmuxer.setBaseMediaDecodeTime which is used to shift the timestamp of the output mp4 so that setting SourceBuffer.timestampOffset is not needed

from mux.js.

joeyparrish avatar joeyparrish commented on June 18, 2024

You are close. We don't set the timestampOffset for live streams. We build a segment index (for seeking) that allows us to locate a segment by its timestamp. From that, we also build our model of what timestamps are viewable/bufferable.

The trouble is that Transmuxer causes what is actually buffered to have different timestamps than what we have in our index. We don't want our index-building and manifest-parsing logic to have to know about transmuxing, and on some platforms with native TS (Edge, for example), we won't be using Transmuxer at all.

But it sounds like Transmuxer.setBaseMediaDecodeTime may help. I'll check it out and let you know how it turns out. Thanks!

from mux.js.

mjneil avatar mjneil commented on June 18, 2024

Another thing that might be helpful is listening to gopInfo on the transmuxer

transmuxer.on('gopInfo', (info) => {
  // info is an array of objects of the form { pts, dts, byteLength } representing each GOP in the segment
});

The output mp4 will still have the shifted timestamps, but the values emitted by this event are the values before the time shift.

Another note: I'm unsure if you have come across this already or not, but mux.js also accounts for the 33bit timestamp rollover. If you are not account for that on your end, you might see a difference in the input timestamp and the output timestamp as well

from mux.js.

joeyparrish avatar joeyparrish commented on June 18, 2024

Roll-over shouldn't be an issue. We only look at the timestamp of the first segment in the playlist. After that, so long as we update the playlist frequently enough that there are some segments we recognize in the updated version, we will be computing the timestamps of new segments based on the timestamps of old segments, without parsing the segments themselves.

from mux.js.

joeyparrish avatar joeyparrish commented on June 18, 2024

For some reason, setBaseMediaDecodeTime doesn't seem to affect timestamps in the output. I'll try to put together a simple case to reproduce it.

from mux.js.

joeyparrish avatar joeyparrish commented on June 18, 2024

I must be doing something wrong. When I put together a simple test page, it's working correctly.

from mux.js.

joeyparrish avatar joeyparrish commented on June 18, 2024

I was setting the time in seconds, not timescale units. Whoops! Everything is working now.

@mjneil, would you be open to an option for this behavior so we don't have to manage the base time ourselves?

from mux.js.

mjneil avatar mjneil commented on June 18, 2024

I'm glad you got that working for you!

And yea, I think an initialization option to not change the timestamps would be a good option to add. If you want to put together a PR for it I'd be happy to review and help get that merged.

from mux.js.

joeyparrish avatar joeyparrish commented on June 18, 2024

Thank you so much for helping us with this. What is your release schedule like? We are, of course, eager to adopt 4.3.3 with the new option.

from mux.js.

mjneil avatar mjneil commented on June 18, 2024

Of course, thanks for helping get the contribution in. I was going to make a release now, but it looks like our TravisCI Master branch build is unable to run due to some issues Travis is having, so I will probably make a release tomorrow after thats all been resolved. This will also be versioned to 4.4.0 since this is a new backwards compatible feature.

from mux.js.

mjneil avatar mjneil commented on June 18, 2024

4.4.0 has been released

from mux.js.

joeyparrish avatar joeyparrish commented on June 18, 2024

Thanks!

from mux.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.