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

DIFFERENCE IN FRAME #6490

Open
5 tasks done
ravinair24 opened this issue Jun 11, 2024 · 3 comments
Open
5 tasks done

DIFFERENCE IN FRAME #6490

ravinair24 opened this issue Jun 11, 2024 · 3 comments
Labels
Revisit-at-later-release-cycle Will revisit during release cycle indicated by the Milestone

Comments

@ravinair24
Copy link

What version of Hls.js are you using?

1.4.0

What browser (including version) are you using?

Chrome

What OS (including version) are you using?

Linux

Test stream

https://streams.abs.tv:8443/videos/82/Videos/RTV_PRG_Whickers_World_S03E06.mp4/chunk.m3u8

Configuration

{autoStartLoad: true,
startPosition : -1,
debug: true,
maxBufferLength: 30,
maxMaxBufferLength: 90,
maxBufferSize: 60*1000*1000,
maxBufferHole: 0,}

Additional player setup steps

No response

Checklist

Steps to reproduce

  1. An additional 2-3 frames get automatically added at the beginning of video which necessarily means that the video Timecodes with seek is off by 2-3 frames

Expected behaviour

should not add additional frames in the beginning or the end

What actually happened?

An additional 2-3 frames get automatically added at the beginning of video which necessarily means that the video Timecodes with seek is off by 2-3 frames

Console output

[log] > [stream-controller]: Media seeked to 0.080
hls.js?r=11062024111906:8752 [log] > [stream-controller]: media seeking to 0.040, state: IDLE
hls.js?r=11062024111906:8752 [log] > [audio-stream-controller]: media seeking to 0.040, state: STOPPED
hls.js?r=11062024111906:8752 [log] > [subtitle-stream-controller]: media seeking to 0.040, state: IDLE
2VM1755:2515 Uncaught

Chrome media internals output

No response

@ravinair24 ravinair24 added Bug Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Jun 11, 2024
@robwalch
Copy link
Collaborator

robwalch commented Jun 13, 2024

HLS.js appends audio and video in MSE SourceBuffers based on the sample timestamps found in the media. Appended media is decoded and rendered by the browser according to its mapping of decode and presentation timestamps (DTS/PTS) to HTMLMediaElement currentTime. Some common causes for video frames not aligning with the original source are:

  1. Audio priming delay: AAC encoding adds samples to the start that cannot be clipped in TS or MSE which offsets video
  2. Composition time (CTS: the difference between PTS and DTS) applied to DTS/PTS on HTMLMediaElement time. Most MSE implementations add CTS the position of appended segments.

@robwalch robwalch removed the Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. label Jun 13, 2024
@robwalch
Copy link
Collaborator

robwalch commented Jun 13, 2024

Probing your first segment shows that audio starts 0.12s before video:

ffprobe -v error -hide_banner -select_streams v -show_frames -i 'https://streams.abs.tv:8443/videos/82/Videos/RTV_PRG_Whickers_World_S03E06.mp4/n_0_0_0.ts'

[FRAME]
media_type=audio
stream_index=1
key_frame=1
pts=0
pts_time=0.000000
pkt_dts=0

[FRAME]
media_type=video
stream_index=0
key_frame=1
pts=10800
pts_time=0.120000
pkt_dts=3600
pkt_dts_time=0.040000

@ravinair24
Copy link
Author

ravinair24 commented Jun 14, 2024 via email

@robwalch robwalch added the Revisit-at-later-release-cycle Will revisit during release cycle indicated by the Milestone label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Revisit-at-later-release-cycle Will revisit during release cycle indicated by the Milestone
Projects
None yet
Development

No branches or pull requests

2 participants