[gst-devel] controlling framerate for custom src plugin

Tim-Philipp Müller t.i.m at zen.co.uk
Sun Dec 27 21:04:28 CET 2009


On Sun, 2009-12-27 at 17:44 +0100, Roland Hermans wrote:

Hi Roland,

> 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 ! ... ?


> It is able to capture the JPEG images from the IP camera and send them as
> buffers to jpegdec (the next element in the pipeline) but for some reason
> 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.


> After some more reading of the manuals and checking sources of e.g.
> videotestsrc and v4lsrc I added timestamps to the buffers but that did not
> help: the stream was freezing at the first frame but capturing is still done
> at high speed. I also tried forcing a framerate 1 fps with caps. Images now
> appear between 3 and 4 seconds, but capturing remains at high speed.

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.


> 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

(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.)

Cheers
 -Tim






More information about the gstreamer-devel mailing list