Streamlit WebRTC

raw JSON →
0.64.6 verified Fri May 01 auth: no python

Real-time video and audio processing for Streamlit apps via WebRTC. Current version 0.64.6, requires Python >=3.10. Active development with frequent releases.

pip install streamlit-webrtc
error ImportError: cannot import name 'WebRtcStreamer' from 'streamlit_webrtc'
cause Using wrong case (WebRtcStreamer instead of webrtc_streamer) or wrong import path.
fix
Use from streamlit_webrtc import webrtc_streamer (all lowercase).
error TypeError: 'NoneType' object is not callable
cause `video_transformer_factory` returned None, or no factory was provided.
fix
Ensure video_transformer_factory returns a valid transformer instance (e.g., MyTransformer()).
error RuntimeError: Could not obtain user media
cause Browser requires HTTPS (or localhost) for getUserMedia.
fix
Run on localhost (default with streamlit run) or deploy with HTTPS.
breaking In v0.50.0, the async-to-sync transformation changed; `video_transformer_factory` must return a transformer instance, not a coroutine. Older patterns using async functions break.
fix Ensure `video_transformer_factory` returns a synchronous transformer object; do not use async/await in the factory.
gotcha The `webrtc_streamer` function is not a class; calling `WebRtcStreamer(...)` (capital W) raises ImportError.
fix Use `from streamlit_webrtc import webrtc_streamer` (lowercase).
gotcha Streamlit WebRTC only works over HTTPS (or localhost). Deploying over HTTP results in `Failed to access media` errors.
fix Use HTTPS in production or run locally via `streamlit run` (which uses localhost).
deprecated The `audio_frame_callback` parameter is deprecated since v0.50.0 in favor of `audio_transformer_factory`.
fix Replace `audio_frame_callback` with `audio_transformer_factory` that returns an audio transformer.

Minimal app that displays a webcam feed with a no-op video transformer.

import streamlit as st
from streamlit_webrtc import webrtc_streamer, VideoTransformerBase

class MyTransformer(VideoTransformerBase):
    def transform(self, frame):
        return frame

webrtc_streamer(key="example", video_transformer_factory=MyTransformer)