Storing video as mp4

If the plan is to record endles mp4 files from a single source, then that would be called segmentation when using ffmpeg. https://serverfault.com/a/386310 I think I have done that in the past, when originally researching for shinobi cctv. Although, I have never tried piping it. Currently, I know for sure that my internal libs don't look for the marker indicating the end of an mp4. It would be an interesting challenge.

In the meantime, if you really want to take a camera source and have ffmpeg write endless mp4 files to disk, segmented into specific durations, then that can be accomplished without using the mp4frag node. Just use the watch node to detect when the new files are written to disk and process that data to create your timeline.

I may have a way to mimic the behavior of ffmpeg when it does mp4 segmentation. If I add an option for continuous buffer output, while allowing the mp4 to be segmented based on time limit or size limit, it just might work. It will probably need an output topic (topic: 'initialization') to indicate when a new mp4 file is starting to output so that you can handle that and dynamically create a new name, while using a topic: (topic: 'segment') for segment output. With continuous mode, a new mp4 file will start to output immediately after the previous mp4 limit has been reached. This is necessary because it will have to output the initialization fragment before the segments so that it can be a valid mp4 when written to disk. This may be unclear right now, but of course, it will have a flow example to demonstrate its functionality. No ETA on this feature as it only exists in my mind at this time.

Unlike ffmpeg, my implementation will not be size or time exact. Since we are not re-encoding the actual mp4 data, actual sizes and durations will be >= limits. For example, if you want a 11 seconds duration mp4, but your segments are broken into 5 second durations, then you will end up with a 15 seconds duration mp4.

I am currently working on the editor forms to use jquery spinners to set default limit values (which could still be overridden via the input msg). I really struggle with these forms and jquery and spend most of my time there.

example showing a limit only using size of 10 mb

example showing a limit only concerned with time of 1 minute

1 Like