[FFmpeg-user] recording video file with 2 video tracks of two live cams

sekret at posteo.se sekret at posteo.se
Wed Apr 10 11:23:46 EEST 2019


Hi guys,

I'm new to this mailing list and I just subscribed because for the first time I have a problem with ffmpeg I cannot solve by myself. Hope I'll get some ideas, maybe solutions here.

What I need to do is record a video with 2 video tracks of two live surveillance cameras, connected by ethernet. Both can be accessed with rtsp. The first of the two cameras has a mic connected. The command line I've come up with so far looks like this:

ffmpeg -i "rtsp://$USERNAME:$PASSWORD@192.168.234.34:554" -i "rtsp://$USERNAME:$PASSWORD@192.168.234.33:554" -map 0:0 -map 1:0 -map 0:1 -c copy "$(date +%Y%m%d%H%M%S)".mkv (I don't think I need to explain, right?)

This works very well, both on my Linux laptop (Archlinux) and a Windows 10 desktop. Both have version 4.1.2 of ffmpeg installed.

BUT: The videos aren't in sync. The audio and video of the first camera are perfectly in sync (obviously, since the mic is connected to the first camera), but the second camera's video track is about 1.3 seconds ahead.

So, my questions are:
- Is this command line of mine too primitive for this to work properly?
- Is there a way to sync the video tracks? Maybe to delay the first one by those 1.3 seconds?
- Is there a different approach which potentionally works better?
(- Does maybe one of you guys happen to know a perfectly working software for this?) (I've searched and searched ... It's not a typical use case for surveillance cameras, so no success)

Best
sekret


More information about the ffmpeg-user mailing list