From: Timo Rothenpieler <timo@rothenpieler.org>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/nvenc: add option to skip padding OBUs
Date: Sat, 29 Mar 2025 22:02:40 +0100
Message-ID: <e88ad017-8c74-47d3-a556-06108e7e9dd8@rothenpieler.org> (raw)
In-Reply-To: <20250329205922.293412-1-aicommander@gmail.com>
On 29.03.2025 21:58, Cameron Gutman wrote:
> Some scenarios (such as game streaming or videoconferencing) may use CBR
> to strictly cap the maximum encoded bitrate, but they don't mind the
> bitrate falling below the target if the encoder doesn't need the
> additional headroom.
But why aren't they using vbr with a maxrate then?
I didn't add this conditionally since when in CBR mode, you actually
really want a constant bitrate.
If you're okay with it dropping lower, why not use another mode with a
maxrate set?
> Allow users to opt-out of filler data in CBR mode for those usecases
> where it is unwanted.
>
> Signed-off-by: Cameron Gutman <aicommander@gmail.com>
> ---
> v2: Rebased to resolve conflicts against master
> ---
> libavcodec/nvenc.c | 2 +-
> libavcodec/nvenc.h | 1 +
> libavcodec/nvenc_av1.c | 2 ++
> 3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index 0f5e772b3e..0f2336b0ec 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -1624,7 +1624,7 @@ static av_cold int nvenc_setup_av1_config(AVCodecContext *avctx)
>
> av1->idrPeriod = cc->gopLength;
>
> - if (IS_CBR(cc->rcParams.rateControlMode)) {
> + if (ctx->filler_data && IS_CBR(cc->rcParams.rateControlMode)) {
> av1->enableBitstreamPadding = 1;
> }
>
> diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
> index e035e123c6..3431457422 100644
> --- a/libavcodec/nvenc.h
> +++ b/libavcodec/nvenc.h
> @@ -309,6 +309,7 @@ typedef struct NvencContext
> int unidir_b;
> int split_encode_mode;
> int mdm, cll;
> + int filler_data;
> } NvencContext;
>
> int ff_nvenc_encode_init(AVCodecContext *avctx);
> diff --git a/libavcodec/nvenc_av1.c b/libavcodec/nvenc_av1.c
> index 01626113ab..c00817af7b 100644
> --- a/libavcodec/nvenc_av1.c
> +++ b/libavcodec/nvenc_av1.c
> @@ -156,6 +156,8 @@ static const AVOption options[] = {
> OFFSET(extra_sei), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
> { "a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
> { "s12m_tc", "Use timecode (if available)", OFFSET(s12m_tc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
> + { "filler_data", "Use filler data to ensure CBR bitrate is strictly adhered to",
> + OFFSET(filler_data), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
> #ifdef NVENC_HAVE_H264_AND_AV1_TEMPORAL_FILTER
> { "tf_level", "Specifies the strength of the temporal filtering",
> OFFSET(tf_level), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, .unit = "tf_level" },
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2025-03-29 21:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-29 20:58 Cameron Gutman
2025-03-29 21:02 ` Timo Rothenpieler [this message]
2025-03-29 21:17 ` Cameron Gutman
2025-03-29 21:26 ` Timo Rothenpieler
2025-03-29 21:37 ` Cameron Gutman
2025-03-29 21:42 ` Timo Rothenpieler
2025-03-29 22:28 ` Cameron Gutman
2025-03-29 22:31 ` Timo Rothenpieler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e88ad017-8c74-47d3-a556-06108e7e9dd8@rothenpieler.org \
--to=timo@rothenpieler.org \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git