'Two cameras RTSP streaming with FFMPEG command
I tried to control both cameras and rtsp streaming via ffmpeg command at the same time, but the video delay between the first camera and the second camera differs by more than 1 second. (The gap gets bigger depending on the resolution setting)
I have 2 cameras with 4K resolution, 60FPS.
The command used is as follows.
- Delay time between the two cameras on the transmitted screen: 0.5 seconds
ffmpeg ^
-f dshow -rtbufsize 4M -thread_queue_size 4096 -vsync 1 -r 60 -i video="@device_pnp_\\?\usb#vid_1bcf&pid_2c99&mi_00#8&3ea22a0&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" ^
-f dshow -rtbufsize 4M -thread_queue_size 4096 -vsync 2 -r 60 -i video="@device_pnp_\\?\usb#vid_1bcf&pid_2c99&mi_00#8&368bcea6&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" ^
-filter_complex "[0:v] setpts=PTS-STARTPTS,scale=1920x1080:force_original_aspect_ratio=decrease,setsar=1[upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1920x1080:force_original_aspect_ratio=decrease,setsar=1[upperright]; [upperleft][upperright]hstack[base]" ^
-map [base] ^
-f rtsp -rtsp_transport tcp rtsp://IP:PORT/test
- Delay time between the two cameras on the transmitted screen: 1 ~ 2.5 seconds
ffmpeg ^
-f dshow -rtbufsize 4M -thread_queue_size 4096 -vsync 1 -r 60 -i video="@device_pnp_\\?\usb#vid_1bcf&pid_2c99&mi_00#8&3ea22a0&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" ^
-f dshow -rtbufsize 4M -thread_queue_size 4096 -vsync 2 -r 60 -i video="@device_pnp_\\?\usb#vid_1bcf&pid_2c99&mi_00#8&368bcea6&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" ^
-filter_complex "[0:v] setpts=PTS-STARTPTS,scale=3840x2160:force_original_aspect_ratio=decrease,setsar=1[upperleft]; [1:v] setpts=PTS-STARTPTS, scale=3840x2160:force_original_aspect_ratio=decrease,setsar=1[upperright]; [upperleft][upperright]hstack[base]" ^
-map [base] ^
-f rtsp -rtsp_transport tcp rtsp://IP:PORT/test
Drop frames or tell me how to sync them.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
