CmykCmyk
CmykCmyk

Reputation: 41

GStreamer. How to share v4l2src?

I didn't know that using one webcam with multiple programs at the same time was a problem.

My program has two components that use v4l2src:

  1. Preview yourself;
  2. Sending to udpsink.

I hoped to achieve this with appsrc/appsink:

appsink has a signal new-sample. Let's connect to it, receive the data using gst_app_sink_pull_sample and send it to the installed GstAppSrc using gst_app_src_push_sample.

Possible create multiple PreviewSelf and they will work well. But as soon as I add a VideoSender, everything freezes.

I tried to do:
gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480 ! tee name=mux \
mux. ! queue ! videoconvert ! xvimagesink \
mux. ! queue ! videoconvert ! x264enc ! fakesink
And It freezes too.

Tell me, please, how several components can use a webcam?

Upvotes: 0

Views: 214

Answers (1)

Florian Zwoch
Florian Zwoch

Reputation: 7383

Your queues are too small for your tee pipeline. Increase them or use tune=zerolatency for the x264enc element.

Upvotes: 0

Related Questions