videorate
This element takes an incoming stream of timestamped video frames. It will produce a perfect stream that matches the source pad's framerate.
The correction is performed by dropping and duplicating frames, no fancy algorithm is used to interpolate frames (yet).
By default the element will simply negotiate the same framerate on its source and sink pad.
This operation is useful to link to elements that require a perfect stream. Typical examples are formats that do not store timestamps for video frames, but only store a framerate, like Ogg and AVI.
A conversion to a specific framerate can be forced by using filtered caps on the source pad.
The properties in, out, duplicate and drop can be read to obtain information about number of input frames, output frames, dropped frames (i.e. the number of unused input frames) and duplicated frames (i.e. the number of times an input frame was duplicated, beside being used normally).
An input stream that needs no adjustments will thus never have dropped or duplicated frames.
When the silent property is set to FALSE, a GObject property notification will be emitted whenever one of the duplicate or drop values changes. This can potentially cause performance degradation. Note that property notification will happen from the streaming thread, so applications should be prepared for this.
The property rate allows the modification of video speed by a certain factor. It must not be confused with framerate. Think of rate as speed and framerate as flow.
Example pipelines
gst-launch-1.0 -v uridecodebin uri=file:///path/to/video.ogg ! videoconvert ! videoscale ! videorate ! video/x-raw,framerate=15/1 ! autovideosink
Decode a video file and adjust the framerate to 15 fps before playing. To create a test Ogg/Theora file refer to the documentation of theoraenc.
gst-launch-1.0 -v v4l2src ! videorate ! video/x-raw,framerate=25/2 ! theoraenc ! oggmux ! filesink location=recording.ogg
Capture video from a V4L device, and adjust the stream to 12.5 fps before encoding to Ogg/Theora.
gst-launch-1.0 -v uridecodebin uri=file:///path/to/video.ogg ! videoconvert ! videoscale ! videorate ! video/x-raw,framerate=1/5 ! jpegenc ! multifilesink location=snapshot-%05d.jpg
Decode a video file and save a snapshot every 5 seconds as consecutively numbered jpeg file.
Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBaseTransform ╰──videorate
Factory details
Authors: – Wim Taymans
Classification: – Filter/Effect/Video
Rank – none
Plugin – videorate
Package – GStreamer Base Plug-ins
Pad Templates
sink
video/x-raw(ANY):
video/x-bayer(ANY):
image/jpeg(ANY):
image/png(ANY):
src
video/x-raw(ANY):
video/x-bayer(ANY):
image/jpeg(ANY):
image/png(ANY):
Properties
average-period
“average-period” guint64
Arrange for maximum framerate by dropping frames beyond a certain framerate, where the framerate is calculated using a moving average over the configured.
Flags : Read / Write
Default value : 0
drop-only
“drop-only” gboolean
Only drop frames, no duplicates are produced.
Flags : Read / Write
Default value : false
drop-out-of-segment
“drop-out-of-segment” gboolean
Drop all frames that are out of segment
Flags : Read / Write
Default value : false
Since : 1.24
max-closing-segment-duplication-duration
“max-closing-segment-duplication-duration” guint64
Limits the maximum duration for which the last buffer is duplicated when finalizing a segment or on EOS. When receiving an EOS event or a new segment, videorate duplicates the last frame to close the configured segment (copying the last buffer until its stop time (or start time for reverse playback) is reached), this property ensures that it won't push buffers covering a duration longer than specified.
Flags : Read / Write
Default value : 1000000000
Since : 1.22
max-duplication-time
“max-duplication-time” guint64
Duplicate frames only if the gap between two consecutive frames does not exceed this duration.
Flags : Read / Write
Default value : 0
Since : 1.16
max-rate
“max-rate” gint
maximum framerate to pass through
Flags : Read / Write / Construct
Default value : 2147483647
new-pref
“new-pref” gdouble
Value indicating how much to prefer new frames (unused)
Flags : Read / Write
Default value : 1
rate
“rate” gdouble
Factor of speed for frame displaying
Flags : Read / Write
Default value : 1
Since : 1.12
silent
“silent” gboolean
Don't emit notify for dropped and duplicated frames
Flags : Read / Write
Default value : true
skip-to-first
“skip-to-first” gboolean
Don't produce buffers before the first one we receive.
Flags : Read / Write
Default value : false
The results of the search are