thenickdude / webm-writer-js

JavaScript-based WebM video encoder for Google Chrome
270 stars 43 forks source link

Is it possible to add audio to the resulting webm file? #1

Open guest271314 opened 6 years ago

guest271314 commented 6 years ago

Is it possible to add audio to the resulting webm file?

nuthinking commented 6 years ago

using ffmpeg with Electron, I guess.

guest271314 commented 4 years ago

@nuthinking Can the relevant parts of https://github.com/kbumsik/opus-media-recorder be incorporated into webm-writer.js, or vice versa, to achieve the expected result?

thenickdude commented 4 years ago

Probably

guest271314 commented 4 years ago

@thenickdude Have been trying using https://github.com/tseylerd/Webm-writer (which includes an addAudioTrack() method). Have been able to encode the video with variable resolution. Then began trying to incorporate https://github.com/kbumsik/opus-media-recorder which has thus far thrown errors, not record any audio, and crashes the browser (not just the tab). Will next try https://github.com/higuma/web-audio-recorder-js.

guest271314 commented 4 years ago

@thenickdude Do not (yet) know where to begin to include audio track support in your code else would have already written the code.

matthewfcarlson commented 4 years ago

I'm pretty interested in as well

guest271314 commented 4 years ago

@matthewfcarlson An experiment performed in the interim https://github.com/WebAudio/web-audio-api-v2/issues/6. mkv2xml and xml2mkv are particularly helpful for providing a "human readable" version of a Matroska file. It should be possible to substitute, edit any part of the XML file, e.g., to being with an XML template and insert PCM or Opus (and image) data, then use xml2mkv to convert back to binary format.

Revisited this issue https://github.com/legokichi/ts-ebml/issues/26 yesterday attempting to extract VP8 data (AFAICT webm-writer does not convert from RGB to YUV, though does appear to provide the code to facilitate that option, if necessary) and stream those images from a Worker to main thread, in conjunction with audio using http://libwebpjs.hohenlimburg.org/vp8/webm-javascript-decoder/, and to try setting hexadecimal encoded images into a stream.

How do you suggest to proceed to achieve the requirement?