I need to setup VLC to record RTSP stream from IP-camera to hard drive. Currently I wrote two bash scripts.
First script remove oldest file, if HDD free space is less than 10%.
Second script is infinity loop where VLC runs with the following command:
cvlc 'rtsp://ip_camera_stream' --sout "#transcode{}:duplicate{dst=std{access=file,mux=ts,dst={some_file_name}}}" --run-time=360 --stop-time=361 --play-and-exit --rtsp-frame-buffer-size=30000000
And it's looks fine. Recording going OK for some time, but later files starting to growing too fast and taking all available 1,5TB. This files unplayable and in the HEX editor they contains mostly the zeroes.
When I try to kill vlc process - nothing happens, but after rebooting PC everything working again (mostly).
I use Ubuntu 16.04 and VLC from standard deb repo, not snap package.
Anybody have ideas how to fix it?