1

I am trying to make the video that is recorded from three usb webcams be synchronized, I am using this command, but I still have differences by milliseconds or seconds. Any idea how to achieve it?

ffmpeg -y -copyts \
-f v4l2 -thread_queue_size 1024 -input_format mjpeg -video_size 640x480 -framerate 30 -i /dev/video0 \
-f v4l2 -thread_queue_size 1024 -input_format mjpeg -video_size 640x480 -framerate 30 -i /dev/video2 \
-f v4l2 -thread_queue_size 1024 -input_format mjpeg -video_size 640x480 -framerate 30 -i /dev/video4 \
-map 0:v -c:v copy output1.mkv -map 1:v -c:v copy output2.mkv -map 2:v -c:v copy output3.mkv

1 Answers1

0

A few things to try:

  • Save to .mov, not .mkv. That might reduce CPU load and behave better with -c:v copy.

  • Write three separate shell scripts, each of which reads one camera and writes one video file. Run them with parallel sh ::: 1.sh 2.sh 3.sh.

  • Try clvc instead of ffmpeg. To get that, apt install vlc-bin.

Others have fought long battles with similar configurations:
Capturing multiple RTSP streams simultaneously in sync
https://stackoverflow.com/questions/24690806/ffmpeg-how-to-record-multiple-rtmp-streams-into-multiple-files
https://forums.gentoo.org/viewtopic-t-998658-start-0.html