Search code examples
ubuntuvideo-streamingbatch-processingvlc

Capture a continuous network stream using VLC, split and store to multiple files


I am trying to capture a network stream using VLC GUI in Ubuntu. The stream has to be stored to a file on disk that should be split after 3hrs of recording. For every 3hr recording a new file should be created, so timestamp has to be appended to the file name. What flags/options should be added to this stream output string to achieve this objective?

:sout=#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:file{dst=/home/user/Videos/test.mp4,no-overwrite} :no-sout-all :sout-keep

If its not possible using VLC GUI, are there command line options or other applications which could be used?


Solution

  • I did not find a solution using VLC via GUI, but couple of alternatives are discussed in another thread.

    This command served my purpose on Ubuntu 20.04:

    ffmpeg -i https://user:pwd@192.168.100.124:1234/video -c copy -map 0 -f segment -segment_time 60 -segment_format mp4 "capture-%04d.mp4"
    

    Command above splits the network stream into files named capture-0001.mp4, capture-0002.mp4 etc every 60secs.

    Only prerequisite is to install ffmpeg using sudo apt-get install ffmpeg