godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Add MediaStream support to WebRTC for real-time video streaming #2553

Open theomonnom opened 3 years ago

theomonnom commented 3 years ago

Describe the project you are working on

A real-time webcam feed with WebRTC

Describe the problem or limitation you are having in your project

Godot's WebRTC implementation does not support MediaStream. There is already a proposal to implement mediastream for voice communications but not for video streams

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add support for MediaStream to the WebRTC implementation. Something that would send encoded video data from WebRTC and then be able to decode it

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Maybe use the existing CameraServer class and encode/decode the video streams in VP8 (Not VP9 since it consumes more CPU and is therefore a bad idea for real time on not very powerful devices, neither H264 because it is patented). The implementation of video streams should be similar to what Faless mentioned in this issue about adding voice communications: A class should be added to the core and the implementations of the JS and GDNative interfaces in the webrtc module

If this enhancement will not be used often, can it be worked around with a few lines of script?

I don't think so

Is there a reason why this should be core and not an add-on in the asset library?

I don't think it's possible without modifying the core

Calinou commented 3 years ago

We have a lot of issues with video playback and WebM decoding currently, so this will have to wait until video decoding is moved to GDNative for 4.0 or later.

mattkanwisher commented 1 year ago

Now that GD 4 is in beta does that mean the videoplayer is now native ?

Calinou commented 1 year ago

Now that GD 4 is in beta does that mean the videoplayer is now native ?

Not yet: https://github.com/godotengine/godot-proposals/issues/3286