[FFmpeg-devel] [PATCH] nvenc: Compensate for hardware trying to mess with aspect ratio of DVD content.
Reimar.Doeffinger at gmx.de
Thu Jan 22 05:41:11 CET 2015
On 22.01.2015, at 05:15, Agatha Hu <ahu at nvidia.com> wrote:
> On 2015/1/21 16:00, Reimar Döffinger wrote:
>> On 21.01.2015, at 07:17, Agatha Hu <ahu at nvidia.com> wrote:
>>> On 2015/1/18 4:01, Philip Langdale wrote:
>>> Here's the reply from NVENC engineers
>>> It is not same thing as SAR. It is the display aspect ratio i.e width/height = DAR/SAR
>>> The calculation below should be like
>>> If (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0 )
>>> av_reduce(&dw, &dh, avctx->sample_aspect_ratio.num * avctx->width, avctx->sample_aspect_ratio.den * avctx->height, INT_MAX);
>> That doesn't answer anything.
>> Doing that, to keep the problem description short, creates different results from libx264 and any other encoder we have for DVD resolution which is highly undesirable for consistency and compatibility reasons if nothing else.
> We will fix the issue in driver, overscan compensation will be applied to input DAR *only* if the DAR is 4:3 or 16:9, otherwise won't unnecessarily modify the aspect ratio for resolutions like 720x480 and 720x576.
While that will make the issue more rare, my problem description description above and the issue we have with it will not be fixed by that. In fact it will just make the work-around more messy.
nvenc would still be the only encoder to modify DAR in this way and DAR will change when people switch between x264 (or any other codec) and nvenc.
As a result, nvenc cannot be used as a drop-in replacement for x264 without a hack to undo your DAR modifications.
As said: it doesn't even matter whether what you do is correct or not, the fact that you are doing it while nobody else does is an issue in itself.
(if everyone agreed that it was clearly without question the right thing to do then changing all other encoder implementations would be an option, however that isn't the case and it would be quite some code duplication to do it in the encoders instead of a level or two above)
More information about the ffmpeg-devel