I would like to aggregate multiple audio samples into one GstBuffer.
The following simple pipeline generates normal and proper GstBuffers of 4096 bytes each. GST_DEBUG=3 gst-launch-1.0 -v audiotestsrc is-live=true num-buffers=10 ! capsfilter caps="audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)44100, channels=(int)2, channel-mask=(bitmask)0x0000000000000003" ! identity silent=false ! fakesink But ideally I would like to have GstBuffers of (for example) size 8000. For that I could use the rndbuffersize element and set min=8000 and max=8000. GST_DEBUG=3 gst-launch-1.0 -v audiotestsrc is-live=true num-buffers=10 ! capsfilter caps="audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)44100, channels=(int)2, channel-mask=(bitmask)0x0000000000000003" ! rndbuffersize min=8000 max=8000 ! identity silent=false ! fakesink Unfortunately that will drop my last couple of bytes (since it did not match the constrained size of rndbuffersize), e.g. the log reads: /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (8000 bytes, dts: none, pts: none, duration: none, offset: -1, offset_end: -1, flags: 00000000 ) 0x7f993c0062d0 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (8000 bytes, dts: none, pts: none, duration: none, offset: -1, offset_end: -1, flags: 00000000 ) 0x7f993c006600 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (8000 bytes, dts: none, pts: none, duration: none, offset: -1, offset_end: -1, flags: 00000000 ) 0x7f993c0061c0 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (8000 bytes, dts: none, pts: none, duration: none, offset: -1, offset_end: -1, flags: 00000000 ) 0x7f993c0062d0 0:00:00.224335047 18608 0x1f4de30 WARN rndbuffersize rndbuffersize.c:381:gst_rnd_buffer_size_drain_adapter:<rndbuffersize0> discarding 960 bytes at end (min=8000) /GstPipeline:pipeline0/GstIdentity:identity0: last-message = chain ******* (identity0:sink) (8000 bytes, dts: none, pts: none, duration: none, offset: -1, offset_end: -1, flags: 00000000 ) 0x7f993c0060b0 /GstPipeline:pipeline0/GstIdentity:identity0: last-message = event ******* (identity0:sink) E (type: eos (28174), ) 0x7f993c003670 Anyone has a clever workaround for this? rndbuffersize is clearly not suited for this but I would guess there should be an element that could do the trick which I simply do not know of. |
On Mon, 2016-11-07 at 12:09 -0800, Arjen Veenhuizen wrote:
> I would like to aggregate multiple audio samples into one GstBuffer. > > The following simple pipeline generates normal and proper GstBuffers of 4096 > bytes each. > > > > But ideally I would like to have GstBuffers of (for example) size 8000. For > that I could use the rndbuffersize element and set min=8000 and max=8000. > > > > Unfortunately that will drop my last couple of bytes (since it did not match > the constrained size of rndbuffersize), e.g. the log reads: > > > Anyone has a clever workaround for this? rndbuffersize is clearly not suited > for this but I would guess there should be an element that could do the > trick which I simply do not know of. based on a sample-per-buffer or time-per-buffer property. It's something that is generally useful to have in many scenarios, and I have that on my todo list since a long time but never got to it. -- Sebastian Dröge, Centricular Ltd · http://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (949 bytes) Download Attachment |
Thx for pointing me in the right direction Sebastian. The GstAdapter documentation probably contains all the information required. Unfortunately I'm not an C expert at all so this will probably end-up on my way-to-long to-do list.
|
As a follow-up, Sebastian did got around implementing the audiobuffersplit element which is doing exactly this, see here: https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/log/gst/audiobuffersplit/gstaudiobuffersplit.c
Thanks Sebastian! |
Free forum by Nabble | Edit this page |