Error: gst-resource-error-quark

hello everyone

when we run to detection module in GitHub - hailo-ai/hailo-rpi5-examples as ssh command line by this command

python basic_pipelines/detection.py --input resources/detection0.mp4
we get this error :
python basic_pipelines/detection.py --input resources/detection0.mp4

Error: gst-resource-error-quark: Could not initialise Xv output (10), …/sys/xvimage/xvimagesink.c(1944): gst_xv_image_sink_open (): /GstPipeline:pipeline0/GstFPSDisplaySink:hailo_display/GstXvImageSink:xvimagesink0:

Could not open display (null)

Shutting down… Hit Ctrl-C again to force quit.

Hey @haldun,

It looks like the error you’re seeing, gst-resource-error-quark: Could not initialize Xv output, is occurring because the GStreamer pipeline is trying to use xvimagesink to display the video output, but there’s no display available since you’re running it over SSH.

1. Use fakesink for Headless Systems:

Since you’re running the script without a display, you can modify the pipeline to use fakesink, which discards the video output. This is useful if you only need the inference to run without viewing the output:

python basic_pipelines/detection.py --input resources/detection0.mp4 --output fakesink

Alternatively, modify the script to replace xvimagesink with fakesink like this:

sink = Gst.ElementFactory.make("fakesink", "sink")

2. Use xvfb (X Virtual Framebuffer):

If you need to simulate a display, you can use Xvfb to create a virtual framebuffer. Here’s how:

  1. Install Xvfb:
    sudo apt-get install xvfb
    
  2. Run it before your script:
    Xvfb :99 -screen 0 1024x768x24 &
    export DISPLAY=:99
    
  3. Then run the detection script as usual.

3. Use autovideosink:

You can also use autovideosink, which automatically selects the best video sink. Modify the script to use this:

sink = Gst.ElementFactory.make("autovideosink", "sink")

4. Check Display Settings:

If you’re trying to use a display and encountering this issue, check that the DISPLAY environment variable is set correctly:

echo $DISPLAY

If it’s empty, try setting it to :0:

export DISPLAY=:0

Let me know if this helps or if you need further assistance!

Best regards,
Omri