VIDA-NYU / tim-dashboard

TIM Dashboard
Apache License 2.0
0 stars 0 forks source link

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

Open soniacq opened 2 years ago

soniacq commented 2 years ago

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 commented 2 years ago

Linking this issue

https://github.com/VIDA-NYU/ptg-api-server/issues/5

beasteers commented 2 years ago

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