store audio/video into circular buffer

Damiano Pinarello damiano.pinarello at bticino.it
Wed Nov 21 01:50:22 PST 2012


Hi chris,

I'm following your indications using queue and valve to store pre-event video.
I write a test-program to exec in my device (dm365) this pipeline:

   gst-launch v4l2src always-copy=FALSE ! queue min-threshold-time=30000000000 ! valve drop=1 ! \
   'video/x-raw-yuv,format=(fourcc)NV12,width=1280,height=720,framerate=(fraction)30/1' ! \
   TIVidenc1 bitRate=6000000 encodingPreset=2 codecName=h264enc engineName=codecServer \
   contiguousInputFrame=TRUE ! rtph264pay pt=96 ! udpsink host=10.39.10.63 port=5000

and no video is sent via network due to the setting of valve [drop=true].
When I send a interrupt from keyboard, first of all the valve 'drop' parameter change to false (0),
and then the queue 'min-threshold-time' parameter change to 0.
Reading gstreamer manual, one of the step to do this is sending end-of-stream segnal to the element
on which I change the parameter before changing the parameter, but I don't want t do this operation
in the queue because I don't want to empty its content (pre-event).
This work the same in my program, great!

But, I meet this problems: min-threshold-time=30000000000 (30 sec) is unaccept when I try
to compile my progam, I teset that 'g_object_set' accept only until 30000000.
The output message is:

  gst-player.cpp:138: error: integer constant is too large for 'long' type

Why this? 'gst-inspect queue' show a min-threshold-time range 0-18446744073709551615 (ns)!

I use this code:
   g_object_set(GST_OBJECT(queue), (char*)"min-threshold-time", (gint64)30000000000, NULL);

However, to test if my program work correctly, I try to use min-threshold-time=30000000 (and drop=true).
When I send interrupt to change drop=false and min-threshold-time=0, the video stream flow correctly
thru the network to my desktop, but ovoiusly human eyes don't recognize a delay on 30us and the video
stream appears syncornized.

After that, I tryed to use a similar-pourpose pipeline into my desktop to check queue functionalities,
but without a valve element:

   gst-launch videotestsrc ! queue min-threshold-time=30000000000 ! xvimagesink

but I don't se a delay of 30sec, the video appears again syncronized.
If I remove the queue, I obtain the same result.

'min-threshold-time parameter' work on queue?
Any suggestions?

Thanks in advance,
Damiano


On 11:05 Fri 09 Nov     , Chris Whittenburg wrote:
>    I did this on an omap3730.  I used a queue feeding a valve. 
> 
>    On startup, the queue had it's min-threshold-time set to 30 seconds, and
>    the valve was set to drop=true.  Thus, 30 seconds of video would build up
>    in the queue before it would start sending video downstream to the valve. 
>    The valve would just throw everything away.
> 
>    When I got the signal to start recording, I would set the value to
>    drop=false, and the min-threshold-time of the queue to zero.  The 30
>    seconds of video in the queue would then flow on thru to the valve and
>    pass on to the video codec.  Eventually the system would get entirely
>    caught up, and be recording live video.
> 
>    This gave me 30 seconds of pre-event buffer without having to create any
>    new plugins.
> 
>    There may be better ways-- I worked this out without any input from
>    anyone, and I'm not that experienced with gstreamer.
> 
>    -chris
> 
>    On Fri, Nov 9, 2012 at 7:43 AM, Randall Scheifele <rjscheif at gmail.com>
>    wrote:
> 
>      Hi Damiano,
>      I am doing a similar thing on the dm368.  I am currently planning on
>      using the queue element.  If you read the documentation on the queue
>      element
>      (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-queue.html)
>      you'll see that it has some minimum value properties
>      (buffers/bytes/time).  I was planning on setting a minimum value to
>      store enough buffered video inside of the queue and installing a buffer
>      probe on the source pad of the queue to throw out buffers when I don't
>      want to store them.
>      If anyone else has a better way of doing this in gstreamer, let me know.
>      -Randy
> 
>      On Fri, Nov 9, 2012 at 5:39 AM, Damiano Pinarello
>      <damiano.pinarello at bticino.it> wrote:
> 
>        Hi,
> 
>        I read in a forum that queue can work with live-sources, while queue2
>        can't (right now).
>        But I consider this information old, beacuse the message is dated to
>        09/2010.
>        Do you have some newest information about it?
> 
>        To better explain my need, I'm working on a IP camera base on dm365
>        that used
>        gstreamer. The pourpose is this: when an interrupt arrives (for
>        example due to
>        motion detection) I must have a 30 seconds video before it to
>        undestand what
>        have generated the interrupt.
> 
>        I think to do this with a sort of circular buffer before sink element.
>        This new element will continue to store data, and when an interrupt
>        arrives
>        it must reorder the buffer and put the content into a file.
>        After that start to normally send video to sink element.
> 
>        Thanks,
>        Damiano
> 
>        On 15:44 Thu 08 Nov     , Krzysztof Konopko wrote:
>        > Hi Damiano,
>        >
>        > Have you looked at queue2 element? It supports circular buffering in
>        the
>        > file.
>        >
>        > Kris
>        >
>        > On 08/11/12 14:26, Damiano Pinarello wrote:
>        > > Hi,
>        > >
>        > > I need a element that store audio/video into circular buffer, and
>        put
>        > > it in a file
>        > > when a interrupt arrive (maybe from gstreamer bus).
>        > > This element could be seen as a sort of filesink modified, for
>        example
>        > > called "cicbsink".
>        > >
>        > > Which is the right way to problems? Someone have already tryed to
>        > > solve the same need?
>        > > The right way could be to create a new plugin? Or add this new
>        element
>        > > to gstreamer core?
>        > >
>        > > Thanks,
>        > > Damiano
>        > >
>        >
>        > _______________________________________________
>        > gstreamer-devel mailing list
>        > gstreamer-devel at lists.freedesktop.org
>        > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> 
>        --
> 
>        ***** Email confidentiality notice *****
>        This message and attachment are confidential and they also are legally
>        privileged in accordance with the NDA.
>        If you have received this message in error, please notify us and
>        remove it from your system.
> 
>        --
> 
>        Damiano PINARELLO
>        Embedded Software Developer
>        Office Phone: +(39) 031 653679 Ext. 4679
>        FAX phone: +(39) 031 653283
>        Street address: Via L. Manara 4, 22036 Erba (CO), Italy
>        Email: damiano.pinarello at bticino.it
>        WebSite: www.bticino.it
> 
>        ------------------------------------------------------------------------------
>         Please consider your environmental responsibility before printing
>        this Email
>        ------------------------------------------------------------------------------
>        This message is confidential. It may also be privileged or otherwise
>        protected
>        by law or legal rules. Should you have received this email by mistake
>        please
>        let us know by reply and then delete it from your system; you should
>        not copy
>        it or disclose its contents to anyone.
>        All messages sent to and from [Enea] may be monitored to ensure
>        compliance
>        with internal policies and to protect our business. Emails are not
>        secure
>        and cannot be guaranteed to be error free as they can be intercepted,
>        amended,
>        lost or destroyed, or contain viruses. Anyone who communicates with us
>        by email
>        is taken to accept these risks.
>        ------------------------------------------------------------------------------
> 
>        Ce message, ainsi que tous les fichiers joints `a ce message,
>        peuvent contenir des informations sensibles et/ ou confidentielles
>        ne devant pas etre divulguees. Si vous n'etes pas le destinataire
>        de ce message (ou que vous recevez ce message par erreur), nous
>        vous remercions de le notifier immediatement `a son expediteur, et
>        de detruire ce message. Toute copie, divulgation, modification,
>        utilisation ou diffusion, non autorisee, directe ou indirecte, de
>        tout ou partie de ce message, est strictement interdite.
> 
>        This e-mail, and any document attached hereby, may contain
>        confidential and/or privileged information. If you are not the
>        intended recipient (or have received this e-mail in error) please
>        notify the sender immediately and destroy this e-mail. Any
>        unauthorized, direct or indirect, copying, disclosure, distribution
>        or other use of the material or parts thereof is strictly
>        forbidden.
>        _______________________________________________
>        gstreamer-devel mailing list
>        gstreamer-devel at lists.freedesktop.org
>        http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> 
>      _______________________________________________
>      gstreamer-devel mailing list
>      gstreamer-devel at lists.freedesktop.org
>      http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


-- 

***** Email confidentiality notice *****
This message and attachment are confidential and they also are legally privileged in accordance with the NDA.
If you have received this message in error, please notify us and remove it from your system.

--

Damiano PINARELLO
Embedded Software Developer
Office Phone: +(39) 031 653679 Ext. 4679
FAX phone: +(39) 031 653283
Street address: Via L. Manara 4, 22036 Erba (CO), Italy
Email: damiano.pinarello at bticino.it
WebSite: www.bticino.it

------------------------------------------------------------------------------
 Please consider your environmental responsibility before printing this Email
------------------------------------------------------------------------------
This message is confidential. It may also be privileged or otherwise protected
by law or legal rules. Should you have received this email by mistake please 
let us know by reply and then delete it from your system; you should not copy
it or disclose its contents to anyone.
All messages sent to and from [Enea] may be monitored to ensure compliance
with internal policies and to protect our business. Emails are not secure
and cannot be guaranteed to be error free as they can be intercepted, amended,
lost or destroyed, or contain viruses. Anyone who communicates with us by email
is taken to accept these risks.
------------------------------------------------------------------------------


Ce message, ainsi que tous les fichiers joints à ce message,
peuvent contenir des informations sensibles et/ ou confidentielles
ne devant pas être divulguées. Si vous n'êtes pas le destinataire
de ce message (ou que vous recevez ce message par erreur), nous
vous remercions de le notifier immédiatement à son expéditeur, et
de détruire ce message. Toute copie, divulgation, modification,
utilisation ou diffusion, non autorisée, directe ou indirecte, de
tout ou partie de ce message, est strictement interdite.

This e-mail, and any document attached hereby, may contain
confidential and/or privileged information. If you are not the
intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any
unauthorized, direct or indirect, copying, disclosure, distribution
or other use of the material or parts thereof is strictly
forbidden.


More information about the gstreamer-devel mailing list