- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does the stream_infer example works on the integrated webcam of a laptop because i cant get it to work..
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @GoldenWings,
stream_infer does work on integrated webcams as long as its a video for linux device. Also, if you are running it on Raspberry Pi you will need to change one line of code, the exact line is commented in stream_infer.py. Finally, you need to have these gstreamer packages installed (they might not all be mandatory, but when you install all of them it runs):
gstreamer1.0-libav
gstreamer1.0-plugins-bad-faad
gstreamer1.0-plugins-bad-videoparsers
Neal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@neal_at_intel Thank you for your reply,
Actually i've all these packages installed on ubuntu in my VM
and still not works it hangs, please take a look at this screenshot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@GoldenWings, I didn't realize you were running withing a VM. The screen shot looks similar to the issue of missing gstreamer packages, but must be something else if you have those installed. Does the built in cheese application work in the vm? If cheese works then the next thing I'd try to to is verify that gstreamer in general works in the VM and then that gstreamer works with the webcam as the video source.
Neal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@neal_at_intel
Yes cheese works in the vm also i've tried the following code using open cv and it works
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@neal_at_intel how would i verify if gstreamer works?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@GoldenWings,
To start, see if you can play video files with gst-launch program. You can find some sample command lines here: https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/using.html.
Then you can also check that you can stream the v4l2src camera device /dev/video0 . This page has some good sample commandlines for that: https://petehouston.com/2015/12/23/play-webcam-using-gstreamer/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
I am having a problem when trying to stream v4l2src from the example you provided:
> Setting pipeline to PAUSED …
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: Could not initialise Xv output
Additional debug info:
xvimagesink.c(1760): gst_xv_image_sink_open (): /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
No Xv Port available
Setting pipeline to NULL ...
Freeing pipeline ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi GoldenWings, I had the exact same problem as you with the same setup. I did end up getting stream_infer.py
working in a VM.
I think it comes down to the fact that in the VM Xv does not find any adapters present. You can verify this by checking xvinfo
. This is what I see:
[~]$ xvinfo
X-Video Extension version 2.2
screen #0
no adaptors present
So this makes me think the video sink xvimagesink
will not work in our situation. Ok cool let's use ximagesink
instead. For ximagesink
to understand what is coming out of the source it needs to pass through videoconvert
(I am not sure why, I actually have no idea how gstreamer works, but this is what I have pieced together from various forums posts and stack overflow answers).
You can test this by trying:
$ gst-launch-1.0 v4l2src ! videoconvert ! ximagesink
It should launch a window which displays the output of your webcam.
Great!
So now you need to modify the Python script stream_infer.py
to use the new parameters.
I changed the value for SINK_NAME
as well as for the view_launch_str
as per below:
...
SINK_NAME="ximagesink" # use for x86-64 platforms
...
...
view_launch_str = "\
queue max-size-buffers=2 leaky=downstream ! videoconvert ! \
%s name=%s" % (SINK_NAME, GST_VIEW_NAME)
...
I can then run python3 stream_infer.py
and I am able to launch the webcam view and begin detecting objects :)
I hope this helps, good luck.
d.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page