[`AVCodecContext`](https://searchfox.org/mozilla-central/rev/f6776253b65c05351b4004fe7c3353cac8d8a4af/dom/media/platforms/ffmpeg/libav53/include/libavcodec/avcodec.h#2940) and [`AVFrame`](https://searchfox.org/mozilla-central/rev/f6776253b65c05351b4004fe7c3353cac8d8a4af/dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/frame.h#410) has `colorspace` member to set color space, and [`av_frame_set_colorspace`](https://searchfox.org/mozilla-central/rev/f6776253b65c05351b4004fe7c3353cac8d8a4af/dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/frame.h#536) should be exposed to do this job in ffmpeg 57 and 58.
Bug 1872318 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
[`AVCodecContext`](https://searchfox.org/mozilla-central/rev/f6776253b65c05351b4004fe7c3353cac8d8a4af/dom/media/platforms/ffmpeg/libav53/include/libavcodec/avcodec.h#2940) and [`AVFrame`](https://searchfox.org/mozilla-central/rev/f6776253b65c05351b4004fe7c3353cac8d8a4af/dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/frame.h#410) has `colorspace` member to set color space, and [`av_frame_set_colorspace`](https://searchfox.org/mozilla-central/rev/f6776253b65c05351b4004fe7c3353cac8d8a4af/dom/media/platforms/ffmpeg/ffmpeg57/include/libavutil/frame.h#536) should be exposed to do this job in ffmpeg 57 and 58. For VPX, Chromium checks and updates the colorspace setting every `Encode()` [1,2]. We should do the same. However, it seems `libvpxenc` only allow setting the colorspace in `vpx_init` [3]. [1] https://source.chromium.org/chromium/chromium/src/+/main:media/video/vpx_video_encoder.cc;l=788;drc=01617d2321eca21c3bd33be0343041ccb9a297b3 [2] https://source.chromium.org/chromium/chromium/src/+/main:media/video/vpx_video_encoder.cc;l=555;drc=95f0c44104378829ae6a1c53664e03677a64c15e;bpv=0;bpt=1 [3] https://searchfox.org/mozilla-central/rev/a46c21ec5559b6d1ac96fcb95bff6885a10bbf99/media/ffvpx/libavcodec/libvpxenc.c#866