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

Failing to stream live HLS w/ TS & transmuxing #1102

Closed
avelad opened this issue Nov 2, 2017 · 6 comments
Closed

Failing to stream live HLS w/ TS & transmuxing #1102

avelad opened this issue Nov 2, 2017 · 6 comments
Assignees
Labels
component: HLS The issue involves Apple's HLS manifest format status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@avelad
Copy link
Collaborator

avelad commented Nov 2, 2017

Raised in #740 (comment)

We parse the TS segments to get their timestamps, since HLS doesn't provide that information. However, as far as I can tell, the MP4 output from mux.js has different timestamps than what we parsed from the TS segments. So the MediaSource timeline doesn't line up with the Player's seek range.

@joeyparrish
Copy link
Member

@joeyparrish joeyparrish self-assigned this Nov 2, 2017
@joeyparrish joeyparrish added type: enhancement New feature or request component: HLS The issue involves Apple's HLS manifest format type: bug Something isn't working correctly and removed type: enhancement New feature or request labels Nov 2, 2017
@joeyparrish joeyparrish changed the title The MP4 output from mux.js has different timestamps than Shaka Player parsed from the TS Failing to stream live HLS w/ TS & transmuxing Nov 2, 2017
@joeyparrish
Copy link
Member

With some local hacks to adjust MediaSource SourceBuffer offsets to compensate for the bad output from mux.js, I can play the above stream. I need to raise the issue with mux.js to see if there is a way we should be configuring it to give us unmodified timestamps.

@joeyparrish joeyparrish added type: external An issue with an external dependency; not our issue; sometimes kept open for tracking and removed type: bug Something isn't working correctly labels Nov 2, 2017
@joeyparrish
Copy link
Member

Filed videojs/mux.js#168 to get support from mux.js.

@joeyparrish joeyparrish added type: bug Something isn't working correctly and removed type: external An issue with an external dependency; not our issue; sometimes kept open for tracking labels Nov 3, 2017
@joeyparrish joeyparrish added this to the v2.3.0 milestone Nov 3, 2017
@joeyparrish
Copy link
Member

We have a work-around now. I'm asking mux.js folks for a configuration for this to make it a little easier, but we can move forward in the mean time.

@thedracle
Copy link

So- I am seeing this issue where the timestamps output by muxjs are different than my TS segments when the presentationTimeOffset isn't 0.

Basically my first MPEGTS segment starts at 133500:

        {
            "media_type": "video",
            "stream_index": 0,
            "key_frame": 1,
            "pkt_pts": 133500,
            "pkt_pts_time": "1.483333",
            "pkt_dts": 133500,
            "pkt_dts_time": "1.483333",
            "best_effort_timestamp": 133500,
            "best_effort_timestamp_time": "1.483333",
            "pkt_duration": 3750,
            "pkt_duration_time": "0.041667",
            "pkt_pos": "564",
            "pkt_size": "10638",
            "width": 320,
            "height": 240,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "1:1",
            "pict_type": "I",
            "coded_picture_number": 0,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0
        }

In the logs I see:

First segment 750k.ts starts at 1.4833333333333334

Which matches the first PTS (Although there is an earlier PTS for the first audio packet in the stream which appears later).

The presentationTimeOffset is set to 1.4833333333333334, but the code to adjust the PTS via the transmuxer sets it to adjust by 0:

lib/media/transmuxer.js:

this.muxTransmuxer_.setBaseMediaDecodeTime(startTime * timescale);

^ Tracing in the debugger 'startTime' is 0.

As a result the transmuxed mp4 seems to adjust all of the timestamps:

        {
            "media_type": "video",
            "stream_index": 0,
            "key_frame": 1,
            "pkt_pts": 7500,
            "pkt_pts_time": "0.083333",
            "pkt_dts": 7500,
            "pkt_dts_time": "0.083333",
            "best_effort_timestamp": 7500,
            "best_effort_timestamp_time": "0.083333",
            "pkt_pos": "2877",
            "pkt_size": "28480",
            "width": 640,
            "height": 480,
            "pix_fmt": "yuv420p",
            "sample_aspect_ratio": "1:1",
            "pict_type": "I",
            "coded_picture_number": 0,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0
        },

And MediaSourceExtensions croaks with the following error:

video frame with PTS 141667us has negative DTS -66667us after applying timestampOffset, handling any discontinuity, and filtering against append window

Also, I wonder if getStartTimeFromTsSegment_ in lib/hls/hls_parser.js needs to be adjusted to search for a minimum timestamp closer to the beginning of the TS stream, rather than just reading the PTS out of the first TS packet it finds that has one.

@TheModMaker
Copy link
Contributor

Please post a new issue for this.

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: HLS The issue involves Apple's HLS manifest format status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

5 participants