Vanilagy / webm-muxer

WebM multiplexer in pure TypeScript with support for WebCodecs API, video & audio.
https://vanilagy.github.io/webm-muxer/demo
MIT License
197 stars 12 forks source link

comparison #37

Closed weepy closed 1 month ago

weepy commented 1 month ago

can you explain why this is better or different from "recordrtc" https://github.com/muaz-khan/RecordRTC ?

Vanilagy commented 1 month ago

Never heard of that library, but it seems to be a library for recording MediaStreams. You don't need to go to a library for that, you can simply use MediaRecorder. webm-muxer is a bit lower level, as you're not limited to recording real-time streams but can procedurally create a video offline (offline = not real time). webm-muxer also makes use of the (low-level) WebCodecs API, which MediaRecorder and the library you linked do not.

I originally built this library for a replay rendering system in my web game, exactly because MediaRecorder or any type of real-time stream recording thing did not suffice and was not what I needed. The replay renderer works offline, meaning it can render the replay at any resolution or framerate desireable, and it takes as long as it needs to for that. You can render at 8K 240FPS and you'll get a perfectly smooth video out.

If all you want to do is record some real-time media, like a microphone or a screen, MediaRecorder should suffice for that - no need to use any library for that.

Does this answer your question somewhat?

weepy commented 1 month ago

Heya thanks that makes sense. Thanks for the detailed response.

I'm actually rendering some pixi.js graphics and fragment shaders in a webgl canvas and rendering audio via the webaudio api. I want to record these off as little music/videos, but I do want to ensure there's no glitching - I was finding that recording the stream created a webm that popped a bit in safari. I'll have to experiment some more as I'm not sure what the best approach is ^_^ .

On Wed, May 29, 2024 at 1:56 PM Vanilagy @.***> wrote:

Never heard of that library, but it seems to be a library for recording MediaStreams. You don't need to go to a library for that, you can simply use MediaRecorder https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder. webm-muxer is a bit lower level, as you're not limited to recording real-time streams but can procedurally create a video offline (offline = not real time). webm-muxer also makes use of the (low-level) WebCodecs API, which MediaRecorder and the library you linked do not.

I originally built this library for a replay rendering system in my web game https://marbleblast.vaniverse.io/, exactly because MediaRecorder or any type of real-time stream recording thing did not suffice and was not what I needed. The replay renderer works offline, meaning it can render the replay at any resolution or framerate desireable, and it takes as long as it needs to for that. You can render at 8K 240FPS and you'll get a perfectly smooth video out.

If all you want to do is record some real-time media, like a microphone or a screen, MediaRecorder should suffice for that - no need to use any library for that.

Does this answer your question somewhat?

— Reply to this email directly, view it on GitHub https://github.com/Vanilagy/webm-muxer/issues/37#issuecomment-2137232783, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGNFILCHQUNUQOLKSCLLZEW67VAVCNFSM6AAAAABIOVLQWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZXGIZTENZYGM . You are receiving this because you authored the thread.Message ID: @.***>

Vanilagy commented 1 month ago

That usecase is exactly what this library was made for. By decoupling your rendering process from any real-time limitations, you can ensure your videos are 100% smooth and have no skipped frames. For my web game, I refactored the audio engine to be able to use OfflineAudioContext as well, which then allows me to render the audio offline as well (and MUCH faster than real time). Combine canvas with that, and you can render smooth videos.

weepy commented 1 month ago

Amazing! I will dig deeper. I am currently capturing the PCM output from the graph live - so hoping i can mux it all at the end.

On Wed, May 29, 2024 at 2:34 PM Vanilagy @.***> wrote:

That usecase is exactly what this library was made for. By decoupling your rendering process from any real-time limitations, you can ensure your videos are 100% smooth and have no skipped frames. For my web game, I refactored the audio engine to be able to use OfflineAudioContext https://developer.mozilla.org/en-US/docs/Web/API/OfflineAudioContext as well, which then allows me to render the audio offline as well (and MUCH faster than real time). Combine canvas with that, and you can render smooth videos.

— Reply to this email directly, view it on GitHub https://github.com/Vanilagy/webm-muxer/issues/37#issuecomment-2137305720, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGNCLWD532ODKKPFS22DZEXDOBAVCNFSM6AAAAABIOVLQWCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZXGMYDKNZSGA . You are receiving this because you authored the thread.Message ID: @.***>

Vanilagy commented 1 month ago

Good luck!