[gst-devel] controlling framerate for custom src plugin

gst at omroepvenray.nl gst at omroepvenray.nl
Sun Dec 27 22:52:06 CET 2009


Hi Tim,

>> I could not find a plugin to capture the images from the IP
>> lcamera and I started implementing my own plugin based on
>> gsttcpclientsrc.c.
>
> It's not the kind of cam that just works with e.g. souptthpsrc
> location=... ! multipartdemux ! ... ?

No, unfortunately it doesn't use http but has a custom protocol to
authenticate and request images.

>> I'm not able to control the framerate. It is always capturing images at
>> the
>> highest possible speed.
>
> I think that's normal for a lot of these cameras.

Sorry if I wasn't clear. It's not the camera that's sending images too
frequent but it's gstreamer that keeps calling the _create() on my
ipcamsrc element. The camera will only send an image after receiving and
image request. I send this image request from within the _create() call,
receive the JPEG image data and put it in a buffer.

If I debug the same pipeline with e.g. videotestsrc, I see that
videotestsrc generates new frames at the requested frame rate (as it
should). I would like to have the same behavior for my ipcamsrc, i.e.
_create() is called only when a frame is needed.

> Your source should put timestamps on buffers. If it derives from
> GstBaseSrc it might be enough to set the do-timestamp property to TRUE.
> You can then put a videorate element into the pipeline followed by a
> capsfilter with a framerate, which will drop/duplicate frames and fix up
> the timestamps a bit so that you get a perfectly time-stamped stream
> that's easy to feed into encoders/muxers.

I removed all my own (well, copied from v4lsrc) time stamping code and
enabled do-timestamp but without luck.

>> The pipeline I currently use for testing:
>>
>> gst-launch ipcamsrc host=HOST port=8080 username=USER password=PASS !
>> jpegdec ! ffmpegcolorspace ! timeoverlay ! ximagesink
>
> Maybe try something like:
>
>  ipcamsrc do-timestamp=true ... ! videorate ! image/jpeg,framerate=
> \(fraction\)25/1 ! jpegdec ! ffmpegcolorspace ! timeoverlay !
> ffmpegcolorspace ! ximagesink sync=false

Unfortunately this doesn't help either. But to check my understanding of
how gstreamer works: the src pad of videorate should be emitting frames at
exactly the specified framerate, but does it also try to negotiate this
framerate on the sink pad of the videorate element?

I also noticed that gst_buffer_set_caps() is called. Is it
necessary/important that the correct caps are set on the buffer? In other
words, what is important for the framerate (timestamp, duration, caps,
...)?

> (IIRC videorate supports image/jpeg only in recent versions of
> gst-plugins-base - if that's a problem you can move the videorate behind
> the jpegdec.)

I'm using gstreamer-plugins-base 0.10.25.1 and thus should be OK here.

Best regards,
Roland

BTW: see http://www.omroepvenray.nl/gst/gstipcamsrc.c for latest snapshot





More information about the gstreamer-devel mailing list