View notebook on Github Download

Video exampleΒΆ

This example depends on imageio and imageio-ffmpeg.

Plays a video as fast as it can. This will be quite a slow playback on localhost. On a remote server it will be even slower.

[1]:
import imageio.v3 as iio
import numpy as np
from jupyter_rfb import RemoteFrameBuffer

r = iio.imiter("imageio:cockatoo.mp4")

class VideoPlayer(RemoteFrameBuffer):

    def get_frame(self):
        try:
            res = next(r)
        except StopIteration:
            return None
        else:
            v.request_draw()
            return res



v = VideoPlayer(max_buffered_frames=3)
v
[1]:
snapshot
[ ]: