How to record video and audio frames using ffmpeg

Viewed 734

How to record video and audio in a separate files for every 40ms continuously upto 10 seconds from webcam using FFMPEG?

Thanks.

1 Answers

Step 1: Webcam Capture

As already mentioned in the comments follow this instructions for audio capturing. How can I capture audio AND video simultenaous with ffmpeg from a linux USB capture device
We start with his:

./ffmpeg -f alsa -i hw:0 -f video4linux2 -i /dev/video0

More details are explained in the FFmpeg documentation.

Step 2: Segmentation

./ffmpeg -f alsa -i hw:0 -f video4linux2 -i /dev/video0 -t 0:10 -segment_time 00:00.040 -f segment out_%003d.mp4
  • -t 0:10 records only for 10 seconds
  • -segment_time 00:00.040 split every 40 milliseconds
  • -f segment use a segmented format
  • out_%03d.mp4 output file name template (%03d is used for a better formatting; 001, 002, 003 and so on)

Again here's the link to the FFmpeg documentation for segmentation.

Related