Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Alert: Beginning Tuesday, June 25th, we will be freezing this site and migrating the content and forums to our new home at Check it out now!

stream_infer example

Does the stream_infer example works on the integrated webcam of a laptop because i cant get it to work..


  • 8 Comments sorted by Votes Date Added
  • @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.

  • @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)
        # Capture frame-by-frame
        ret, frame =
        # Our operations on the frame come here
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        # Display the resulting frame
        if cv2.waitKey(1) & 0xFF == ord('q'):
    # When everything done, release the capture
  • @neal_at_intel how would i verify if gstreamer works?

  • @GoldenWings,

    To start, see if you can play video files with gst-launch program. You can find some sample command lines here:

    Then you can also check that you can stream the v4l2src camera device /dev/video0 . This page has some good sample commandlines for that:

  • 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 ...

  • Hi GoldenWings, I had the exact same problem as you with the same setup. I did end up getting 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.


    So now you need to modify the Python script 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 and I am able to launch the webcam view and begin detecting objects :)

    I hope this helps, good luck.


  • 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 Finally, you need to have these gstreamer packages installed (they might not all be mandatory, but when you install all of them it runs):



  • @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.


Sign In or Register to comment.