Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set-caps question #198

Open
ROBERT-MCDOWELL opened this issue Nov 25, 2018 · 7 comments
Open

set-caps question #198

ROBERT-MCDOWELL opened this issue Nov 25, 2018 · 7 comments

Comments

@ROBERT-MCDOWELL
Copy link

ROBERT-MCDOWELL commented Nov 25, 2018

I just created a video device with

$ sudo modprobe v4l2loopback devices=1 exclusive_caps=1 video_nr=1card_label=mysink

tried to set it like this

$ sudo v4l2loopback-ctl set-caps "video/x-raw,format=yuv, width=640, height=480" /dev/video1

but I get

WARNING: erroneous pipeline: could not link videotestsrc0 to v4l2sink0, neither element can handle caps video/x-raw, format=(string)yuv, width=(int)640, height=(int)480
output to /dev/video1 failed

any idea? thanks

@ROBERT-MCDOWELL
Copy link
Author

machine info: Fedora 27 64bits
kernel 4.19.1-rt3
v4l2loopback version: 0.12.0

@umlaeute
Copy link
Owner

that doesn't seem to be a valid gstreamer-1.0 caps-string, the format yuv does not exist.

try something like UYVY instead.

@ROBERT-MCDOWELL
Copy link
Author

ROBERT-MCDOWELL commented Nov 25, 2018

ok thanks now I get

$ v4l2loopback-ctl set-caps "video/x-raw,format=UYVY, width=640, height=480" /dev/video1
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Device '/dev/video1' is not a output device.
Additional debug info:
v4l2_calls.c(642): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0:
Capabilities: 0x85208000
Setting pipeline to NULL ...
Freeing pipeline ...
output to /dev/video1 failed

@lynn901213
Copy link

lynn901213 commented Jun 3, 2020

Is it possible for v4l2loopback device to accept mjpeg as input? I tried to set caps like
v4l2loopback-ctl set-caps "image/jpeg, width=1280, height=720, fps=30/1" /dev/video1
where /dev/video1 is my v4l2loopback device. It seems like it is using gstreamer videotestsrc as the pipeline video src for setting the caps, and
gst-inspect-1.0 videotestsrc shows videotestsrc only accepts paddings as video/x-raw.
My question here would be, can we set mjpeg as the format for v4l2loopback device?

@umlaeute
Copy link
Owner

umlaeute commented Jun 3, 2020

sure. you can. the current behaviour simply a limitation of the v4l2loopback-ctl script (or rather, as you noted, the underlying videotestsrc element).

you can manually change the output-format by running a pipeline like:

gst-launch-1.0 videotestsrc num-buffers=1 ! "video/x-raw, width=1280, height=720, fps=30/1" ! avenc_mjpeg ! v4l2sink device=/dev/video1

Repository owner deleted a comment from ensisoft Jun 3, 2020
@nicola-sorace
Copy link

nicola-sorace commented Nov 6, 2020

I'm getting the same error as @ROBERT-MCDOWELL above:

$ sudo v4l2loopback-ctl set-caps "video/x-raw,format=UYVY, width=1920, height=1200" /dev/video0
Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Device '/dev/video0' is not a output device.
Additional debug info:
../gst-plugins-good/sys/v4l2/v4l2_calls.c(636): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0:
Capabilities: 0x5208000
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...
output to /dev/video0 failed

Edit:
Looks like this was solved by removing the exclusive_caps=1 option when starting the v4l2loopback kernel module.

@103sbavert
Copy link

I'm getting the same error as @ROBERT-MCDOWELL above:

$ sudo v4l2loopback-ctl set-caps "video/x-raw,format=UYVY, width=1920, height=1200" /dev/video0
Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0: Device '/dev/video0' is not a output device.
Additional debug info:
../gst-plugins-good/sys/v4l2/v4l2_calls.c(636): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0:
Capabilities: 0x5208000
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...
output to /dev/video0 failed

Edit: Looks like this was solved by removing the exclusive_caps=1 option when starting the v4l2loopback kernel module.

Is there a way to prevent this behavior without removing that option? I need that option for Discord and Chrome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants