Thumbnail offset hardcoded weirdly? #2396

Open
opened 2026-02-28 01:11:05 -05:00 by deekerman · 4 comments
Owner

Originally created by @suvis1 on GitHub (May 19, 2023).

Hi!

Ive been having issues that Motioneye generates thumbnails that are not representative of the actual detection event. I checked the code and found out theres a a minimum offset, and also a weirdly doubled offset for precapture?

For example if i have a camera with framerate of 10, and precapture of 40 frames before a detection, we end up with the thumbnail being generated 8 seconds from the video, eventhough the detection is after the 40 precapture frames, meaning the thumbnails 4 seconds late.

I managed to get alot better thumbnails when i changed the offs value to just be offs +=1 so the thumbnails are taken 1 second after detection.

This seems to be done deliberately so maybe im missing the point of this? is there any reason for it to do this?

github.com/motioneye-project/motioneye@03882a1899/motioneye/mediafiles.py (L349-L363)

Originally created by @suvis1 on GitHub (May 19, 2023). Hi! Ive been having issues that Motioneye generates thumbnails that are not representative of the actual detection event. I checked the code and found out theres a a minimum offset, and also a weirdly doubled offset for precapture? For example if i have a camera with framerate of 10, and precapture of 40 frames before a detection, we end up with the thumbnail being generated 8 seconds from the video, eventhough the detection is after the 40 precapture frames, meaning the thumbnails 4 seconds late. I managed to get alot better thumbnails when i changed the offs value to just be offs +=1 so the thumbnails are taken 1 second after detection. This seems to be done deliberately so maybe im missing the point of this? is there any reason for it to do this? https://github.com/motioneye-project/motioneye/blob/03882a18994fc35c22ae169dd1569abb923c7cef/motioneye/mediafiles.py#L349-L363
Author
Owner

@MichaIng commented on GitHub (May 21, 2023):

Many thanks for your report. Good find, I have no idea where this 4 seconds minimum + doubled offset is coming from. It was last touched here, before which it was 4 seconds maximum offset: github.com/motioneye-project/motioneye@b14bbb5

@ccrisan do you know what this is for? Generally I'd just remove any min/max and the * 2 to just use the user setting as is.

@MichaIng commented on GitHub (May 21, 2023): Many thanks for your report. Good find, I have no idea where this 4 seconds minimum + doubled offset is coming from. It was last touched here, before which it was 4 seconds maximum offset: https://github.com/motioneye-project/motioneye/commit/b14bbb5 @ccrisan do you know what this is for? Generally I'd just remove any min/max and the `* 2` to just use the user setting as is.
Author
Owner

@ccrisan commented on GitHub (May 22, 2023):

I think it was kind of empirical at that moment. But yeah, using the user setting as is would probably be the best idea here.

@ccrisan commented on GitHub (May 22, 2023): I think it was kind of empirical at that moment. But yeah, using the user setting as is would probably be the best idea here.
Author
Owner

@suvis1 commented on GitHub (May 22, 2023):

I feel like some delay is still warranted, since for example a thumbnail taken from the moment of detection only shows a very small part of a detection like this:

image
I blurred it for privacy, but you can still see that only the head of the person is in the thumbnail on the driveway, adding 1 second more generally gives a lot better results!

image

@suvis1 commented on GitHub (May 22, 2023): I feel like some delay is still warranted, since for example a thumbnail taken from the moment of detection only shows a very small part of a detection like this: ![image](https://github.com/motioneye-project/motioneye/assets/51976044/0932a7d5-d80a-4793-9532-c4e83faa979d) I blurred it for privacy, but you can still see that only the head of the person is in the thumbnail on the driveway, adding 1 second more generally gives a lot better results! ![image](https://github.com/motioneye-project/motioneye/assets/51976044/616be5af-4f82-4f75-879f-c6fdb650b9d0)
Author
Owner

@Semmu commented on GitHub (Jan 29, 2026):

I have recently also dig into this code and IMHO the best solution would be to create the thumbnail from the exact middle of the video, I think that would be more informative than the beginning of the motion detection/event.

@Semmu commented on GitHub (Jan 29, 2026): I have recently also dig into this code and IMHO the best solution would be to create the thumbnail from the exact middle of the video, I think that would be more informative than the beginning of the motion detection/event.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/motioneye#2396
No description provided.