How to record video into circular buffer?

5

I want to build low cost IP camera with storage out of webcam, OpenWRT router and flash drive (or probably hard drive).
It's not difficult to do, but I would like to store like last 24 hours, therefore implement circular buffer.
First thing that comes to mind is to record e.g. 1 hour long records and remove 24 hour old one.
I was wondering if there is some easy way to do it with real circular buffer. Meaning one file containing exactly last 24 hours.
Because if I use 24x1hour files, memory is not used fully, because I need to have memory for 25 hours.
If I use 1 minute videos, memory is used fully, but it would be inconvenient to browse through 1 min videos.
Or what is convenient and efficient way to do such thing?

Viliam

Posted 2015-04-29T08:07:45.550

Reputation: 181

Answers

1

Today I would use a low-cost device like a Raspberry Pi Zero and script the recording using raspvid to segments and then merging the segments using a container format able to treat the segments as chapters. At every new addition I would discard the first chapter (ffprobe can give you timestamps and cutting it out is trivial) and add new content at the end.

khampf

Posted 2015-04-29T08:07:45.550

Reputation: 21