How to synchronize buffer timestamp across two gstreamer pipeline(appsink,appsrc, rtspserver)

Jake Zhang zjpseudo at gmail.com
Sun Jun 26 23:17:39 UTC 2016


Hi Nicolas,

This is interesting question now. So after setting the appsrc pad offset as
the first PTS, appsrc will generate a segment event with offset = - pts of
first buffer. This is causing an issue if I am using mpegtsmux and
rtpmp2tpay in rtsp server as mpegts mux is always using pipeline running
time to re-stamp the output buffer. See the
'mpegtsmux_clip_inc_running_time()' in mpegtsmux.c. So my PTS is still
being re-stamped by RTSP pipeline. Any advice?

Here is my rtsp server part of launch string:
  launch_stream << "appsrc is-live=true name=appsrc0 do-timestamp=true
block=false ! "
                  << "mpegtsmux name=rtsp_mux0 alignment=7  ! "
                  << "video/mpegts, systemstream=true, packet-size=188 !
 rtpmp2tpay perfect-rtptime=false timestamp-offset=0 name=pay0";


 Thanks
-Jake

On Sat, Jun 18, 2016 at 11:27 AM, Nicolas Dufresne <
nicolas.dufresne at gmail.com> wrote:

> Le jeudi 16 juin 2016 à 17:05 -0400, Jake Zhang a écrit :
> > Greetings,
> >
> > I have been working on this for a while but still have no luck to get
> > this working. My pipeline can be simplified as below:
> >
> > pipeline1:
> > v4l2src -> tee -> x264enc -> appsink1
> >              ->  appsink2
> >
> > RTSP server pipeline2:
> > appsrc -> omxh264enc -> rtph264pay
> >
> > Pipeline 1 have other processing unit and I will need pull buffers
> > from appsink2 and push those buffers into appsrc of RTSP server.
> > My RTSP server part of implementation is very similar to test-
> > appsrc.c of gst-rtsp-server 1.6.4.
> >
> > The buffer I got from appsink already has their own PTS and to get
> > RTSP pipeline2 running, I have to re-stamp the buffer PTS the exactly
> > same way as test-appsrc.c (set ctx->timestamp=0 and increment based
> > of buffer duration) otherwise, the RTSP server will not get running.
>
> You don't, you can use push_sample(), so the segment is passed. And
> then, on the first buffer, you can compute the running time of this
> buffer (gst_segment_to_running_time()), and set the appsrc pad offset
> to -running_time_first_pts. Careful, that if you add audio, you should
> use the same offset for all stream, otherwise you will break a/v sync.
>
> regards,
> Nicolas
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160626/1c93901b/attachment.html>


More information about the gstreamer-devel mailing list