Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add edit box support to offset PTS #553

Closed
wants to merge 1 commit into from

Conversation

drichards
Copy link

Made an initial stab at of the edit box changes discussed in #9, however it doesn't seem to make much difference to stream startup in safari, so possibly I'm doing something wrong.

Thoughts I have about this:

@mangui
Copy link
Member

mangui commented Jul 8, 2016

Hi @drichards tks for this PR

refer to the spec, u need 4 bytes for segment duration and 4 bytes for media time

aligned(8) class EditListBox extends FullBox(‘elst’, version, 0) {
 unsigned int(32) entry_count;
 for (i=1; i <= entry_count; i++) {
 if (version==1) {
 unsigned int(64) segment_duration;
 int(64) media_time;
 } else { // version==0
 unsigned int(32) segment_duration;
 int(32) media_time;
 }
 int(16) media_rate_integer;
 int(16) media_rate_fraction = 0;
 }
} 

i did some preliminary tests some months ago on a local branch, with hardcoded offset for the audio track ... just to give it a try (before computing the offset as u did in mp4-remuxer) and using i could avoid glitches with Safari.
image

@kanongil
Copy link
Contributor

kanongil commented Jul 8, 2016

@drichards I'm pretty sure you are doing it wrong. As far as I can tell, the duration should be 0, and the media time is the configurable part (which you set to -1 / 0xffffffff for some reason).

@drichards
Copy link
Author

Reading through the spec here http://l.web.umkc.edu/lizhu/teaching/2016sp.video-communication/ref/mp4.pdf

Starting offsets for tracks (streams) are represented by an initial empty edit. For example, to play a track from
its start for 30 seconds, but at 10 seconds into the presentation, we have the following edit list:
Entry-count = 2
Segment-duration = 10 seconds
Media-Time = -1
Media-Rate = 1
Segment-duration = 30 seconds (could be the length of the whole track)
Media-Time = 0 seconds
Media-Rate = 1

That seems to say that an offset should be specified by a duration (first 4 bytes after the number of entries bytes) with a media-time of -1 (next 4 bytes). In #9 @jernoble also discussed "empty edits" which are specified using a media-time of -1.

I tried changing the offset to be in the media-time field and set the segment duration to 0. That seems to have avoided the stuttering poster image but doesn't fix the problem for two reasons

  • the video still doesn't play most of the time
  • it cuts off the first several frames of the video

The second of those indicates to me that potentially the calculation for the offset is being done wrong, but it still doesn't seem to agree with how the spec presents edit box offsets.

@mangui
Copy link
Member

mangui commented Jul 11, 2016

Hi @drichards , I slightly adjusted your logic on elst branch
main thing was to take into account track timescale.
you can check it here: http://streambox.fr/mse/hls.js-elst/demo, behaviour with Safari is much better
feedback welcome

@drichards
Copy link
Author

Looks good to me. Looks like there's a couple of console.logs in there that I imagine you'd want to clean up/replace with logger.log

@drichards
Copy link
Author

One more on line 513 of mp4-generator

@drichards
Copy link
Author

Looking at that demo branch it looks like Safari is also tacking on a range header to the ts file requests, which is forcing a preflight CORs request. Presumably unrelated to this, but it doesn't appear to happen on the 0.6.2-1 demo page

screen shot 2016-07-11 at 12 02 19 pm

@mangui
Copy link
Member

mangui commented Jul 11, 2016

ok I am suspecting it might be related to https://github.com/dailymotion/hls.js/pull/559

mangui added a commit that referenced this pull request Jul 11, 2016
unbloat frag object
fix useless preflight CORS request
related to #553
related to #559
mangui added a commit that referenced this pull request Jul 11, 2016
unbloat frag object
fix useless preflight CORS request
related to #553
related to #559
@mangui
Copy link
Member

mangui commented Jul 11, 2016

should be fixed now
http://streambox.fr/mse/hls.js-elst/demo/

@phloxic
Copy link
Contributor

phloxic commented Jul 11, 2016

Only the buck bunny video plays for me, the others load, but I can't convince the player to start - and with 'pipe dream' safari freezes and/or becomes unresponsive (beach ball etc.)
This one works, but only after quite a few bufferSeekOverHole's at the beginning.

@mangui
Copy link
Member

mangui commented Jul 11, 2016

Yes ... one step further... but how many steps left ? :-/

@phloxic
Copy link
Contributor

phloxic commented Jul 12, 2016

@mangui - considering that this is a blindfolded reverse-engineering/guessing process with an extremely loose (TS) spec it's good progress ;-)

@johnBartos
Copy link
Collaborator

Closing this due to lack of activity

@johnBartos johnBartos closed this Apr 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants