Since it works well enough with
cat and ctrl+c, the following command line should work with data according to the question and assuming 5 seconds play-time to be recorded.
timeout 5 cat /dev/video0 > file.mpeg
cat is a simple tool for reading/writing data. There is no way to set the speed or time interval for the data transfer in
cat. You have to control it outside
cat. But there are many other tools.
Use the built-in features in
It is also possible to use the multimedia tool
ffmpeg. There is a steep learning curve, but when you get into using it, you will find that it is a very powerful tool. There are detailed instructions in the manual
man ffmpeg but it is better to search for a suitable tutorial via the internet.
I have tested the following command line with conversion from an MTS file to an mpeg file. I have not tested it from a device, but I think it will work. You may want to control the conversion (to be different from the defaults) using more options in the command line.
ffmpeg -t 5 -i /dev/video0 file.mpeg
-t 5 means that 5 seconds are recorded.
The following command line may be an important improvement,
ffmpeg -i /dev/video0 -f segment -segment_time 10:0 out%03d.mp4
It will split the input into files of 10 minutes length. you should look at the docs here
In my working computer with Lubuntu 18.04.1 LTS, there is
ffmpeg version 3.4.4-0ubuntu0.18.04.1, so version 3.4.4. This is what you get if you install from Ubuntu's repositories. Other linux distros and versions have probably other versions (newer or older).
The link (to https://ffmpeg.org) describes version 4.1, and some features in this version may not be there in the older version. This version is more advanced, but may be more complicated to get and to keep up to date with bugfixes.