You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current spec is shy on how encoders are expected to work.
In particular, it is unclear whether they should favour latency, i.e output a chunk as soon as possible or on the contrary buffer several frames and try to optimise.
Similarly, it is unclear whether encoders should be able to use things like bi-predictive frames to improve compression, at the expense of decoding latency.
If we look at existing APIs, VideoToolbox has a number of flags such as kVTCompressionPropertyKey_RealTime or kVTCompressionPropertyKey_AllowFrameReordering.
If we look at existing APIs, VideoToolbox has two APIs for bitrate, kVTCompressionPropertyKey_AverageBitRate and kVTCompressionPropertyKey_DataRateLimits.
Depending on the usecases, it might be good to:
provide guidelines for implementors on a common encoder strategy selection (favour latency?).
provide API, for instance hints, for a web page to communicate what encoder strategy to use.
We plan to add a number of knobs to the API for rate control generally. Tracked in #56. I think strategy hints (like discussed in #206) are also reasonable to consider.
In the interim, I agree that the spec should provide guidelines to implementers for common encoder selection strategy. Chrome has tried to pick reasonable defaults considering the most common use cases. I'd like to produce a longer answer with the details on those decisions. Stand by.
I'm back to talk about common encoder (and decoder) selection strategy.
After lots of discussion, we propose the following principle: don't constrain features/quality unless the user asks for it.
For encoder defaults, this would mean:
don't constrain quality for the sake of latency
don't constrain bitrate unless requested (VBR by default)
allow b-frames
For decoders:
don't sacrifice bandwidth for the sake of latency
Of course, we also intend to propose knobs to make all of the above configurable.
We are already proposing a latency knob. Currently just in the context of decoding, but seems encoding needs something too. Symmetry would be nice if reasonable.
I will shortly propose a new knob for explicit CBR vs VBR mode
For B frames, codec profile already provides a good means to opt-out. Open to adding an additional knob though.
I think I generally agree with having defaults this way. To paraphrase, most of the case you care about the size and quality, and when you care about other aspects, you'll be able to get what you want.
don't sacrifice bandwidth for the sake of latency
You mean throughput ? I agree in any case.
I will shortly propose a new knob for explicit CBR vs VBR mode
That's absolutely required for security, when sending the video in an encrypted channel.
CBR for audio seems good as well as an option like done for MediaRecorder.
Ideally, implementations would be able to just use OS defaults or do minimal setup. That might be a good way to validate these defaults.
We might still want to add some guidelines like: a video encoder when receiving a frame is expected to output the compressed frame without having to wait for another frame to be received.
We might still want to add some guidelines like: a video encoder when receiving a frame is expected to output the compressed frame without having to wait for another frame to be received.
I think, aligning with the principle above (don't constrain features/quality unless the user asks for it), the default would be to fill the underlying encoding pipeline to achieve maximum bandwidth. Users would then flush() whenever they need to push out all pending chunks. But I am very supportive of having a mode/knob whereby users can enable a 'low latency' or 'realtime' mode that behaves as you described.
@youennf@alvestrandcontent-hints "hints... what encoder strategy to use". It is a property of a MediaStreamTrack, but not of a VideoFrame. So there has to be an explicit way for the hint to be provided to the encoder.
Activity
padenot commentedon May 11, 2021
#206 is a bit about this (started about the decode side though).
chcunningham commentedon May 11, 2021
We plan to add a number of knobs to the API for rate control generally. Tracked in #56. I think strategy hints (like discussed in #206) are also reasonable to consider.
In the interim, I agree that the spec should provide guidelines to implementers for common encoder selection strategy. Chrome has tried to pick reasonable defaults considering the most common use cases. I'd like to produce a longer answer with the details on those decisions. Stand by.
chcunningham commentedon May 21, 2021
I'm back to talk about common encoder (and decoder) selection strategy.
After lots of discussion, we propose the following principle: don't constrain features/quality unless the user asks for it.
For encoder defaults, this would mean:
For decoders:
Of course, we also intend to propose knobs to make all of the above configurable.
padenot commentedon May 21, 2021
I think I generally agree with having defaults this way. To paraphrase, most of the case you care about the size and quality, and when you care about other aspects, you'll be able to get what you want.
You mean throughput ? I agree in any case.
That's absolutely required for security, when sending the video in an encrypted channel.
youennf commentedon May 21, 2021
These defaults look good to me as well.
CBR for audio seems good as well as an option like done for MediaRecorder.
Ideally, implementations would be able to just use OS defaults or do minimal setup. That might be a good way to validate these defaults.
We might still want to add some guidelines like: a video encoder when receiving a frame is expected to output the compressed frame without having to wait for another frame to be received.
chcunningham commentedon Jun 2, 2021
I think, aligning with the principle above (don't constrain features/quality unless the user asks for it), the default would be to fill the underlying encoding pipeline to achieve maximum bandwidth. Users would then
flush()whenever they need to push out all pending chunks. But I am very supportive of having a mode/knob whereby users can enable a 'low latency' or 'realtime' mode that behaves as you described.aboba commentedon Jun 11, 2021
@youennf @alvestrand content-hints "hints... what encoder strategy to use". It is a property of a
MediaStreamTrack, but not of aVideoFrame. So there has to be an explicit way for the hint to be provided to the encoder.chcunningham commentedon Jan 18, 2022
I think we can probably close this. Defaults are now established in the spec per our plan above. Please re-open if more to discuss.