Feed a video file to v4l2sink using gstreamer

7.5k views Asked by At

I would like to feed a video file to my virtual video device using gstreamer and v4l2loopback.

Using videotestsrc, something like this works (i.e. I can open my virtual device from VLC):

gst-launch -v videotestsrc ! queue ! decodebin2 name=dec ! queue ! ffmpegcolorspace ! v4l2sink device=/dev/video0

However, the exact same code does not work with my video file:

gst-launch filesrc location=~/Documents/my_video.ogv ! queue ! decodebin2 name=dec ! queue ! ffmpegcolorspace ! v4l2sink device=/dev/video0

It actually gets stuck in the "PREROLLING" phase:

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

Can anybody see why? Do I miss some conversion between filesrc and decodebin2?

1

There are 1 answers

2
JonasVautherin On BEST ANSWER

I don't know why exactly, but I was missing the ! videoscale ! step. And the ! queue !'s are apparently not necessary.

Here is the working line:

gst-launch filesrc location=~/Documents/my_video.ogv ! decodebin2 ! ffmpegcolorspace ! videoscale ! ffmpegcolorspace ! v4l2sink device=/dev/video0