phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.37k stars 1.43k forks source link

Request: browser-to-browser implementation #386

Open howdood opened 2 years ago

howdood commented 2 years ago

Hi - absolutely love this! I've got it working perfectly with a source piped via ffmpeg, but what would be really cool would be a client-side only javascript sender so we could have a pure browser-to-browser implementation. It's pretty straightforward to capture a camera stream using getUserMedia() and then get the image data either via MediaRecorder or scraping from an html5 canvas - but I'm stuck on how to convert the data into mpegts on the client side and what (if any) handshake is required to initialise a connection with the server websocket.

Any hints gratefully received - happy to contribute a working version to the project if I ever manage one!

bil-ash commented 2 years ago

@howdood Did you find amy mpeg encoder? Even I am interested in a lightweight(non-ffmpeg) mpeg1 encoder -either in js or in C(which can be compiled to wasm) for using in browser to convert html canvas and webaudio input to mpeg1 video. @phoboslab

howdood commented 2 years ago

HI @bil-ash - I made something a bit different which works browser-to-browser here but it's a fairly basic implementation: there's no media conversion involved, since it basically sends the raw mediaStream blob over websockets. Not sure if that's what you're looking for but it's always fun to play with getUserMedia()!

bil-ash commented 2 years ago

Just had a look at your implementation, sadly it is not what I am looking for. As mentioned clearly in my earlier comment, I need an encoder and not a method of transferring blobs.