android icon indicating copy to clipboard operation
android copied to clipboard

Increase frame rate of generated notification GIFs when using video option

Open Rogue136198 opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe.

Currently when sending a notification to an Android device with the video atribute the framerate of the generated GIF is too low for it to be useful

Describe the solution you'd like

I'd like to see an option to set the FPS of the GIF being generated from the specified MP4 file. I see this as a good option as the default without fps specified can be maintained as to not create a breaking change

Describe alternatives you've considered, if any

I would consider any option that increases the usability of the video option in notifications. Even just increasing the default FPS would be fine by me

Additional context

For clarity I would expect the syntax to look something like this:

service: notify.notify
data:
  message: Message
  title: Title
  data:
    video: /api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
    fps: 30 <-- 

Rogue136198 avatar Jul 02 '22 01:07 Rogue136198

I have been looking through the code and I now (mostly) understand how videos are converted to GIFs for notifications.

As I understand, currently the conversion takes the first frame at 100ms then another frame every 2 seconds until the end of the clip. 2 seconds in between frames seems like a long time when you are trying to identify moving objects.

Would it be agreeable if I were to submit a PR to have this value changed to 0.5 seconds? I'm asking beforehand in the event there is a specific reason this value is set to 2 seconds.

Rogue136198 avatar Jul 03 '22 22:07 Rogue136198

I dont recall the exact reason behind the current frame rate value, I tried to look into past PRs but didnt see a reason why. I think it would be ok to create a PR, you could also keep this as the default and introduce a new parameter so the user can define the amount of frames if they wish to do so. Up to you on how you want to implement it.

dshokouhi avatar Jul 03 '22 23:07 dshokouhi

Proposed resolution with PR #2657 I determined that setting the framerate would not be feasible as it is a careful balancing act of resolution, number of frames and frame rate to stay within the tight limits set for Android notification content.

Rogue136198 avatar Jul 16 '22 01:07 Rogue136198