A new version of streamlit-webrtc, v0.40.0 has been released!
This release includes a new big feature, class-less callback.
To define callbacks, you no longer need to create processor classes. Instead, just pass a function!
def video_frame_callback(frame):
img = frame.to_ndarray(format="bgr24")
# ... Image processing, or whatever you want ...
return av.VideoFrame.from_ndarray(img, format="bgr24")
webrtc_streamer(key="example", video_frame_callback=video_frame_callback)
See the samples in the tutorial on the README↓