godotengine / godot-proposals

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

Streaming from an HTTP-URL in VideoStreamPlayer or VideoStream #10682

Open velnias75 opened 1 week ago

velnias75 commented 1 week ago

Describe the project you are working on

I am working on a Web/HTML5 virtual museum to exhibit my Blender art and animations.

Describe the problem or limitation you are having in your project

I want to host my animations on a webserver and streaming from the URL into my Godot virtual museum.

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

Currently I can only use video files loaded from a filesystem. But I don't want to include the videos directly into the project. I want to let them start to stream on a user interaction. Behind the scenes I want to get it streamed from a web hosted video file.

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

Adding a property to either VideoStream or VideoStreamPlayer giving an URL. Godot already has classes to handle HTTP, so instead of retrieving it from the web IMO could be done with an abstraction layer abstracting both a filesystem and a web request

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

-

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

-

fire commented 1 week ago

See my proposal using nut to transfer videos: https://github.com/godotengine/godot-proposals/issues/4710

See update to video player via ffmpeg. https://github.com/Faless/godot-video-reference

See used in production video player. https://github.com/EIRTeam/EIRTeam.FFmpeg

velnias75 commented 1 week ago

See my proposal using nut to transfer videos: #4710

See update to video player via ffmpeg. https://github.com/Faless/godot-video-reference

See used in production video player. https://github.com/EIRTeam/EIRTeam.FFmpeg

It needs to work in a web/html5 app. So I need to install ffmpeg on my host (hosting the Godot binary)?

fire commented 1 week ago

Here's my plan for streaming desktop video for a virtual worlds social game (vr).

  1. ??? encode using the webbrowser's av1 or mp4 optimal video encoders
  2. Get audio and video buffers (probably av1 and mp4)
  3. Send rtmp to transcoding server https://github.com/JamiePhonic/rtmps-hls-server
  4. At this point you are like twitch.tv so expect corresponding problems with bandwidth costs and DMCA safe harbour
  5. Use some way of multiplayer synchronizing the slider of the audio using the "dsptime" https://github.com/godotengine/godot-proposals/issues/1151 Maybe https://gery.casiez.net/1euro/
  6. ??? decode using the webbrowser's av1 or mp4 optimal video encoders