[gst-devel] Synchronizing audio stream with system clock

Steven Barth steven at midlink.org
Sun Jan 31 20:54:35 CET 2010


Hello,

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))
pipeline.set_clock(gst.system_clock_obtain())
pipeline.set_state(gst.STATE_PLAYING)



It kind of works, but it encodes the data as fast as it can. I however want it 
to synchronize the playback / encoding speed with real time.  I want to avoid 
doing the time handling on the application at the other end of the pipe 
because I dont't want to touch or analyse the data there in detail.

As you can see I tried to set the pipeline clock to the system clock and use 
identity to set the datarate and synchronize it with the clock but 
unfortunately it does not work.

I probably misunderstood some of the concepts of gstreamer here or just forgot 
about something. Please give me a hint on how I can solve this problem.


Cheers,
Steven




More information about the gstreamer-devel mailing list