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 ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
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 ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Thanks you very much for your help.
I changed the code to: pipeline = gst.parse_launch("filesrc location=/home/steven/03.pcm ! audioparse ! identity sync=true ! audioresample ! audioconvert ! vorbisenc ! oggmux ! fdsink sync=true fd="+str(pipeout)) pipeline.set_state(gst.STATE_PLAYING) and now it works fine. It seems it needs the "identity sync=true" though otherwise the syncing does not work. The sync parameter on the fdsink doesn't seem to have any effect in this case. Cheers, Steven ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |