Re: [FFmpeg-devel] [PATCH] libavcodec/libfdk-aacenc: Enable writing DRC metadata
> Looks mostly good to me now, thanks. I guess I can clean up the remaining > few nitpicks without you having to resubmit the patch. So unless you > disagree with the comments, I can push it with the minor touch-ups. > > // Martin > Sounds good to me. No disagreements here. Thank you for going over the patch! ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/libfdk-aacnc: send encoder delay/padding in packet side data
> On Fri, Feb 24, 2023 at 3:14 PM JonHGee wrote: > --- > libavcodec/libfdk-aacenc.c | 27 ++- > 1 file changed, 26 insertions(+), 1 deletion(-) > diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c > index 54549de473..55d10990e4 100644 > --- a/libavcodec/libfdk-aacenc.c > +++ b/libavcodec/libfdk-aacenc.c > @@ -21,6 +21,7 @@ > #include "libavutil/channel_layout.h" > #include "libavutil/common.h" > +#include "libavutil/intreadwrite.h" > #include "libavutil/opt.h" > #include "avcodec.h" > #include "audio_frame_queue.h" > @@ -46,6 +47,7 @@ typedef struct AACContext { > int latm; > int header_period; > int vbr; > +int delay_sent; > AudioFrameQueue afq; > } AACContext; > @@ -368,7 +370,7 @@ static int aac_encode_frame(AVCodecContext *avctx, > AVPacket *avpkt, > int out_buffer_identifier = OUT_BITSTREAM_DATA; > int out_buffer_size, out_buffer_element_size; > void *in_ptr, *out_ptr; > -int ret; > +int ret, discard_padding; > uint8_t dummy_buf[1]; > AACENC_ERROR err; > @@ -428,6 +430,29 @@ static int aac_encode_frame(AVCodecContext *avctx, > AVPacket *avpkt, > ff_af_queue_remove(>afq, avctx->frame_size, >pts, > >duration); > +discard_padding = avctx->frame_size - avpkt->duration; > +// Check if subtraction resulted in an overflow > +if ((discard_padding < avctx->frame_size) != (avpkt->duration > 0)) { > +av_log(avctx, AV_LOG_ERROR, "discard padding overflow\n"); > +av_packet_unref(avpkt); > +av_free(avpkt); > +return AVERROR(EINVAL); > +} > +if ((!s->delay_sent && avctx->initial_padding > 0) || discard_padding > > 0) { > +uint8_t *side_data = > +av_packet_new_side_data(avpkt, AV_PKT_DATA_SKIP_SAMPLES, 10); > +if (!side_data) { > +av_packet_unref(avpkt); > +av_free(avpkt); > +return AVERROR(ENOMEM); > +} > +if (!s->delay_sent) { > +AV_WL32(side_data, avctx->initial_padding); > +s->delay_sent = 1; > +} > +AV_WL32(side_data + 4, discard_padding); > +} > + > avpkt->size = out_args.numOutBytes; > *got_packet_ptr = 1; > return 0; > -- > 2.39.2.637.g21b0678d19-goog > Ping? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/libfdk-aacenc: Scale VBR mode with FF_QP2LAMBDA
I had noticed fdk is specifically looking for the qscale flag, and otherwise does not do anything with global_quality. I suppose the change is risky for anyone who is setting both global quality and qscale, but with the current code, it seems incorrect to have a conditional based on the scaled option and not account for the scaling. if (avctx->flags & AV_CODEC_FLAG_QSCALE || s->vbr) { int mode = s->vbr ? s->vbr : avctx->global_quality; On Wed, Feb 22, 2023 at 9:16 AM Timo Rothenpieler wrote: > On 22.02.2023 17:46, Gyan Doshi wrote: > > > > > > On 2023-02-22 10:12 pm, Timo Rothenpieler wrote: > >> On 22.02.2023 17:33, Gyan Doshi wrote: > >>> From > >>> > >>> fftools\ffmpeg_mux_init.c > >>> 619:ost->enc_ctx->global_quality = FF_QP2LAMBDA * qscale > >>> > >>> Regards, > >>> Gyan > >> > >> But that's only if you set the old qscale CLI options. > >> If you set the global_quality option directly, there is no factor > >> applied. > >> > >> By dividing by FF_QP2LAMBDA you break setting this value via > >> global_quality, and instead add support for setting it via the old and > >> pretty much abandoned qscale interface. > > > > FWIW, that's what LAME does. > > > > libavcodec\libmp3lame.c > > 119:lame_set_VBR_quality(s->gfp, avctx->global_quality / > > (float)FF_QP2LAMBDA); > > > > global_quality semantics seem overloaded. Maybe we should just redirect > > user to priv vbr and error out in fdk init. > > > > Regards, > > Gyan > > It's pretty much a matter of "what did this code always do in the past". > It then got to stick to it, cause otherwise we break downstream API and > CLI consumers. > > The mp3lame code is probably old enough that qscale was still the > default at the time. > Nowadays it's global_quality. > > Both of those options mapping to the same field in avctx, one with a > magic factor applies, is definitely and oddity. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".