I got a python script supposed to load a video. My Pi set up in headless mode and I would like not to use any X server for displaying the video but instead having the video displayed to the hdmi port. When I execute the script I got this error:
(frame:739): Gtk-WARNING **: cannot open display:
Here's the test script:
import cv2 cap = cv2.VideoCapture('/media/Videos/Full.mp4') speed = int(1000/23) #time in ms between two frames 23 is the number of fps while True: ret,frame = cap.read() cv2.imshow('frame',frame) if cv2.waitKey(speed) & 0xFF ==ord('q'): break cap.release() cv2.destroyAllWindows()
I installed these packages: raspberrypi.stackexchange.com/questions/43847/… to be able to execute the command startx, then I did export DISPLAY=:0 but still having the error message:
Gtk-WARNING **: cannot open display: :0.0
When I execute it on my laptop using pyCharm it works fine.