#!/usr/bin/env python # coding: utf-8 # # ipywebrtc: Video streaming # # ## https://github.com/maartenbreddels/ipywebrtc # # # ipywebrtc is a jupyter interactive widget library which provides video streaming to the Jupyter notebook. # # - MIT Licensed # # It provides means to capture videos/images/audio from the user camera, or from other widgets like a `Video` or an ipyvolume plot. # # **Installation:** # # ```bash # conda install -c conda-forge ipywebrtc # ``` # In[ ]: import ipywebrtc as webrtc import ipyvolume as ipv import ipywidgets as widgets # In[ ]: video = webrtc.VideoStream.from_file('Big.Buck.Bunny.mp4') # In[ ]: video # In[ ]: camera = webrtc.CameraStream() # In[ ]: camera # In[ ]: fig = ipv.figure(render_continuous=True) back = ipv.plot_plane("back", texture=video) right = ipv.plot_plane("right", texture=camera) ipv.show() # In[ ]: right.texture = fig # In[ ]: room = webrtc.chat(room='scipy2018', stream=fig) # In[ ]: back.texture = room.streams[1] # In[ ]: recorder = webrtc.VideoRecorder(stream=fig, filename='record') recorder # In[ ]: recorder.video.value[:1000] # In[ ]: room.close() camera.close() video.close() # In[ ]: