[FFmpeg-devel] [PATCH] (for discussion): nvenc: fix wrong aspect ratio for 720x576 and 720x480 resolution
thunder.m at email.cz
Mon Feb 13 09:52:34 EET 2017
Dne 12.2.2017 v 23:20 Philip Langdale napsal(a):
> On Sun, 12 Feb 2017 22:43:41 +0100
> Miroslav Slugeň <thunder.m at email.cz> wrote:
>> Dne 12.2.2017 v 22:31 Timo Rothenpieler napsal(a):
>>> On 2/12/2017 10:25 PM, Miroslav Slugeň wrote:
>>>> This patch is for discussion only, not ready to commit yet and
>>>> maybe newer will be.
>>>> NVENC in current CUDA 8 SDK is setting wrong aspect ratio when
>>>> encoding resolution 720x576 and 720x480 and using AR 4:3 or 16:9
>>>> it will encode to h264 header that 15:11 and 20:11 is used. This
>>>> is very very very ugly way how to fix it. I hope someone in NVIDIA
>>>> will fix this soon, because all encoded streams are not displayed
>>>> correctly for example in videojs player.
>>> nvenc.c had some compensation for this, which was somewhat recently
>>> removed, because nvidia fixed something regarding it:
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at ffmpeg.org
>> I know that, i am monitoring all nvenc and cuvid changes in ffmpeg.
>> Fix is not working anymore in current drivers. What is working is if
>> you set aspect ratio 16000x9001 it will give you almost correct
>> output, but fixing this in h264 SPP is better solution.
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
> If it's still happening, let's just restore the original workaround.
> But I stopped being able to reproduce the problem locally, and I can't
> reproduce it right now with a 720x576 sample.
> Note that the SDK is completely irrelevant to playback behaviour. The
> CUDA SDK doesn't include current cuvid/nvenc headers and the Video SDK
> isn't required because we bundle/reimplement headers with ffmpeg.
> You are likely not using a new enough driver release to have the fix in
> it. I'm using 378.09 here.
I am using current STABLE drivers 375.26, because BETA drivers 378.09
caused some crashes while encoding on NVENC.
I tested this on BETA drivers too and it is still same.
Original workaround is not working anymore :(
INPUT: Stream #0:0[0x401]: Video: mpeg2video (Main) ( /
0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps,
25 tbr, 90k tbn, 50 tbc
OUTPUT: Stream #0:0[0x100]: Video: h264 (Main) ( / 0x001B),
yuv420p(progressive), 720x576 [SAR 16:11 DAR 20:11], 25 fps, 25 tbr, 90k
tbn, 50 tbc
COMMAND: ffmpeg -deint adaptive -hwaccel cuvid -c:v mpeg2_cuvid -i
"in.ts" -y -c:v h264_nvenc -c:a copy -b:v 1M -preset hq -f mpegts "out.ts"
Also someone else is complaining about this issue:
More information about the ffmpeg-devel