Motion-Project / motion

Motion, a software motion detector. Home page: https://motion-project.github.io/
GNU General Public License v2.0
3.65k stars 547 forks source link

Movie might contain no motion when using short movie_max_time #1072

Closed angrycoding closed 4 years ago

angrycoding commented 4 years ago

Spotted some problem in motion when using movie_max_time set to 30 seconds and post_capture set to > 0. It's hard to explain but I'll try. If something is moving within first 30 seconds then everything goes okay, and motion records one video file for me. Everything works as expected if movement is happening within first 25 - 28 seconds. Problem starts when movement continues after 25 seconds and finishes somewhere in between 25 - 30 seconds. What I expect is to have one video file with duration = 25 - 30 seconds. But what actually happens is that motion records video with moving object, in which last 5 - 0 seconds does not contain any motion. And then right after that records another video fragment without any motion as well. Looks like when motion recording a fragment for post_capture rule - it does not take into account the fact that there is no motion anymore.

Scenario: post_capture set to 10 movie_max_time set to 10 Camera is spotted on some object.

10:00:00 Object starts to move 10:00:28 Object is not moving anymore

Expected: one video file with duration = 28 seconds Actual: two video files, first is 30 seconds second is 10 seconds and the second one is empty (nothing is moving)

tosiara commented 4 years ago

Can you try to enable "debug" videos and upload it together with the corresponding regular video sample?

angrycoding commented 4 years ago

Can you try to enable "debug" videos and upload it together with the corresponding regular video sample?

Yes I can do that, but there is no issue with motion detection. Issue is with how motion is cutting the video on fragments. The only problem is that there is no need to process post_capture thing, when there is no motion in it. I've tried to solve my problem by using "%D" conversion specifier, but either I don't understand how it works or it doesnt give me correct value. Because it's value passed to the script on_movie_end - looks completely random to me (for movies with motion it can give me 0 and some value > 0 in other time).

angrycoding commented 4 years ago

Regarding the videos. Look at this. First: https://www.youtube.com/watch?v=FYwGhlNO-oU Second: https://www.youtube.com/watch?v=NFpCBZfhlEg post_capture = 1 movie_max_time = 30 As you can see motion with the provided setup records two video fragments. But second one (and I believe that is because of post_capture) does not contain any moving objects.

tosiara commented 4 years ago

Could you please upload the originals of the videos to a file hosting rather than youtube?

angrycoding commented 4 years ago

Could you please upload the originals of the videos to a file hosting rather than youtube?

Sure. With motion: https://drive.google.com/file/d/1cOXIZpSzZLwlDCqtJpzrtcMqJI5KGAzi/view?usp=sharing Without motion: https://drive.google.com/file/d/1ylNdC38raghjYJgkwdzp-wSvZI9K_Ev8/view?usp=sharing

tosiara commented 4 years ago

Do you have "debug" videos corresponding to those samples?

angrycoding commented 4 years ago

Do you have "debug" videos corresponding to those samples?

No

tosiara commented 4 years ago

Since you did not provide neither debug videos, nor corresponding logs, I'm trying to guess, you are using pass through?

angrycoding commented 4 years ago

Since you did not provide neither debug videos, nor corresponding logs, I'm trying to guess, you are using pass through?

Exactly

tosiara commented 4 years ago

And what is your event_gap value?

angrycoding commented 4 years ago

And what is your event_gap value? Set to 12

tosiara commented 4 years ago

But how could you record 30 sec video while having movie_max_time set to 10?

I'd like to see full config, full detailed and debug videos with motion in order to investigate

angrycoding commented 4 years ago

But how could you record 30 sec video while having movie_max_time set to 10?

I'd like to see full config, full detailed and debug videos with motion in order to investigate

movie_max_time = 30

For the videos on google drive. I'll give you full config, but not debug. I can't catch it very often.

tosiara commented 4 years ago

Reopen if reproduced