[FFmpeg-user] RTSP Stream Stitching

Ryan Melena ryan.melena at noesislabs.com
Wed May 24 20:36:09 EEST 2023


I'm attempting to stitch multiple RTSP streams from the same security
camera (multiple individual lenses in one housing) into a single video.
The issue I'm having is that ffmpeg appears to connect to the streams one
at a time and seems to buffer the earlier connections until the final
connection is complete, resulting in a stitched video with significant
delays between each source.

I've tried a few different recommendations I've found online such as:

ffmpeg -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay
-strict experimental -fflags +genpts+discardcorrupt -i
"rtsp://root:password@axis-b8a44f7cd812//axis-media/media.amp?camera=1" -i
"rtsp://root:password@axis-b8a44f7cd812//axis-media/media.amp?camera=2"
-filter_complex hstack=inputs=2 -f rtsp rtsp://localhost:8554/live.stream

and

ffmpeg -fflags nobuffer -flags low_delay -strict experimental -i
"rtsp://root:password@axis-b8a44f7cd812/axis-media/media.amp?camera=1" -i
"rtsp://root:password@axis-b8a44f7cd812/axis-media/media.amp?camera=2"
-isync 0 -filter_complex "[0:v]setpts='(RTCTIME - RTCSTART) / (TB *
1000000)'[v1sync]; [1:v]setpts='(RTCTIME - RTCSTART) / (TB *
1000000)'[v2sync]; [v1sync] [v2sync] hstack=inputs=2[stacked]" -map
"[stacked]" -f rtsp rtsp://localhost:8554/live.stream

and

ffmpeg -use_wallclock_as_timestamps 1 -i
"rtsp://root:password@axis-b8a44f7cd812//axis-media/media.amp?streamprofile=Blarg&camera=1"
-i "rtsp://root:password@axis-b8a44f7cd812//axis-media/media.amp?streamprofile=Blarg&camera=2"
-filter_complex hstack=inputs=2 -f rtsp rtsp://localhost:8554/live.stream

without any luck.

Any tips or troubleshooting steps would be very much appreciated!

Thanks


More information about the ffmpeg-user mailing list