[FFmpeg-devel] [PATCH 1/4] Correctly set Display Aspect Ratio in nvenc.
philipl at overt.org
Wed Jan 7 19:46:47 CET 2015
On Wed, 7 Jan 2015 12:13:25 +0100
Nicolas George <george at nsup.org> wrote:
> Can you explain the 1024?
> Anyway, I would suggest to use lavu's rational functions:
> AVRational dar = av_mul_q(avctx->sample_aspect_ratio,
> av_make_q(avctx->width, avctx->height));
> av_reduce(&dar.num, &dar.den, dar.num, dar.den, MAX);
> nvenc_ctx->nvenc_cfg.darWidth = 1024 * dar.num;
> nvenc_ctx->nvenc_cfg.darHeight = 1045 * dar.den;
> (including the *1.02 in the 1024 constant to avoid floating point
> operations, but I am very suspicious about that 1.02)
Honestly, I don't understand what the encoder is doing at this point.
The 1.02 seems to be the 'correct' scale factor for a PAL DVD, but is
incorrect for anything else. I used 1024 to avoid the floating point
problem, but you are right that pre-multiplication is a better way to
handle that. Right now I'm playing around with an NTSC DVD and I can't
find the right magic to stop it mangling the aspect ratio.
At this point, I'm not convinced that darWidth and darHeight are even
representing the display presentation size at all. Hopefully Agatha can
understand what's going on here.
More information about the ffmpeg-devel