Search code examples
gstreamervideo-processingplaybackv4l2loopbackplaybin2

GStreamer Playbin video speed is too fast


I am trying to create virtual web camera using GStreamer and v4l2loopback. The problem is that I want to use Playbin but the video speed is too fast when I use it. For instance, it happens when I execute the following command:

gst-launch-1.0 -v playbin uri=file:/vagrant/test.avi 
video-sink="videoconvert 
            ! videoscale 
            ! video/x-raw,format=YUY2,width=320,height=320 
            ! v4l2sink device=/dev/video0"

Adding "framerate=20/1" to the caps throws "Not negotiated error" while setting it to "30/1" works but doesn't help to fix the issue with the speed.

On the other hand, I am getting normal speed when executing the following command:

 gst-launch-1.0 -v filesrc location=/vagrant/test.avi 
       ! avidemux 
       ! decodebin 
       ! videoconvert 
       ! videoscale 
       ! "video/x-raw,format=YUY2,width=320,height=320" 
       ! v4l2sink device=/dev/video0

I tried a lot of combinations with filters from the last example with the Playbin but none of them helped.

Any help would be highly appreciated!


Solution

  • The problem was with the virtual machine running on top of the VirtualBox. To be more precise - I had 3d acceleration turned on, which resulted in all the videos to play at speed 2x.

    Turning off 3d acceleration by setting --accelerate3d=off helped to solve the issue.