How can I keep the flow (protocol rtsp, codec h264) in file (container mp4)? That is, on inputting an endless stream (with CCTV camera), and the output files in mp4 format size of 5-10 minutes of recording time.
OS: debian, ubuntu Software: vlc, ffmpeg (avconv)
Currently this scheme is used:
cvlc rtsp://admin:[email protected]:554/ch1-s1 --sout=file/ts:stream.ts
ffmpeg -i stream.ts -vcodec copy -f mp4 stream.mp4
But it can not record video continuously (between restarts vlc loses about 10 seconds of live video).
See this question and answer on Server Fault. In short, switch tools. avconv will do what you want. (ffmpeg has become avconv.)
The feature you are looking for is called segmentation. Your command line would look something like this:
avconv -i rtsp://10.2.2.19/live/ch01_0 -c copy -map 0 -f segment -segment_time 300 -segment_format mp4 "capture-%03d.mp4"