[Libav-user] How To Sync Multi Rtsp Streams

Xiemin Chen chenxiemin at gmail.com
Tue Jun 10 03:58:30 CEST 2014


Dear all:
    I want to sync four rtsp streams from ip camera says:
        rtsp://192.168.0.128/11
        rtsp://192.168.0.129/11
        rtsp://192.168.0.130/11
        rtsp://192.168.0.131/11
    And I'm trying to sync these streams to the system clock by adding the
stream start time, then I calculate the elapsed time with the current pts
like following:
        1. avformat_open_input();
        2. startTime = system_clock::now()
        3. while (run) :
        4.     av_read_frame()
        5.     avcodec_decode_video2(&frame, &packet);
        6.     playTime = startTime + packet.pts * av_q2d(stream.time_base);
        7.     add { frame : playTime } into queue
    But seems that the playTIme of every rtsp stream is not match, so
there's 300ms delay of every rtsp source sometime. Can anybody help about
this? Thanks very much.

Sincerely
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140609/fa0d77a1/attachment.html>


More information about the Libav-user mailing list