ispysoftware / iSpy

Open source surveillance software
http://www.ispyconnect.com
Other
1.3k stars 529 forks source link

Corrupt TimeLapse videos: moov atom not found #151

Open alainbryden opened 3 years ago

alainbryden commented 3 years ago

I've recently upgraded from iSpy to Agent DVR, but my understanding is they share a lot of the same source code.

I've been having a real issue with TimeLapse videos. I ask my agent to cut a timelapse every hour, but a large proportion of these files cannot be watched. VLC reports the following error in its console when I try to start the video:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0000026ddf3f3120] moov atom not found
[0000026ddf3f3c90] avcodec demux error: Could not open R:\Nest Records\video\FDXJU\1_TimeLapse_2021-05-08_21-01-08.mp4: Unknown error

This is connected to a Nest camera, so it's getting its stream over the internet. The stream is unreliable as all hell and often isn't working for hours at a time. My best guess is that these files are getting corrupted / the files aren't getting closed out properly in a variety of scenarios.

Here's a small sample file generated by agent dvr if you wanted to try a few approaches to "repairing" a broken timelapse file: https://user-images.githubusercontent.com/2285037/117556776-e61e2f00-b042-11eb-8f1c-595763c7284f.mp4

One thought: https://stackoverflow.com/a/11551573/529618 suggests that we can choose to write these as fragmented mp4 files (contains multiple self-contained small pieces of the video - each with its own table of contents), which comes with several benefits:

ispysoftware commented 3 years ago

Can you check the logs at /logs.html for relevant messages at the time these files are opened/ closed?