Open Bug 1872318 Opened 6 months ago Updated 23 days ago

Allow setting colorspace when encoding video frame by FFmpegVideoEncoder

Categories

(Core :: Audio/Video, task, P2)

task

Tracking

()

People

(Reporter: chunmin, Assigned: chunmin, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

AVCodecContext and AVFrame has colorspace member to set color space, and av_frame_set_colorspace 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

This patch adds av_frame_set_colorspace and av_frame_set_color_range
to FFmpegLibWrapper.

Depends on D197401

Assignee: nobody → cchang

Did you remember what was missing here?

Flags: needinfo?(cchang)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: