From: "Martin Storsjö" <martin@martin.st>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] liavcodec: add bit-rate support to RoQ video encoder
Date: Mon, 22 Jan 2024 15:59:04 +0200 (EET)
Message-ID: <d59e1682-c842-3831-4021-33798a41ce3@martin.st> (raw)
In-Reply-To: <b8f932823c6df6d57d6ef1a7deb3b1b389ecbb07.camel@haerdin.se>
On Mon, 22 Jan 2024, Tomas Härdin wrote:
>>> >>> - if (frame->quality)
>> > > - enc->lambda = frame->quality - 1;
>> > > - else
>> > > - enc->lambda = 2*ROQ_LAMBDA_SCALE;
>> > > + if (avctx->bit_rate <= ROQ_DEFAULT_MIN_BIT_RATE) {
>> > > + /* no specific bit rate desired, use frame quality */
>> > > + if (frame->quality)
>> > > + enc->lambda = frame->quality - 1;
>> > > + else
>> > > + enc->lambda = 2*ROQ_LAMBDA_SCALE;
>> > > + }
>> >
>> > This looks like a bit of a janky way to switch between qscale and
>> > bitrate. Isn't there a way to detect whether an option has been set
>> > explicitly? At the very least this behavior should be documented in
>> > doc/encoders.texi
>> >
>>
>> Originally, the code just checked for bit_rate !=
>> AV_CODEC_DEFAULT_BITRATE,
>> which required including options_table.h, which in turn produced a
>> bunch
>> of compilation warnings about certain fields being deprecated. None
>> of the
>> other codecs include that file + many simply check the bit_rate field
>> against
>> magic constants.
>
> grepping for 200000 didn't reveal anything like that. Do you have a
> specific example of an encoder that does this?
>
> Perhaps we could move AV_CODEC_DEFAULT_BITRATE somewhere else, to avoid
> pulling in a bunch of unrelated stuff. Maybe that doesn't need to hold
> up this patch though. Tbh the way bitrate is defaulted to a value,
> which makes it impossible to differentiate between a user-supplied -b
> 200k an no -b at all, is even more janky. The default is also
> ridiculously low..
>
> I know some encoders like libvpx allow specifying both quality (-crf)
> and bitrate at the same time
FWIW, it's possible for an encoder to individually override the defaults
for fields like these. See e.g. x264_defaults in libx264.c, where it
overrides the default bitrate to zero.
// Martin
_______________________________________________
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:[~2024-01-22 13:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-21 21:08 Victor Luchits
2024-01-22 13:05 ` Tomas Härdin
2024-01-22 13:38 ` Victor Luchitz
2024-01-22 13:57 ` Tomas Härdin
2024-01-22 13:59 ` Martin Storsjö [this message]
2024-01-22 14:19 ` Tomas Härdin
2024-01-22 16:36 ` Victor Luchitz
2024-01-22 16:21 ` Victor Luchitz
2024-01-22 18:32 ` Victor Luchitz
2024-01-22 19:10 ` Tomas Härdin
2024-01-22 19:16 ` Victor Luchitz
-- strict thread matches above, loose matches on Subject: below --
2024-01-22 19:14 Victor Luchits
2024-01-22 21:12 ` Tomas Härdin
2024-01-22 21:40 ` Victor Luchitz
2024-01-22 23:25 ` Tomas Härdin
2024-01-22 22:39 ` epirat07
2024-01-21 20:19 Victor Luchits
2024-01-21 21:02 ` Michael Niedermayer
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=d59e1682-c842-3831-4021-33798a41ce3@martin.st \
--to=martin@martin.st \
--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