Skip to content

Conversation

matvey00z
Copy link
Contributor

@matvey00z matvey00z commented Sep 11, 2025

Hi,

I added a time lapse creation mechanism. Actually just a part of it for now, as there is no support from UI yet.

  1. Add timelapse section to storage config: can set tiers and a frame extracting interval per tier.
  2. Add a hook on each segment copying. Before copying a segment, one keyframe gets extracted from it and stored to a timelapse first tier.
  3. Add a new Timelapse Handler, which checks whether there already exists a file (frame) created within specified interval from a new file, and deletes this new file if yes, keeps otherwise.

Did not really check if it works with an m4box thing, did not find where it is used.

An example config I am running with it:

storage:
  recorder:
    tiers:
      - path: /tier1
        continuous:
          max_size:
            gb: 10
          max_age:
            days: 1
        events:
          max_size:
            gb: 1
          max_age:
            days: 1

  timelapse:
    tiers:
      - path: /tier1
        max_size:
          gb: 100
        max_age:
          days: 1
        interval:
          minutes: 1 # keep at most one frame per minute
      - path: /tier2
        max_size:
          gb: 100
        max_age:
          days: 3650
        interval:
          hours: 1 # keep at most one frame per hour

A timelapse video then can be created for example with ffmpeg -framerate 25 -pattern_type glob -i "tier1/timelapse/camera_1/*.jpg" -c:v libx264 -r 25 -pix_fmt yuv420p /tmp/lapse.mp4

Copy link

netlify bot commented Sep 11, 2025

Deploy Preview for viseron ready!

Name Link
🔨 Latest commit 3070606
🔍 Latest deploy log https://app.netlify.com/projects/viseron/deploys/68c417ff3edb480008cee241
😎 Deploy Preview https://deploy-preview-1104--viseron.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@roflcoopter
Copy link
Owner

Thank you! This has been on my to do list for quite some time but never got around to it.
I like the approach of extracting it from the segment 👍

The mp4box part is used by the GStreamer component, as that cant spit out HLS segmetns directly like FFmpeg can.

CI is failing on some minor things tho, flake8 and pytest should be pretty straightforward.
To regenerate the docs you can run the script scripts.gen_docs.py: https://viseron.netlify.app/docs/developers/documentation#component-documentation.

Thank you again and let me know if you need any assistance to get the CI to pass

@matvey00z
Copy link
Contributor Author

Thank you

Thank you!
image

@roflcoopter
Copy link
Owner

Need to update the docs as well but i will do that in a follow up PR 👍

@roflcoopter roflcoopter self-requested a review September 15, 2025 05:50
@roflcoopter roflcoopter merged commit 37ce8bc into roflcoopter:dev Sep 15, 2025
18 checks passed
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.

2 participants