Search code examples
raspberry-pigstreamerraspbiangstreamer-1.0

gstreamer + raspivid framerate control


I'm using following command to stream video from rapsberry pi:

raspivid -t 0 -o - | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=<host> port=<port>

And capturing:

gst-launch-1.0 udpsrc port=<port> ! application/x-rtp, encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink sync=false

Now I want to reduce streaming video framerate. I found out that -fps argument of raspivid command doesn't work as I expected (running raspivid -t 0 -fps 15 -o - will not change output video framerate). So I decided to change it using videorate gstreamer element:

raspivid -t 0 -o - | gst-launch-1.0 fdsrc ! h264parse ! omxh264dec ! videorate ! video/x-raw,framerate=15/1 ! omxh264enc ! rtph264pay config-interval=1 pt=96 ! udpsink host=<host> port=<port>

But the captured video has super high latency and framerate. Same effect when I'm trying to play video on raspberry without streaming:

raspivid -t 0 -o - | gst-launch-1.0 fdsrc ! h264parse ! omxh264dec ! videorate ! video/x-raw,framerate=15/1 ! videoconvert ! autovideosink

or event without framerate changing:

raspivid -t 0 -o - | gst-launch-1.0 fdsrc ! h264parse ! omxh264dec ! autovideosink

How can I change video framerate of h264 encoded video using gstreamer on raspbian?

Debian 8

gstreamer 1.4


Solution

  • You may change the framerate of camera output instead. Try this by adding -fps specification in raspivid:

    raspivid -t 0 -fps 10 -o - | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay config- 
    interval=1 pt=96 ! udpsink host=<host> port=<port>