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

Accurate timestamping for RMS (FT files) #496

Open
wants to merge 9 commits into
base: prerelease
Choose a base branch
from

Conversation

MaadhyamRana
Copy link
Contributor

@MaadhyamRana MaadhyamRana commented Jan 8, 2025

Since the last update that changed the way raw video segments are named and stored, here are the changes this PR makes towards accurate timestamping of these segments:

  1. An empty array is initialized to store the pts at the initialization of BufferedCapture.

  2. Every call to read() will append a new pts to the array.

  3. Gstreamer callback moveSegment is called when a clip is ready. The segment is stored in the hierarchy under VideoFiles, while the pts array is flushed to a corresponding FT file under config.data_dir/TimeFiles (configureable), which follows a similar directory structure as the videos (Year/Day-of-Year/Hour/)

  4. The timestamp array in memory is immediately cleared to store the next segment's pts.

In addition, each FT file and corresponding video segment are now named after their first timestamp, and not using current time (RmsDateTime.utcnow).

@MaadhyamRana MaadhyamRana marked this pull request as draft January 8, 2025 00:20
@MaadhyamRana MaadhyamRana marked this pull request as ready for review January 8, 2025 01:32
@MaadhyamRana MaadhyamRana changed the title Accurate timestamping for RMS mkv video segments Accurate timestamping for RMS (FT files) Jan 11, 2025
@MaadhyamRana
Copy link
Contributor Author

MaadhyamRana commented Jan 11, 2025

Since the last update:

  • FT files are now produced by default under TimeFiles subdirectories, not just when config.raw_video_save is set on.
  • config.times_days_to_keep is set to 8 by default, indicating to keep 8 days worth of TimeFiles data when set.
  • Instead of appending timestamps to buffer during every call to read, new timestamps are only appended for successful read() calls, and not when the program is trying to reconnect to the camera.
  • FT file is saved from buffer at the end of every 256-frame block captured.
  • New video segments are now named when the previous segment is ready to be saved. This is tracked by BufferedCapture's self.last_segment_savetime

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.

1 participant