Issues trying to synchronise video appsrc with audio

stic at free.fr stic at free.fr
Sun May 18 14:06:51 PDT 2014


Hi,

I am trying to synchronise video produced by appsrc with audio.

Here is the pipeline I am using:
appsrc name=vsource ! video/x-h264,framerate=30/1 ! h264parse config-interval=2 ! queue ! muxer. openslessrc name=asource ! audioconvert ! audio/x-raw,rate=16000 ! faac ! queue ! matroskamux name=muxer streamable=true ! tcpserversink...

The problem is that as soon as I introduce audio in the pipeline it blocks video and shows following warnings:
gstaudiobasesrc.c:863:gst_audio_base_src_create:<asource> warning: Can't record audio fast enough
gstaudiobasesrc.c:863:gst_audio_base_src_create:<asource> warning: Dropped 10560 samples. This is most likely because downstream can't keep up and is consuming samples too slowly.

Here is how I produce timestamps in the function called by the "need-data" signal:
// timestamp is initialized with 0 value
static GstClockTime timestamp = 0;

//then for each buffer the timestamp value is updated like this:
GST_BUFFER_PTS(buffer) = timestamp;
GST_BUFFER_DURATION(buffer) = gst_util_uint64_scale_int(1, GST_SECOND, framerate);
timestamp += GST_BUFFER_DURATION(buffer);

I know this is probably not the best way to give timestamps to buffers, but it works very well with video alone.
I tried to replace this by using do-timestamp=true and is-live=true properties to appsrc but as soon as I try to do this it ends with following warning from matroskamux for every buffer: "Invalid buffer timestamp; dropping buffer"

I am really stuck, any hints on how I could manage timestamps and synchonisation for this ?

Thank you.


More information about the gstreamer-devel mailing list