Decode an Image sent over UDP from Python/Opencv to Godot for Texture data use

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kio

I have UDP communication working from Godot where Godot launches an external python script that processes incoming video with OPENCV from a ESP-32CAM module. The python UDP server script successfully sends and receives data to/from Godot UDP server.

(Have tried different protocols each with major issues - UDP I can get working, though not the most reliable.)

(I have been able to use image data sent from the ESP32-CAM over WebSocket’s in Godot. Processing the image with an OpenCV Module or using Godot Python is not a real thing yet. Also attempted a C# Mono variant with no success.)

The problem:
Formatting/sending image in Python that Godot can process from the UDP packet received.
My skull is bloody from hitting it against the wall on this.

Where I am at… looking for suggestions…

relevant UDP/OPENCV python script reference:

if not video_capture.isOpened():
        sys.exit('Video source not found...')
ret, frame =

frame = imutils.resize(frame, width=400)

#Send frame to Godot
#this is based on a python to python UDP video stream tutorial I found at 

encode, buffer = cv2.imencode('.jpg', frame, [cv2.IMWRITE_JPEG_QUALITY,80])
message = base64.b64encode(buffer)
s_sender.sendto(bytes(message), (HOST_IP, PORT_SEND))

relevent godot UDP/image script reference:

peerpacket = peers.get_packet()

var cam1texture = create_texture_from_pool_byte_array(peerpacket)

func create_texture_from_pool_byte_array(byte_array):
	var im =
    im.load_jpg_from_buffer(byte_array)   #<- Point of issue
	var im_tx =
	return im_tx
:bust_in_silhouette: Reply From: Kio

Wow - posted too soon

fix - DO NOT ENCODE TO Base64 just send encoded buffer

encode, buffer = cv2.imencode('.jpg', frame, [cv2.IMWRITE_JPEG_QUALITY,80])
s_sender.sendto(bytes(buffer), (HOST_IP, PORT_SEND))