How to write/display video frame into /dev/fb1 with open('/dev/fb1', 'rb+')?
I am trying to write a video frame into Linux framebuffer fb1. My code is
cap = cv2.VideoCapture(0)
while cap.is_Opened():
ret, frame = cap.read()
with open('/dev/fb1', 'rb+') as buf:
buf.write(frame)
cap.release()
so now i can display my video frame on framebuffer fb1, but is not clean please see the output video frame in below picture. I am also open to suggestion if any better(or efficient) way to do it.
- I already used mmap.mmap to write into the frame buffer 1, but it is giving me the same output.
- I also tried using
os.environ['SDL_FBDEV'] = '/dev/fb1'
in a different thread so that i can use two framebuffers at a same time. (here I can get a clear image but I can use only one framebuffer which I do not want to do) - I have also tried converting video frame into bytearray()
this is my one of the ideas to solve my problem working with two framebuffers simultaneously. the black area will be used for display GUI by framebuffer 0 by os.environ['SDL_FBDEV'] = '/dev/fb0'
for more information please see my old question https://stackoverflow.com/questions/5...
Thank you in advanced
you should try to find out the required pixel format for your framebuffer (from here it looks, like it expects 32bit instead of the 24bits, that come from the VideoCapture)
might help