-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add AvcEncoderConfig to specify optional annex-b format. #117
Add AvcEncoderConfig to specify optional annex-b format. #117
Conversation
Previously the spec doesn't say which format is used. This clarifies that the default format is AVC and that the AVCConfigurationBox (contents of MP4 avcC) is emitted by the encoder output callback. Furhter, it the ability to instead use annex-b format. Fixes #72.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
How about adding a similar item to VideoDecoderConfig
, so the decoder could be configured to decode Annex B bitstreams.
@@ -1201,6 +1213,8 @@ | |||
required unsigned long cropHeight; | |||
unsigned long displayWidth; | |||
unsigned long displayHeight; | |||
|
|||
AvcEncoderConfig avc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it could be named as codecSpecificConfig
, and the type could be (AvcEncoderConfig or CodecnameEncoderConfig)
in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I follow, but I don't think the (X or Y) syntax plays nice when X and Y are both dictionaries. The UA code that converts js -> c++ binding doesn't know how to disambiguate. In some cases, we may even have two dictionary types with some overlapping of keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding a similar item to VideoDecoderConfig, so the decoder could be configured to decode Annex B bitstreams.
We do plan to add support support annex-b in VideoDecoder, but via a different mechanism. The idea is that the VideoDecoderConfig.description, when present, will contain the AVCC info and we will assume avc format. If absent, we will assume the AVC stream is in annex-b format.
The assymetric mechanism is a bit weird, but I think its the lesser evil. Think of VideoDecoderConfig.description as essentially the 'extradata' from FFmpeg's AVCodecContext. This is a common notion for all codecs, but the details are codec specific. Like AVC, other codecs including opus, aac, and vorbis will also use this mechanism to provide various metadata (e.g. the opus header, or the vorbis codebook).
Using description in this way should be familiar and avoids needing to create a decoder-config codec specific structure for each codec.
For encoding, codec specific configuration seems unavoidable. The avc vs annex-b is just the tip of the iceberg for possible codec-specific encoder configuration parameters.
@@ -1201,6 +1213,8 @@ | |||
required unsigned long cropHeight; | |||
unsigned long displayWidth; | |||
unsigned long displayHeight; | |||
|
|||
AvcEncoderConfig avc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I follow, but I don't think the (X or Y) syntax plays nice when X and Y are both dictionaries. The UA code that converts js -> c++ binding doesn't know how to disambiguate. In some cases, we may even have two dictionary types with some overlapping of keys.
@padenot approved these api shape changes in our weekly editors call. |
Thanks for your explanation. |
Add AvcEncoderConfig to specify annex-b format.
Previously the spec doesn't say which format is used. This clarifies
that the default format is AVC and that the AVCConfigurationBox
(contents of MP4 avcC) is emitted by the encoder output callback.
Furhter, it the ability to instead use annex-b format.
Fixes #72. Fixes #97.
Preview | Diff