Comments (13)
We'll need to document what options are available from common platform decoders, for this and for other tuning parameters. I'll create a tag for that.
from webcodecs.
Android: starting in L (API level 21), Android encoders optionally support CBR, CQ, and VBR modes. It is possible to query in advance to check if a mode is supported, so we have a choice of fallback options.
I'm not quite sure how an app achieves a target bitrate using this mechanism, especially on Android where it cannot be controlled per-frame. It may be best to expose the options separately, then the WebCodecs implementation can do its best given what the codec implementation offers.
from webcodecs.
Re: title update, we agree the app should be in control. Just a matter of deciding on the knobs.
from webcodecs.
Re: milestone, this is a very important issue, but its not a launch blocker. We will add knobs for QC, CBR, VBR etc, and we have some research still to do on how best to express these concepts (e.g. is QC done in a per-codec dictionary, or in the top level config?). The existing bitrate
knob is here to stay. Later additions of other knobs may interact with it (e.g. CBR vs VBR would affect the time window where target bitrate is computed), but additions are not breaking changes.
from webcodecs.
triage note: marked 'extension', as discussion proposes to add new members to config dict.
from webcodecs.
I would love to see constant-quality modes, and feel that that option is more important than everything in between (ABR window sizes, bitrate ranges, etc). For just constant quality, I'd like to suggest communicating the name in a way that's a bit less codec-y. "Quantization" doesn't mean anything if you aren't a digital media expert. How about just "quality", with codec-specific meaning, but a codec-agnostic range from 0 to 1 (or 0 to 100), where 1 (or 100) means lossless? The mapping could be centrally defined as part of the codec registry, or could be implementation-defined. CCQ modes could be done by specifying both bitrate and quality, and neither of those need to expose codec details to be useful.
from webcodecs.
Sounds interesting.
You mentioned constant-quality modes... we already have config.bitrateMode
w/ values of "variable"
and "constant"
. Would bitrateMode
+ a new quality
knob meet your needs?
I didn't follow your last sentence about CCQ... what does that stand for? Can you give a example of how this would work?
from webcodecs.
Variable bitrate mode is good. I personally just prefer constant quality modes, e.g. CRF in H.264 or constant quantizer in other encodings. The thing with ABR/VBR modes is that they're still bitrate-centric, and an average bitrate in one encoding yields a very different quality than the same average bitrate in another encoding. Although it's not meaningful to equate constant quality modes across different encoders, it's even less meaningful to equate bitrates if what you care about is quality.
re CCQ, sorry, I meant constrained constant quality modes, which are usually abbreviated ambiguously to "CQ", not CCQ. I always say "CCQ" because "CQ" really should just mean "constant quality", even though it never does :) . e.g. in VP9 you can set a quantizer but also a constraint on the bitrate.
from webcodecs.
I think this is incredibly important for the video recording use case. @chcunningham I don't think webcodec will be practical for more serious recording use cases until it gets exactly that nob to set a quality constraint or target a quality.
For example in our case, the content we record many times involves both some full motion camera scenes and then some scenes which are mostly static static content combined with a camera PiP. Just having a bitrate option forces you to set the bitrate very high to get decent quality on the full motion scenes, but then you basically waste a bunch of bits on all the scenes with static content + pip. - For recording you really need some ability to target some type of quality factor or QP.
Any idea around ETA or how this is currently prioritized?
from webcodecs.
#633 and #642 both attempt to address this. Support for VPX/AV1 QP mode should be forthcoming in Chrome. It'll be harder to get H.264 QP support since it varies by platform / api.
from webcodecs.
Thanks for pointing to those issues. For our use case H.264 is the only codec we can use for now, but I will follow the development and hope it will land sooner than later.
from webcodecs.
Is this issue still open, or has it been addressed by #633 and #642?
from webcodecs.
Closing it as implemented
from webcodecs.
Related Issues (20)
- numberOfChannels/sampleRate check in AudioDecoderConfig/AudioEncoderConfig HOT 1
- Under what conditions should the ImageDecoder [[completed promise]] and ImageTrackList [[ready promise]] be rejected? HOT 3
- Spec differentiates between ImageDecoder initialization with unsupported non-image MIME type and an unsupported image MIME type HOT 2
- how to config videoEncoder that output frame is annexB not avcC? HOT 1
- `ImageDecoder` is `[SecureContext]` but related interfaces aren't HOT 2
- `ImageBufferSource` should be `[AllowShared]` HOT 1
- Announcement: Background Segmentation metadata entry to WebCodecs VideoFrame Metadata Registry HOT 2
- Why is the audio encoder output timestamp different from the input timestamp
- Video encoder bitrate control in case frame rate is not provided
- Video frames on demand HOT 1
- Error code: SIGSEGV HOT 3
- VideoFrame.timestamp and EncodedVideoChunk.timestamp HOT 6
- video encoder memory leaks HOT 1
- Include some frame info with `VideoDecoder` Errors? HOT 2
- VideoFrameMetadata is defined in WebCodecs and videoFrameCallback HOT 2
- Wrong chroma values in videoFrame.copyTo() on Intel MacOS HOT 1
- Attempting to configure an encoder with a bitrate of 0 should fail HOT 1
- display size is not set in Convert to RGB frame algorithm
- copyTo from planar to interleave should copy / convert all channels HOT 2
- Do Linear PCM AudioDecoders not work? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webcodecs.