Giter Site home page Giter Site logo

Comments (6)

guest271314 avatar guest271314 commented on June 26, 2024
  1. read the raw data of captured media data, such as YUV video data, or PCM audio data,etc. Then the raw data could be passed to wasm/js module.

It is not clear why it is expected that the "raw data" of a video is "YUV" (see https://stackoverflow.com/a/39048445; https://github.com/brion/yuv-canvas).

The audio data can be expressed as an AudioBuffer using decodeAudioData()

  1. If can decode is true, attempt to decode the encoded audioData into linear PCM. In case of failure, set can decode to false.

or a Float32Array using AudioWorkletNode, see https://github.com/web-platform-tests/wpt/blob/d5be80a86d4f938250c075ac12414ad47516969c/webaudio/js/worklet-recorder.js (see WebAudio/web-audio-api#2011 relevant to options at the code).

  1. It will be better the capture could be worked on worker.

What does "capture" mean in this context?

  1. The data passing is efficient without memory copy.

The term "efficient" is not clearly defined. "efficient" compared to precisely what approaches that are not "efficient"?

  1. hardware accelerate encoder/decoder could be used by wasm/ js module, which is a Plus.

Not sure what that means. Encoding and decoding any unknown audio and/or video codec by "wasm/js"?

from webcodecs.

fideltian avatar fideltian commented on June 26, 2024

I did the wrong action of closing the issue.

  1. we need to do the vidoe processing ourselved based on WASM. So we might need the RGBA or YUV data of video from WEBRTC capture. We could get the raw data of audio through webaudio API.

  2. Capture here means "WebRTC Capture audio/video". It means we would like to get the raw data from worker scope.

  3. some CPU has some hardware accelerating encoder/decoder. It will be better to expose the capability to applicaiton layer.

from webcodecs.

guest271314 avatar guest271314 commented on June 26, 2024

You can currently use ImageCapture.grabFrame() to get ImageBitmap instances of the captured video frames then process the frames. That procedure is possible right now, without waiting for WebCodecs to specify anything.

from webcodecs.

fideltian avatar fideltian commented on June 26, 2024

The API returns ImageBitmap , which is not the raw data. It must be drawed to canvas and then get the imageData from Canvas API.

from webcodecs.

murillo128 avatar murillo128 commented on June 26, 2024

You can read the image data via the VideoTrackReader.readable and implement your encoder as a TransformStream

from webcodecs.

chcunningham avatar chcunningham commented on June 26, 2024

Old bug! Fidel and Chrome folks have discussed this directly, but for other folks reading along:

What we need is :

  1. read the raw data of captured media data, such as YUV video data, or PCM audio data,etc. Then the raw data could be passed to wasm/js module.

Yes, originally offered via VideoTrackReader / AudioTrackReader, but this is now deprecated in favor of (as of #131) using MediaStreamTrackProcessor. Demo here.

  1. It will be better the capture could be worked on worker.

Using MediaStreamTrackProcessor, you will have the option to transfer the readable stream to a worker.

  1. The data passing is efficient without memory copy.

Working with WASM unfortunately imposes some copies, as described in WICG/reducing-memory-copies#1

  1. hardware accelerate encoder/decoder could be used by wasm/ js module, which is a Plus.

At least in Chrome, we will prefer acceleration by default where available. PR #118 will add the ability to strictly require that hardware acceleration be used (which will fail to create the codec when acceleration is not available).

Please re-open if more to discuss.

from webcodecs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.