Search code examples
raspberry-pigstreamerframe-rate

Gstreamer videomixer Very low framerate


I am trying to composite three streams coming from three Rapsberry PI.

As soon as I join two streams together using the videomixer plugin, I get a message ending with:

Pipeline:pipeline0/GstOSXVideoSink:osxvideosink0: There may be a timestamping problem, or this computer is too slow.

Strangely, my task monitor only indicates about 15%CPU usage for gst

With the three streams, the framerate becomes unusable. I would expect my I7 macbook to be able to handle this without problem....

Here is the code I am using for the mixing, in this case just one stream(/sink?). Can anyone tell me whether there is an obvious mistake ? Or where I should look for the bottleneck and improve it ? Thanks !

gst-launch-1.0 videomixer name=m sink_1::xpos=400 sink_2::ypos=300 ! autovideosink \
-v udpsrc port=9000 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264'! rtph264depay ! video/x-h264,width=400,height=300,framerate=30/1 ! h264parse ! avdec_h264 ! videoconvert ! m. \
-v udpsrc port=9001 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' ! rtph264depay ! video/x-h264,width=400,height=300,framerate=30/1 ! h264parse ! avdec_h264 ! videoconvert ! m. \
-v udpsrc port=9002 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' ! rtph264depay ! video/x-h264,width=400,height=300,framerate=30/1 ! h264parse ! avdec_h264 ! videoconvert !  m.

Here is the code I use to send the streams from the RPI Camera.

raspivid -n -w 640 -h 480 -t 0 -o - \
| gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay \ 
config-interval=10 pt=96 ! udpsink host=192.168.1.3 port=9000

Solution

  • Try adding queue elements for each video decode and sync=false to the video sink.

    gst-launch-1.0 videomixer name=m sink_1::xpos=400 sink_2::ypos=300 ! videoconvert ! ximagesink sync=false \
    udpsrc port=9000 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264 ! rtph264depay ! video/x-h264,width=400,height=300 ! h264parse ! avdec_h264 ! queue ! videoconvert ! m. \
    udpsrc port=9001 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264 ! rtph264depay ! video/x-h264,width=400,height=300 ! h264parse ! avdec_h264 ! queue ! videoconvert ! m. \
    udpsrc port=9002 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264 ! rtph264depay ! video/x-h264,width=400,height=300 ! h264parse ! avdec_h264 ! queue ! videoconvert !  m.
    

    Now my disclaimer to this would be that I'm unsure if the video will be properly smooth and in sync, but it seems to look pretty good.

    Also, on raspivid, you'll probably want to add the config-interval property to the rtph264pay element.

    raspivid -n -w 640 -h 480 -t 0 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 ! multiudpsink clients=192.168.1.3:9000,192.168.1.3:9001,192.168.1.3:9002