Closed Bug 1876438 Opened 2 years ago Closed 2 years ago

Set scalability mode in FFmpegVideoEncoder for AV1

Categories

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

task

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: chunmin, Assigned: chunmin)

References

Details

Attachments

(5 files, 2 obsolete files)

This is required to implement the SVC setting for Webcodecs API when using AV1 codec

Blocks: 1893235

Depends on D211951

Depends on D211953

Depends on: 1899864
Depends on: 1899867

Depends on D211953

Depends on D212170

Note:

After studying the code in libaom, I found that SVC (Scalable Video Coding) in libaom only works if look-ahead processing (LAP) is disabled. This is because the LAYER_CONTEXT is only allocated for ctx->ppi->cpi->svc but not for ctx->ppi->cpi_lap->svc (svc in ctx->ppi->cpi_lap).

If LAP is enabled, running cpi_lap with av1_change_config then av1_update_layer_context_change_config will result in accessing the null cpi_lap->svc->layer_context (since layer_context is not allocated in cpi_lap), causing a segmentation fault.

Therefore, to use SVC, LAP must be disabled. LAP can be disabled in two cases: (1) if the bitrate is constant (CBR mode) or (2) if lag-in-frames is set to zero.

The libaom automatically disables LAP if the bitrate is constant. Otherwise, it calculates the num_lap_buffers value to determine if LAP should be enabled. By setting g_lag_in_frames to 0 (e.g., via av_opt_set(mCodecContext->priv_data, "lag-in-frames", "0", 0)), the num_lap_buffers will become 0 and lap_enabled will be set to false. Accordingly, no cpi_lap will be used.

Attachment #9404474 - Attachment description: WIP: Bug 1876438 - Allow setting SVC for libaom encoder → WIP: Bug 1876438 - Set SVC to libaom encoder
Attachment #9404872 - Attachment is obsolete: true
Attachment #9404873 - Attachment is obsolete: true
Attachment #9404472 - Attachment description: WIP: Bug 1876438 - Allow setting SVC parameters via av_opt_set → WIP: Bug 1876438 - Add SVC parameter support to libaomenc.c via av_opt_set
Attachment #9404474 - Attachment description: WIP: Bug 1876438 - Set SVC to libaom encoder → WIP: Bug 1876438 - Enable SVC configuration in FFmpegVideoEncoder for libaom

This patch extends the timeout duration in
temporal-svc-encoding.https.any.js WPT to accommodate the longer
processing time required for AV1 SVC encoding with the libaom encoder.
This adjustment is necessary to prevent timeout issues in our CI
environment.

Depends on D211954

Attachment #9404473 - Attachment description: WIP: Bug 1876438 - Remove unnecessary lambda → Bug 1876438 - Remove unnecessary lambda
Attachment #9404472 - Attachment description: WIP: Bug 1876438 - Add SVC parameter support to libaomenc.c via av_opt_set → Bug 1876438 - Add SVC parameter support to libaomenc.c via av_opt_set
Attachment #9404474 - Attachment description: WIP: Bug 1876438 - Enable SVC configuration in FFmpegVideoEncoder for libaom → Bug 1876438 - Enable SVC configuration in FFmpegVideoEncoder for libaom
Attachment #9404475 - Attachment description: WIP: Bug 1876438 - Update WPT expectations → Bug 1876438 - Update WPT expectations
Attachment #9405076 - Attachment description: WIP: Bug 1876438 - Extend timeout for temporal SVC encoding WPT → Bug 1876438 - Extend timeout for temporal SVC encoding WPT
Pushed by cchang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e0f0e274e21f Remove unnecessary lambda r=media-playback-reviewers,padenot https://hg.mozilla.org/integration/autoland/rev/f62750343c4c Add SVC parameter support to libaomenc.c via av_opt_set r=media-playback-reviewers,padenot https://hg.mozilla.org/integration/autoland/rev/f089bb5743b1 Enable SVC configuration in FFmpegVideoEncoder for libaom r=media-playback-reviewers,padenot https://hg.mozilla.org/integration/autoland/rev/b8acdb82bb51 Update WPT expectations r=media-playback-reviewers,padenot https://hg.mozilla.org/integration/autoland/rev/02e1ce846c4c Extend timeout for temporal SVC encoding WPT r=media-playback-reviewers,padenot
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/46599 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Regressions: 1900590
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: