#6260(ffmpeg:new): NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive
#6260: NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive -------------------------------------+------------------------------------- Reporter: alexpigment | Type: defect Status: new | Priority: important Component: ffmpeg | Version: Keywords: NVENC, | unspecified aliasing, interlaced, | Blocked By: progressive, chroma | Reproduced by developer: 0 Blocking: | Analyzed by developer: 0 | -------------------------------------+------------------------------------- Summary of the bug: When encoding to H.264 with the NVENC encoder, I'm seeing a pronounced aliasing or stair-stepping effect that happens on the colors (chroma- only?) during motion. This occurs on progressive encodes, but is worse on interlaced encodes. I have verified this behavior on both an Nvidia 1060 and an Nvidia 750 while using the newest static Win64 build from Zeranoe as well as a build from January. To rule out a problem with the GPU, driver, or NVENC itself, I used Staxrip x264 1.4.0.0 to encode with NVENC H.264 on 2 samples and saw no issues. Therefore, this issue appears to be specific to the FFMPEG implementation of NVENC. FFMPEG x264 does not suffer from this issue either. How to reproduce: % ffmpeg -i interlacedsample.mp4 -c:v h264_nvenc -b:v 20000000 -flags +ilme+ildct interlacedoutput.mp4 View the file in a player that supports deinterlacing (I'm using WMP 12 for consistency). Notice that the colors of the rings have massive stair- stepping around the curves, particularly in the lower right where the red and green intersect. As mentioned above, this also occurs on progressive, albeit to a lesser but still very problematic degree. % ffmpeg -i progressivesample.mp4 -c:v h264_nvenc -b:v 20000000 progressiveoutput.mp4 The same problem occurs here, most notably at hte top of the blue right and at the intersection of the green and red rings at the bottom left. ffmpeg version N-84348-gdb7a05d built on 2017-03-21 -- Ticket URL: <https://trac.ffmpeg.org/ticket/6260> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#6260: NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive -------------------------------------+------------------------------------- Reporter: alexpigment | Owner: Type: defect | Status: new Priority: normal | Component: Version: unspecified | undetermined Keywords: NVENC | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Changes (by cehoyos): * keywords: NVENC, aliasing, interlaced, progressive, chroma => NVENC * priority: important => normal * component: ffmpeg => undetermined -- Ticket URL: <https://trac.ffmpeg.org/ticket/6260#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#6260: NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive -------------------------------------+------------------------------------- Reporter: alexpigment | Owner: Type: defect | Status: new Priority: normal | Component: Version: unspecified | undetermined Keywords: NVENC | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by dpavlekovic): Hi, I'm experiencing the same problem, I originally thought it's the nvenc issue so thanks for reporting. Today I found that this is related to padding of input surface width/height to be divisible by 32 in libavcodec/nvenc.c:nvenc_alloc_surface: {{{ allocSurf.width = (avctx->width + 31) & ~31; allocSurf.height = (avctx->height + 31) & ~31; }}} If I remove this adjustment then the output looks OK (1920x1080 source, would be padded to 1920x1088). I've no experience though with NVEnc APIs, so not sure if this is a right thing to do for all cases. -- Ticket URL: <https://trac.ffmpeg.org/ticket/6260#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#6260: NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive -------------------------------------+----------------------------------- Reporter: alexpigment | Owner: Type: defect | Status: closed Priority: normal | Component: avcodec Version: git-master | Resolution: fixed Keywords: NVENC | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 1 | -------------------------------------+----------------------------------- Changes (by oromit): * status: new => closed * reproduced: 0 => 1 * component: undetermined => avcodec * version: unspecified => git-master * analyzed: 0 => 1 * resolution: => fixed Comment: Fixed in a1652aca7e892ea4899df894feaa87ba4170e06c -- Ticket URL: <https://trac.ffmpeg.org/ticket/6260#comment:3> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#6260: NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive -------------------------------------+----------------------------------- Reporter: alexpigment | Owner: Type: defect | Status: closed Priority: normal | Component: avcodec Version: git-master | Resolution: fixed Keywords: NVENC | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 1 | -------------------------------------+----------------------------------- Comment (by alexpigment): This doesn't appear to be addressed on my end. I've tested the latest Zeranoe build, but I also compiled a nightly Win32 build with the relevant patch applied. See "stairstepping.png" attachment. Did either dpavlekovic or oromit test the reproduction steps to make sure the fix worked in that scenario? -- Ticket URL: <https://trac.ffmpeg.org/ticket/6260#comment:4> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#6260: NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive -------------------------------------+------------------------------------ Reporter: alexpigment | Owner: Type: defect | Status: reopened Priority: normal | Component: avcodec Version: git-master | Resolution: Keywords: NVENC | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 1 | -------------------------------------+------------------------------------ Changes (by alexpigment): * status: closed => reopened * resolution: fixed => -- Ticket URL: <https://trac.ffmpeg.org/ticket/6260#comment:5> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#6260: NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive -------------------------------------+------------------------------------ Reporter: alexpigment | Owner: Type: defect | Status: reopened Priority: normal | Component: avcodec Version: git-master | Resolution: Keywords: NVENC | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 1 | -------------------------------------+------------------------------------ Comment (by tbucher): I ran into the same issue with a build from a couple of weeks ago, haven't updated since to verify whether the mentioned fix has changed anything. At that time I found out that the aliasing artifacts manifest themselves while using nvenc with yuv420p colorspace, enforcing it to nv12 fixed it. Can you confirm that nv12 works properly for you as well? If yes, it might be a lead for developers to follow. -- Ticket URL: <https://trac.ffmpeg.org/ticket/6260#comment:6> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#6260: NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive -------------------------------------+------------------------------------ Reporter: alexpigment | Owner: Type: defect | Status: reopened Priority: normal | Component: avcodec Version: git-master | Resolution: Keywords: NVENC | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 1 | -------------------------------------+------------------------------------ Comment (by alexpigment): Yes, adding -pix_fmt nv12 does indeed fix the problem! Thanks for that tip, tbucher. This does make me wonder what to do with this issue. Do we consider this an issue with yuv420p that needs to be addressed, or should nv12 become the default selection when nothing is explicitly set? I know that with h264_qsv, yuv420p is not even an option and it will fall back to nv12 even if you specify yuv420p explictly. -- Ticket URL: <https://trac.ffmpeg.org/ticket/6260#comment:7> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#6260: NVENC H.264 encoding causes aliasing / stair-stepping colors, worse on interlaced than progressive -------------------------------------+------------------------------------ Reporter: alexpigment | Owner: (none) Type: defect | Status: reopened Priority: normal | Component: avcodec Version: git-master | Resolution: Keywords: NVENC | Blocked By: Blocking: | Reproduced by developer: 1 Analyzed by developer: 1 | -------------------------------------+------------------------------------ Comment (by Balling): Well, whatever the issue was there it no longer happens or -pix_fmt nv12 does not change the produced file. My card is Turing and so does not support interlaced. -- Ticket URL: <https://trac.ffmpeg.org/ticket/6260#comment:8> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg