Streaming Local Video

Hello Everyone,

I have a very simple panel created as a dashboard to control a test rig. I have two pages, the first has some gauges, indicators and input for controls. The second page I would like to use to display live video from a 30fps USB webcam attached to the local computer running the panel. I have looked into some of the widgets like video stream and video but neither of them seem to work for what I am trying to accomplish. Is there a simple way to do this that I am missing?

Thanks so much for your help!

Did you grant permissions to run them? Also check the browser console for errors.

Maybe I did not explain it correctly:

PC 1 (Server): Running the panel and some back-end processes to control the rig. Has a USB webcam plugged into it.

PC 2 (Client): View panel webapp using LAN ip. No webcam attached

I want to be able to view the webcam on that server with any client viewing the panel. It is my understanding that the video stream widget is only used to get video data from the client’s camera.

I don’t think that’s possible based on my understanding, unless you serve/host the video on some endpoint.

I believe it should be possible with OpenCV. The basic idea would be to Capture video frames on PC1 with OpenCV as described in Displaying a webcam feed using OpenCV and Python

  • Run the capture loop in a separate thread.
  • Convert each frame to a Pillow image or base64 png url
  • Save it to a parameter on a Parameterized class or to a pn.rx reactive value.
  • use the parameter or reactive expression as a reference in an Image pane.
  • Include the Image pane in your app.

It would probably require some experimentation to get it really performant.

There is a working example here Add server video stream tutorial by MarcSkovMadsen · Pull Request #6727 · holoviz/panel ( I hope it can make it into the Panel docs.