Skip to content

basic_bot.commons.mjpeg_video

MjpegVideo Objects

class MjpegVideo()

This class provides support for streaming basic_bot camera frames via aiohttp and their MultipartWriter class.

Motion Jpeg (MJPEG) works as the src attribute of a plain html tag, but it has limits such as no audio can get latency intensive. There is also the need to covert each our native gbr frame to jpg before sending.

Support for MJPEG is included in the vision service via the /video_feed endpoint.

The vision service also supports WebRTC video which requires a bit more effort to set up on the client side, it provides features such as audio track and low latency and support for low bandwidth usage that make WebRTC a better choice for streaming video to a browser (IMO)

gen_rgb_video

def gen_rgb_video(camera: BaseCamera) -> Generator[bytes, None, None]

Video streaming generator function.

video_feed

@flaskApp.route("/video_feed")
def video_feed() -> Response

Video streaming route. Put this in the src attribute of an img tag.