Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for AV1 switch frames #747

Open
kalradivyanshu opened this issue Nov 14, 2023 · 5 comments
Open

Support for AV1 switch frames #747

kalradivyanshu opened this issue Nov 14, 2023 · 5 comments
Labels
extension Interface changes that extend without breaking.

Comments

@kalradivyanshu
Copy link

AV1 allows use of switch frames to drop to lower resolution, this could be great while the support for spatial SVC is still not there. From the AV1 spec:

Switch Frame
An inter frame that can be used as a point to switch between sequences. Switch frames overwrite all the reference frames without forcing the use of intra coding. The intention is to allow a streaming use case where videos can be encoded in small chunks (say of 1 second duration), each starting with a switch frame. If the available bandwidth drops, the server can start sending chunks from a lower bitrate encoding instead. When this happens the inter prediction uses the existing higher quality reference frames to decode the switch frame. This approach allows a bitrate switch without the cost of a full key frame.

Is there plans to add support for this in the AV1 encoder? Is it supported in the decoder?

@sandersdan
Copy link
Contributor

My understanding is that switch frames should "just work" in decoders, but I have not tested.

How would you want to request switch frames from an encoder?

@kalradivyanshu
Copy link
Author

It will have to be opt in at time of configuring multiple encoders, SVT-AV1 gives --sframe-dist and --sframe-mode, along with --forced-max-frame-width and --forced-max-frame-height which lets the all encoders know that they are in sframe mode with each other. As far as I can tell we need to have these settings on in the beginning, so it cant be like keyframes where we can choose for each frame whether we can make it a keyframe or not.

Regarding decoders, that sounds good, so I just create 1 decoder, and then switch it to the lower layer on sframe and it should just start decoding the lower layer?

@kalradivyanshu
Copy link
Author

kalradivyanshu commented Nov 15, 2023

Also, @sandersdan am i correct in assuming that in the current AV1 encoder in chrome, sframes are turned off i.e. sframe-dist = 0, so in webcodec AV1 encoder, no sframes will be generated?

@sandersdan
Copy link
Contributor

Regarding decoders, that sounds good, so I just create 1 decoder, and then switch it to the lower layer on sframe and it should just start decoding the lower layer?

I believe so; I'll be interested to hear your results.

in the current AV1 encoder in chrome, sframes are turned off

That is correct, the sframe libaom configuration parameters are not currently set by Chrome.

It's worth noting that WebCodecs only really has temporal scalability so far, and this appears to be a knob relating to spatial scalability. We may want to work on the basics first.

@kalradivyanshu
Copy link
Author

kalradivyanshu commented Nov 15, 2023

Thankyou for your reply!

I believe so; I'll be interested to hear your results.

Will get back to you.

It's worth noting that WebCodecs only really has temporal scalability so far, and this appears to be a knob relating to spatial scalability. We may want to work on the basics first.

But adding spatial scalability means adding a lot of extra functionality #619. Switch frames can be added independently, and can work even in the current setup, by just adding a new {av1: {frame_ty: "sframe"}} to the EncodedVideoChunk. This will allow much better implementation of simulcast, and could help fill the gap that exists right now in webcodecs SVC, till full SVC support comes in.

this appears to be a knob relating to spatial scalability

I don't 100% agree? It gives you ability to switch between multiple encoded streams, rather than having one encoded stream. SVT-AV1 doesn't support SVC at all, but supports switch frames. I think switch frame is just better simulcast than being a knob in spatial SVC (i.e. its a simulcast feature, not an SVC one, if that makes sense). I might be wrong though, I am very new at all of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension Interface changes that extend without breaking.
Projects
None yet
Development

No branches or pull requests

3 participants