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

sensor-logging: Fix subtitles to show data on the beggining and end of the video #1666

Conversation

rafaellehmkuhl
Copy link
Member

Attached zip contains the result of this patch.
subtitles-test.zip

Fix #815.

Copy link
Contributor

@ES-Alexander ES-Alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated files seem to make sense, but I'm having some issues with the playback lining up to have subtitles at the end of the files. Not sure if that's just VLC struggling to keep the correct timing with the matroska files, or if the fake source allowing strange framerates is contributing - potentially something to keep an eye on for later.

Some minor suggestions on the code comments:

Comment on lines 430 to 431
// Consider logs that start a little before the initial time and end a little after the final time, so we don't
// miss data on the start and end of the file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Consider logs that start a little before the initial time and end a little after the final time, so we don't
// miss data on the start and end of the file.
// Consider logs that start a little before the initial time and end a little after the final time,
// so we don't miss data at the start or end of the recording.

Comment on lines 437 to 438
// Generate a object with the initial and final epoch of each log point
// To know the initial epoch, check the name of the key. To know the final epoch, check the epoch of the next point.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Generate a object with the initial and final epoch of each log point
// To know the initial epoch, check the name of the key. To know the final epoch, check the epoch of the next point.
// Generate an object with the initial and final epoch of each log point
// The initial epoch is the name of the key, and the final epoch can be determined from the next point.

...{ seconds: differenceInSeconds(new Date(logPoint.epoch), initialTime) },
}))
const finalLog = sortedLogPoints.map((logPoint) => {
const seconds = Math.max(0, differenceInSeconds(new Date(logPoint.epoch), initialTime))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should probably be a comment here explaining that the max clips the first point to the start of the log - took me a while to confirm the logic.

@rafaellehmkuhl
Copy link
Member Author

Some minor suggestions on the code comments:

Adding the comments before merging.

@rafaellehmkuhl rafaellehmkuhl force-pushed the fix-subtitles-video-start-and-end branch from 777f5c3 to 02d44cc Compare February 6, 2025 18:19
@rafaellehmkuhl rafaellehmkuhl merged commit 633cb59 into bluerobotics:master Feb 6, 2025
11 checks passed
@rafaellehmkuhl rafaellehmkuhl deleted the fix-subtitles-video-start-and-end branch February 6, 2025 18:40
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.

[Video Recording] Events are not starting on the first video frame
3 participants