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

sekret at posteo.se sekret at posteo.se
Thu Apr 11 18:16:10 EEST 2019


>> 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
>
>Complete, uncut console output missing.

Here's the complete output: https://pastebin.com/Y1ZuMJ2L (run on the Windows 10 machine, where it's supposed to be running once it's perfected)

I've added the options -re and -thread_queue_size 1024 to my first commandline. However the problem of videos out of sync remains, so it's not caused by buffering problems etc. The warnings about circular_buffer_size not being supported don't do any harm, right?

>I think the difference comes from which stream connects first and starts receiving packets first, since there’s no reference time to sync both streams to.
>
>Many (most?) devices of this kind also transmit the absolute timestamps separately from the video stream, so if you have the system time synchronized on both cameras, perhaps using ntp, maybe it would be possible to use this information to sync the two streams up but i don’t know if it is possible to do this automatically using ffmpeg alone.

I'm also pretty sure that this is the reason. Is it perhapt possible to tell ffmpeg to handle both inputs equally, so both start at the same time?

I kinda like the idea of syncing them based on the system time, which, in case it works, should be in sync well enough for this purpose. But I fear implementing this is over my head. Still, I'll keep this in mind in case nothing else works, so Ted, thanks a lot for this idea!

Since I'll run this command by a bat file on this Windows machine (it's supposed to be idiot proof unfortunately), a workaround could be to re-merge the video with mkvmerge and then just delay the second video track. I don't really like this idea all too much, since the length of this delay could e.g. depend on the cpu load when the commandline gets executed.


Hope you guys have even better ideas than me, being kind of an ffmpeg noob to be honest...


Thanks a lot so far!
sekret


More information about the ffmpeg-user mailing list