Comments (12)
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.
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.
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.
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.
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.
I must be doing something wrong. When I put together a simple test page, it's working correctly.
from mux.js.
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.
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.
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.
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.
4.4.0 has been released
from mux.js.
Thanks!
from mux.js.
Related Issues (20)
- General Question: Can this script playback on Chrome Browser a Quicktime (MOV) Video? HOT 2
- MSE live stream. sourceEnded/ half video green.
- Sample code: It does not work. HOT 4
- any way to pipe mp2t URL stream to this lib?
- Could not find a declaration file for module 'mux.js' HOT 3
- Priority to a normal audio, skip visual_impaired audio track unless was only audio (HLS ts segment with video_audio tracks) HOT 1
- The traf box seems to include the sdtp box. valid?
- Parted TS fragments don't handled correctly
- ID3 "cueTime" Out of Sync for Live HLS Audio Streams (Video is Okay)
- mkv clusters to fmp4
- Merge multiple ts videos into one mp4 file HOT 5
- Actually mux video and audio fmp4s HOT 1
- Are there plans to support HEVC codec in the transmuxer? HOT 2
- Are there plans to support MP3 in the transmuxer?
- How to mux an mp4 out of existing VideoFrames from WebCodecs HOT 2
- How to implement with videojs
- function parsePat section_number, last_section_number offset wrong in lib/m2ts/m2ts.js
- Fix to generate valid .mp4 from ADTS stream
- parse data from mkv
- muxjs.mp4.tools.setStartTime is not a function, version 6.3.0
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 mux.js.