You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/nvenc: always reduce DAR width and height
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
This commit is contained in:
committed by
Timo Rothenpieler
parent
27038693bb
commit
f2dd6aee80
@@ -941,18 +941,15 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
|
|||||||
|
|
||||||
ctx->encode_config.version = NV_ENC_CONFIG_VER;
|
ctx->encode_config.version = NV_ENC_CONFIG_VER;
|
||||||
|
|
||||||
if (avctx->sample_aspect_ratio.num && avctx->sample_aspect_ratio.den &&
|
dw = avctx->width;
|
||||||
(avctx->sample_aspect_ratio.num != 1 || avctx->sample_aspect_ratio.num != 1)) {
|
dh = avctx->height;
|
||||||
av_reduce(&dw, &dh,
|
if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) {
|
||||||
avctx->width * avctx->sample_aspect_ratio.num,
|
dw*= avctx->sample_aspect_ratio.num;
|
||||||
avctx->height * avctx->sample_aspect_ratio.den,
|
dh*= avctx->sample_aspect_ratio.den;
|
||||||
1024 * 1024);
|
}
|
||||||
|
av_reduce(&dw, &dh, dw, dh, 1024 * 1024);
|
||||||
ctx->init_encode_params.darHeight = dh;
|
ctx->init_encode_params.darHeight = dh;
|
||||||
ctx->init_encode_params.darWidth = dw;
|
ctx->init_encode_params.darWidth = dw;
|
||||||
} else {
|
|
||||||
ctx->init_encode_params.darHeight = avctx->height;
|
|
||||||
ctx->init_encode_params.darWidth = avctx->width;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx->init_encode_params.frameRateNum = avctx->time_base.den;
|
ctx->init_encode_params.frameRateNum = avctx->time_base.den;
|
||||||
ctx->init_encode_params.frameRateDen = avctx->time_base.num * avctx->ticks_per_frame;
|
ctx->init_encode_params.frameRateDen = avctx->time_base.num * avctx->ticks_per_frame;
|
||||||
|
Reference in New Issue
Block a user