Open jfrancos opened 5 years ago
This would be possible to rig up using the codec modules directly, though not yet a convenient interface for it.
Roughly, you need to pass data into a demuxer module's receiveInput
method, then loop over it with process
, dequeuing any packets along the way and passing them into the decoder module. Take the output data, concatenate it all into a single ArrayBuffer and resolve the promise.
Devil's always in the details though. :)
What is input and expected output?
Do not have access to Safari. Testing decodeAudioData
at Epiphany 3.28.5 an AudioBuffer
is logged when the audio codec is Ogg
or A_PCM/FLOAT/IEEE
in a WebM container or MP2/MP3
in a MP3
. OPUS
in a WebM container outputs null
. Conversion to WAV
can be achieved using this version https://cdn.jsdelivr.net/npm/audiobuffer-to-wav@1.0.0/index.js of https://github.com/mattdiamond/Recorderjs at https://plnkr.co/edit/HMqf5CrAXhOHtlzOadI8?p=info.
Actually I figured out how to use emscripten to be able to use vorbis-tools' oggdec directly:
@jfrancos Are you able to verify which file types and codecs Safari is able to decode with decodeAudioData()
re https://github.com/brion/ogv.js/issues/533#issuecomment-565857607 and https://github.com/mdn/webaudio-examples/issues/5?
I would love to be able to do this as well. My use case is that I have a stream of "raw" Theora packets coming from a camera, without an OGV container. I want to be able to feed in the header packets, an intra frame, and a sequence of inter frames and get out the final image buffer. Is this possible at all? The codec-bench.html
file looks like it might be close.
Yes, you can call the decoder directly if you like. No stable api or documentation or support.
Ok thanks. I put together an example of using ogv.js to decode raw Theora packets into video frames: https://github.com/rgov/js-theora-decoder (Demo)
@brion One thing I'm curious about is why I need to call processHeader()
for intra frames, instead of processFrame()
.
For Brave/Firefox I use WebAudio's
decodeAudioData
, which returns anAudioBuffer
of the decoded PCM audio data. This doesn't work in Safari.Is there a way I can use ogv just for decoding, in place of
decodeAudioData
?Thanks for your hard work.