Reputation: 41
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:
udpsink
.I hoped to achieve this with appsrc/appsink:
Create a common webcam component that inside has a pipeline:
v4l2src ! video/x-raw,width=640,height=480 ! appsink
,
and has a method setupAppSrc
for other components that need to use it.
PreviewSelf
has a pipeline:
appsrc ! videoconvert ! xvimagesink
.
VideoSender
has a pipeline:
appsrc ! videoconvert ! x264enc ! h264parse ! rtph264pay ! application/x-rtp, media=video, encoding-name=H264, payload=96 ! udpsink
.
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
Reputation: 7383
Your queues are too small for your tee
pipeline. Increase them or use tune=zerolatency
for the x264enc
element.
Upvotes: 0