[gst-devel] Synchronizing audio stream with system clock

Tim-Philipp Müller t.i.m at zen.co.uk
Sun Jan 31 21:23:49 CET 2010


On Sun, 2010-01-31 at 20:54 +0100, Steven Barth wrote:

> I'm new to gstreamer and need a hint on how to synchronize an audio stream 
> from a filesrc or fdsrc with the system clock.
>
> My setup is like this:
> I have a little Python application that utilizes gstreamer to convert a raw 
> CD-like audio stream into vorbis and stream it with an fdsink through a pipe 
> to another application.
> 
> 
> 
> I use the following code snippet (Python).
> 
> 
> pipeline = gst.parse_launch("filesrc location=/home/steven/03.pcm ! capsfilter 
> caps=audio/x-raw-int,rate=44100,channels=2,depth=16,signed=true ! identity 
> datarate=176400 sync=true ! audioresample ! audioconvert ! vorbisenc ! oggmux 
> ! fdsink fd="+str(pipeout))

Instead of the capsfilter ! identity datarate=..., better use the
audioparse element from gst-plugins-bad.

As for syncing against the clock, fdsink sync=true, should be all that's
needed really (oggmux should output buffers that are properly
timestamped).

> pipeline.set_clock(gst.system_clock_obtain())

I don't think you need this either.

Cheers
 -Tim






More information about the gstreamer-devel mailing list