Godot Version
v4.4.1.stable.official [49a5bc7b6]
Question
Using the CameraSever on linux to render webcam on godot.
func set_camera_texture():
if CameraServer.get_feed_count() > 0:
var feed:CameraFeed = CameraServer.get_feed(0)
var formats:Array = feed.get_formats()
for i in range(formats.size() - 1, -1, -1):
if formats[i]["width"] == 1920 && formats[i]["height"] == 1080 && formats[i]["frame_denominator"] == 60:
feed.set_format(i, {"output": "copy"})
print(JSON.stringify(formats[i], "\t"))
break
camera_texture = CameraTexture.new()
if feed.get_id() != null:
camera_texture.camera_feed_id = feed.get_id()
camera_texture.camera_is_active = true
texture = camera_texture
return
Able to view the camera feed, however when
camera_texture.camera_is_active = true
the following error prints
ERROR: Condition "err" is true. Returning: Ref<Image>()
at: _jpegd_mem_loader_func (modules/jpg/image_loader_jpegd.cpp:129)
ERROR: Condition "image.is_null()" is true. Returning: ERR_PARSE_ERROR
at: _load_from_buffer (core/io/image.cpp:4153)
ERROR: Condition "err" is true. Returning: Ref<Image>()
at: _jpegd_mem_loader_func (modules/jpg/image_loader_jpegd.cpp:129)
ERROR: Condition "image.is_null()" is true. Returning: ERR_PARSE_ERROR
at: _load_from_buffer (core/io/image.cpp:4153)
ERROR: Condition "err" is true. Returning: Ref<Image>()
at: _jpegd_mem_loader_func (modules/jpg/image_loader_jpegd.cpp:129)
ERROR: Condition "image.is_null()" is true. Returning: ERR_PARSE_ERROR
at: _load_from_buffer (core/io/image.cpp:4153)
ERROR: Condition "err" is true. Returning: Ref<Image>()
at: _jpegd_mem_loader_func (modules/jpg/image_loader_jpegd.cpp:129)
ERROR: Condition "image.is_null()" is true. Returning: ERR_PARSE_ERROR
at: _load_from_buffer (core/io/image.cpp:4153)
ERROR: Condition "err" is true. Returning: Ref<Image>()
at: _jpegd_mem_loader_func (modules/jpg/image_loader_jpegd.cpp:129)
ERROR: Condition "image.is_null()" is true. Returning: ERR_PARSE_ERROR
at: _load_from_buffer (core/io/image.cpp:4153)
After this, the camera texture loads fine. But i want handle this error from printing on camera active.