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

Audio and video track are NOT EXACTLY the same length #2

Open
soniacq opened this issue Jul 25, 2022 · 2 comments
Open

Audio and video track are NOT EXACTLY the same length #2

soniacq opened this issue Jul 25, 2022 · 2 comments

Comments

@soniacq
Copy link
Contributor

soniacq commented Jul 25, 2022

Looks at the coffee-test-2, as an example. The audio length is 7:19 min. However, the video length is 7:20 min

@beasteers
Copy link
Collaborator

Linking this issue

VIDA-NYU/ptg-api-server#5

@beasteers
Copy link
Collaborator

Just wanted to update on this issue. The way that this can be fixed is:

// how to convert timestamp to millisecond epoch
const timestamp2ms = t => parseInt(t.split('-'))

// get the timestamps for the main camera and another stream
// using the main camera as the time reference for the progress bar
const mainStartTime = timestamp2ms(recordingData.streams.main['first-entry-id'])
const gllStartTime = timestamp2ms(recordingData.streams.gll['first-entry-id'])

// then when you want the exact gll time,
// you can calculate the exact time offset like this and add it to the time in seconds
const gllCurrentTime = Math.max(0, mainCurrentTime + (mainStartTime - gllStartTime) / 1000)

If you have the progress bar feed the absolute timestamp (add mainStartTime to the current time in seconds) and then provide each video player with their stream's start time, then you can just do the math when seeking

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

No branches or pull requests

2 participants