buffer probe data out of sync for subtitle text pad
Dece Bel
decebel at gmail.com
Tue Nov 12 18:58:37 PST 2013
Thank you Sebastian!!
I can now access the subtitle stream that is closely sync'ed up with the
video. I am using *appsink *as suggested on the playbin2 *text-sink *property
to pull the text buffer and computing the running time using base time and
clock.
One issue that I now have is that subtitle is not displayed on the final
video. Is this because of using *appsink *on the *text-sink *property
instead of an actual text processing element. Any idea how I can fix this -
get the subtitle text and timestamp in my console output and also display
the same on the final video.
Gracias
Dece
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 12 Nov 2013 07:36:18 -0500
> From: Dece Bel <decebel at gmail.com>
> To: gstreamer-devel at lists.freedesktop.org
> Subject: buffer probe data out of sync for subtitle text pad
> Message-ID:
> <CAPqbHrgBUaeE9KLzA=
> ib_dc-5pDayLJ20wOxazSSH7Xs6XJJbA at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I am trying to read subtitle from a video and want to record the timestamp
> of the subtitled text in the gstreamer pipeline.
> One approach that I have been trying is with the getting the action signal
> on playbin for "get-text-pad"
> and attaching a probe on the pad. Eventually when the callback
> (cb_have_data) is called, I do see the text in the buffer dumped on
> console.
>
> However, I notice that the subtitle on the final rendered video and the one
> dumped from the probe callback are out of sync.
> Can someone pls suggest how to get the timestamp of the subtitled text from
> the stream or received a sync'ed stream or any other approach.
>
>
> Gracias
> Dece
>
> below is some relevant stripped code that uses the playbin element (using
> gstreamer 1.0)
>
> main() {
>
> // creating the playbin element and setting flags to also play sub-titles
> ...
> ...
> ..
> ...
>
> g_signal_emit_by_name (data->playbin, "get-text-pad", 0, &txt_pad);
> if(txt_pad) {
> printf("\nwe have a text pad");
> *c**a_pad_data(txt_pad);*
> }
>
> }
>
>
> ///////////////////////////////////////
> // When text pad is added, the below function will attach a probe
>
> *void cb_pad_added(GstPad* pd) {*
> * gchar *name;*
> * GstCaps *caps = NULL;*
>
> * name = gst_pad_get_name (pd);*
> * g_print ("\nA new pad %s was created\n", name);*
> * g_free (name);*
>
>
> * gst_pad_add_probe (pd, GST_PAD_PROBE_TYPE_BUFFER, (GstPadProbeCallback)
> cb_have_data, NULL, NULL);*
>
> * gst_object_unref (pd);*
>
> *}*
>
>
> ///////////////////////////////////////////////
> // probe call back. Read the buffer an size and then print the buffer text
> to screen.
>
> *static GstPadProbeReturn*
> *cb_have_data (GstPad *pad,*
> * GstPadProbeInfo *info,*
> * gpointer user_data) {*
>
> * GstBuffer *buffer;*
> * char text_msg[128];*
>
> * gint sz, sz2;*
> * memset(text_msg, 0, sizeof(text_msg));*
> * buffer = GST_PAD_PROBE_INFO_BUFFER (info);*
> * sz = gst_buffer_get_size(buffer);*
>
> * sz2 = gst_buffer_extract(buffer, 0, text_msg, sz);*
> * g_print ("\nBuffer Size is %d, read %d, data: %s", sz, sz2, text_msg);*
> * return GST_PAD_PROBE_OK;*
> *}*
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131112/9268a936/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Tue, 12 Nov 2013 13:44:36 +0100
> From: Sebastian Dr?ge <sebastian at centricular.com>
> To: Discussion of the development of and with GStreamer
> <gstreamer-devel at lists.freedesktop.org>
> Subject: Re: buffer probe data out of sync for subtitle text pad
> Message-ID: <1384260276.2586.6.camel at thor.lan>
> Content-Type: text/plain; charset="utf-8"
>
> On Di, 2013-11-12 at 07:36 -0500, Dece Bel wrote:
> > I am trying to read subtitle from a video and want to record the
> timestamp
> > of the subtitled text in the gstreamer pipeline.
> > One approach that I have been trying is with the getting the action
> signal
> > on playbin for "get-text-pad"
> > and attaching a probe on the pad. Eventually when the callback
> > (cb_have_data) is called, I do see the text in the buffer dumped on
> console.
> >
> > However, I notice that the subtitle on the final rendered video and the
> one
> > dumped from the probe callback are out of sync.
> > Can someone pls suggest how to get the timestamp of the subtitled text
> from
> > the stream or received a sync'ed stream or any other approach.
>
> You could also set a text-sink on playbin btw. But the problem stays the
> same wrt synchronization. You need to convert the buffer timestamps to
> running-time, and then check them against the current running time of
> the sink (clock_time - base_time). Usually you will get buffers much
> earlier and then need to wait a bit until they are to be displayed.
>
> --
> Sebastian Dr?ge <sebastian at centricular.com>
> Centricular Ltd - http://www.centricular.com
> Expertise, Straight from the Source
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: signature.asc
> Type: application/pgp-signature
> Size: 966 bytes
> Desc: This is a digitally signed message part
> URL: <
> http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131112/f7043ba5/attachment-0001.pgp
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131112/0946cede/attachment.html>
More information about the gstreamer-devel
mailing list