MainSilent / Discord-Screenshare

First ever discord video screenshare SELFBOT
297 stars 80 forks source link

2-in-1 Request: Subtitle support & streaming to other services that use RTMP #22

Closed phere-x closed 2 years ago

phere-x commented 2 years ago
  1. HTML5 supports adding subtitles (.VTT) using the <track> element. Allowing to specify a sub file location/link to include it would be great.

  2. Being able to stream to services like twitch that use RTMP could work much smoother than discord VC. I used to use ffmpeg -re to stream a video file in its native frame rate. But overlaying subtitles along with this meant I couldn't seek or the subs would not be in their proper time positions.

MainSilent commented 2 years ago

Currently I'm not able to spend that time since there are higher priority projects But If you like to contribute:

1- I'm not sure but the WebRTC only send the video and audio stream, If you add a track element it won't send the subtitle to other users, When I tried to implement that I realized it should be hardsub, We need to add a new command to get .srt file and base on their time set a variable in stream_inject.js, On play event it will draw the video element on a canvas and we can also add the variable text using ctx.fillText when requesting a new frame, Then you are hardsubbing on fly without rendering the video again, I actually have tried that with static text and it worked.

2- Bot uses the video element created in stream_inject.js line 12, For HLS stream we can add the plugin or use a video player that supports the RMTP stream.