davedoesdev / webm-muxer.js

WebM muxer using libwebm and webm-tools compiled to Wasm
http://rawgit.davedoesdev.com/davedoesdev/webm-muxer.js/main/demo.html
MIT License
53 stars 5 forks source link

Demuxing #25

Closed onthegit closed 2 years ago

onthegit commented 2 years ago

Can webm files be demuxed into chunked data, which then can be fed into VideoDecoder?

davedoesdev commented 2 years ago

No, sorry. I'm happy to leave this issue open in case anyone wants to pick this up.

I'm not sure if there's code in libwebm or webm-tools to do demux easily, however.

guest271314 commented 2 years ago

Can webm files be demuxed into chunked data, which then can be fed into VideoDecoder?

Yes, that is possible. You can serialize the data to JSON. See https://github.com/guest271314/webcodecs/blob/main/serialize-to-json-deserialize-json-to-encodedaudiochunk-decode.js and https://github.com/guest271314/webcodecs/blob/main/deserialize-json-to-encodedaudiochunk-decode.js.

onthegit commented 2 years ago

Can webm files be demuxed into chunked data, which then can be fed into VideoDecoder?

Yes, that is possible. You can serialize the data to JSON. See https://github.com/guest271314/webcodecs/blob/main/serialize-to-json-deserialize-json-to-encodedaudiochunk-decode.js and https://github.com/guest271314/webcodecs/blob/main/deserialize-json-to-encodedaudiochunk-decode.js.

Hello, thanks for the reply, but from quick look at the code, it will not work in workers and it requires fetching the entire file. Fetching the entire file is prohibitive for large files (whether video or audio).

onthegit commented 2 years ago

The better option will be to feed bytes, and the structure is parsed on the fiy like what gpac/mp4box.js does

guest271314 commented 2 years ago

@onthegit Why won't the code work in workers? Did you try? No, the entire file does not have to be fetched. An example of streaming video frames without using any Web API codec parser, written originally for Firefox https://plnkr.co/plunk/4Tb91b, Chromium version https://plnkr.co/plunk/gCjYSt.

guest271314 commented 2 years ago

See also rapid_video_painter.html at https://github.com/chcunningham/wc-talk.

guest271314 commented 2 years ago

For VP8 frames see https://github.com/dominikhlbg/vp8-webm-javascript-decoder, which I used to create https://github.com/guest271314/screenshot.