python-sdks icon indicating copy to clipboard operation
python-sdks copied to clipboard

Can i somehow publish camera?

Open stepskop opened this issue 1 year ago • 8 comments

stepskop avatar Jan 23 '24 18:01 stepskop

Hey, this is not supported by the Python SDK yet. In the meantime you can use a library like OpenCV and forward the frames to an AudioSource

theomonnom avatar Feb 09 '24 15:02 theomonnom

Hey, this is not supported by the Python SDK yet. In the meantime you can use a library like OpenCV and forward the frames to an AudioSource

So there is not any way to cast image frames like live view?

stepskop avatar Feb 12 '24 23:02 stepskop

Hey, what do you mean by live view?

theomonnom avatar Feb 14 '24 20:02 theomonnom

Hey, what do you mean by live view?

I mean like live preview of camera. Lets say i have Raspberry Pi with camera at my doorstep, and i want access the camera via Livekit in app on mobile. In short, publish camera from Python LivekitSDK -> JS LivekitSDK. I think it is possible via OpenCV, but i was unable to create propper Livekit's VideoSource.

stepskop avatar Feb 20 '24 08:02 stepskop

@stepskop

This is my working snippet based on suggestions from others.

Basically:

  • Create a Livekit VideoSource
  • Create a OpenCV VideoCapture device
  • Continuously & manually read the capture device frames + write to VideoSource

Gist link: https://gist.github.com/maisonsmd/d9af7345dc6406d25f3b174de7c046b3

maisonsmd avatar Dec 22 '24 19:12 maisonsmd

@maisonsmd

Hi, thanks to your project file I’m able to stream video from raspberry to Livekit, can I ask you to give me some hint or better an example for stream also the audio track? I need to send and receive it. I have and USB microphone and speaker. Thanks for your support

nicolarigoni avatar Feb 12 '25 21:02 nicolarigoni

@nicolarigoni Uh I haven't experienced with audio tracks yet, might take a look at it later when I have time.

maisonsmd avatar Feb 16 '25 04:02 maisonsmd

@maisonsmd Thanks, I can give you a quick update, I successfully send audio but it’s not perfect (the problem is in CPU resources) and I’m trying to optimize the script. But I don’t know really how to subscribe to a track in order to have the audio to play on the speaker

nicolarigoni avatar Feb 16 '25 05:02 nicolarigoni