1

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?

mpromonet
  • 11,326
  • 43
  • 62
  • 91
JonasVautherin
  • 7,297
  • 6
  • 49
  • 95

1 Answers1

2

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
JonasVautherin
  • 7,297
  • 6
  • 49
  • 95
  • 1
    Your command leads to `ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Device '/dev/video0' is not a output device.` on my machine. Why is it so? I am trying to redirect a video to `/dev/video0` – user123456 Oct 16 '16 at 23:58
  • 1
    For 1.0, `gst-launch-1.0 filesrc location="test.mkv" ! decodebin ! videoconvert ! videoscale ! videoconvert ! v4l2sink device=/dev/video0`. – Mateen Ulhaq Jul 18 '18 at 12:00