NVEnc icon indicating copy to clipboard operation
NVEnc copied to clipboard

Deinterlacing seems to have no effect

Open danielly2020 opened this issue 9 months ago • 10 comments

When I convert some interlaced videos to H265 using --interlace tff --vpp-yadif in v8.03, it seems to have no effect.

When I tested with v7.82 in the same environment, it works well. I'm not sure if it's a problem with v8.03.

danielly2020 avatar Apr 21 '25 06:04 danielly2020

It seems to work fine in NVEnc 8.03 with my several tests.

Would you please let me know the exact command line and the details of the input file (format, codec, resolution, framerate, etc)?

rigaya avatar Apr 21 '25 12:04 rigaya

It seems to work fine in NVEnc 8.03 with my several tests.

Would you please let me know the exact command line and the details of the input file (format, codec, resolution, framerate, etc)?

I then did some more testing with the new v8.04 and finally found the reason for the failure was "--avsw" (the default value of my gui), "--avhw" was OK. But in v7.82 both were successful. Here are my test information:

Original Video Info:

General
Complete name                  : E:\Download\Aria2Down\Test.VOB
Format                         : MPEG-PS
File size                      : 1 024 MiB
Duration                       : 16 min 59 s
Overall bit rate mode          : Variable
Overall bit rate               : 8 423 kb/s
Frame rate                     : 25.000 FPS

Video
ID                             : 224 (0xE0)
Format                         : MPEG Video
Format version                 : Version 2
Format profile                 : Main@Main
Format settings                : CustomMatrix / BVOP
Format settings, BVOP          : Yes
Format settings, Matrix        : Custom
Format settings, GOP           : M=3, N=12
Format settings, picture struc : Frame
Duration                       : 16 min 59 s
Bit rate mode                  : Variable
Bit rate                       : 7 584 kb/s
Maximum bit rate               : 9 000 kb/s
Width                          : 720 pixels
Height                         : 576 pixels
Display aspect ratio           : 4:3
Frame rate                     : 25.000 FPS
Standard                       : PAL
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Scan type                      : Interlaced
Scan order                     : Top Field First
Compression mode               : Lossy
Bits/(Pixel*Frame)             : 0.731
Time code of first frame       : 00:00:15:12
Time code source               : Group of pictures header
GOP, Open/Closed               : Open
Stream size                    : 922 MiB (90%)

Encode Info:

1. Test-8.04-avsw

NVEncC64.exe --avsw -i "E:\Download\Aria2Down\Test.VOB" --video-metadata clear --metadata clear -c hevc --vbr 2500 --bframes 3 --ref 3 --bref-mode each --preset quality --tier main --lookahead 16 --no-aq --level 3.1 --multipass 2pass-full --mv-precision Q-pel --avsync cfr --interlace tff --vpp-yadif -o "E:\Output\Test-8.04-avsw.mp4"
--------------------------------------------------------------------------------
E:\Output\Test-8.04-avsw.mp4
--------------------------------------------------------------------------------
NVEncC (x64) 8.04 (r3322) by rigaya, Apr 22 2025 12:29:16 (VC 1929/Win)
OS Version     Windows 10 x64 (19044) [UTF-8]
CPU            AMD Ryzen 5 5600 6-Core Processor [4.45GHz] (6C/12T)
GPU            #0: NVIDIA GeForce GTX 1660 (1408 cores, 1785 MHz)[PCIe3x16][572.61]
NVENC / CUDA   NVENC API 13.0, CUDA 12.8, schedule mode: auto
Input Buffers  CUDA, 32 frames
Input Info     avsw: mpeg2video(yv12)->nv12 [AVX2], 720x576, 25/1 fps
Vpp Filters    cspconv(nv12 -> yv12)
               yadif: mode auto
               cspconv(yv12 -> nv12)
Output Info    H.265/HEVC main @ Level 3.1
               720x576p 16:15 25.000fps (25/1fps)
               avwriter: hevc => mp4
Encoder Preset quality
Rate Control   VBR
Multipass      2pass-full
Bitrate        2500 kbps (Max: 9600 kbps)
Target Quality auto
QP range       I:0-51  P:0-51  B:0-51
QP Offset      cb:0  cr:0
VBV buf size   auto
Split Enc Mode auto
Lookahead      on, 16 frames, Level 0, Adaptive I, B Insert
GOP length     250 frames
B frames       3 frames [ref mode: each]
Ref frames     3 frames, MultiRef L0:auto L1:auto
AQ             off
CU max / min   auto / auto
Others         mv:Q-pel
[mpeg2video @ 0000000003ef3180] ac-tex damaged at 39 1500:00, GPU 13%, VE 98%, est out size 306.8MB
[mpeg2video @ 0000000003ef3180] Warning MVs not available

encoded 25494 frames, 495.21 fps, 2542.36 kbps, 309.06 MB
encode time 0:00:51, CPU: 11.8%, GPU: 11.7%, VE: 98.0%, GPUClock: 1914MHz, VEClock: 1779MHz
frame type IDR   336
frame type I     336,  avgQP  23.00,  total size    9.45 MB
frame type P   10783,  avgQP  21.62,  total size  177.71 MB
frame type B   14375,  avgQP  24.82,  total size  121.90 MB

2. Test-8.04-avhw

NVEncC64.exe --avhw -i "E:\Download\Aria2Down\Test.VOB" --video-metadata clear --metadata clear -c hevc --vbr 2500 --bframes 3 --ref 3 --bref-mode each --preset quality --tier main --lookahead 16 --no-aq --level 3.1 --multipass 2pass-full --mv-precision Q-pel --avsync cfr --interlace tff --vpp-yadif -o "E:\Output\Test-8.04-avhw.mp4"
--------------------------------------------------------------------------------
E:\Output\Test-8.04-avhw.mp4
--------------------------------------------------------------------------------
NVEncC (x64) 8.04 (r3322) by rigaya, Apr 22 2025 12:29:16 (VC 1929/Win)
OS Version     Windows 10 x64 (19044) [UTF-8]
CPU            AMD Ryzen 5 5600 6-Core Processor [4.38GHz] (6C/12T)
GPU            #0: NVIDIA GeForce GTX 1660 (1408 cores, 1785 MHz)[PCIe3x16][572.61]
NVENC / CUDA   NVENC API 13.0, CUDA 12.8, schedule mode: auto
Input Buffers  CUDA, 32 frames
Input Info     avcuvid: MPEG2, 720x576, 25/1 fps
Vpp Filters    cspconv(nv12 -> yv12)
               yadif: mode auto
               cspconv(yv12 -> nv12)
Output Info    H.265/HEVC main @ Level 3.1
               720x576p 16:15 25.000fps (25/1fps)
               avwriter: hevc => mp4
Encoder Preset quality
Rate Control   VBR
Multipass      2pass-full
Bitrate        2500 kbps (Max: 9600 kbps)
Target Quality auto
QP range       I:0-51  P:0-51  B:0-51
QP Offset      cb:0  cr:0
VBV buf size   auto
Split Enc Mode auto
Lookahead      on, 16 frames, Level 0, Adaptive I, B Insert
GOP length     250 frames
B frames       3 frames [ref mode: each]
Ref frames     3 frames, MultiRef L0:auto L1:auto
AQ             off
CU max / min   auto / auto
Others         mv:Q-pel

encoded 25494 frames, 483.30 fps, 2545.33 kbps, 309.42 MB
encode time 0:00:52, CPU: 7.8%, GPU: 16.5%, VE: 96.7%, VD: 24.7%, GPUClock: 1914MHz, VEClock: 1779MHz
frame type IDR   275
frame type I     275,  avgQP  20.69,  total size    6.28 MB
frame type P   11025,  avgQP  19.52,  total size  176.21 MB
frame type B   14194,  avgQP  22.78,  total size  126.93 MB

3. The effect of both:

Image

4. Test-7.82-avsw

NVEncC64.exe --avsw -i "E:\Download\Aria2Down\Test.VOB" --video-metadata clear --metadata clear -c hevc --vbr 2500 --bframes 3 --ref 3 --bref-mode each --preset quality --tier main --lookahead 16 --no-aq --level 3.1 --multipass 2pass-full --mv-precision Q-pel --avsync cfr --interlace tff --vpp-yadif -o "E:\Output\Test-7.82-avsw.mp4"
--------------------------------------------------------------------------------
E:\Output\Test-7.82-avsw.mp4
--------------------------------------------------------------------------------
NVEncC (x64) 7.82 (r3146) by rigaya, Jan 19 2025 09:39:23 (VC 1929/Win)
OS Version     Windows 10 x64 (19044) [UTF-8]
CPU            AMD Ryzen 5 5600 6-Core Processor [4.38GHz] (6C/12T)
GPU            #0: NVIDIA GeForce GTX 1660 (1408 cores, 1785 MHz)[PCIe3x16][572.61]
NVENC / CUDA   NVENC API 12.2, CUDA 12.8, schedule mode: auto
Input Buffers  CUDA, 32 frames
Input Info     avsw: mpeg2video(yv12)->nv12 [AVX2], 720x576, 25/1 fps
Vpp Filters    copyHtoD
               cspconv(nv12 -> yv12)
               yadif: mode auto
               cspconv(yv12 -> nv12)
Output Info    H.265/HEVC main @ Level 3.1
               720x576p 16:15 25.000fps (25/1fps)
               avwriter: hevc => mp4
Encoder Preset quality
Rate Control   VBR
Multipass      2pass-full
Bitrate        2500 kbps (Max: 9600 kbps)
Target Quality auto
QP range       I:0-51  P:0-51  B:0-51
QP Offset      cb:0  cr:0
VBV buf size   auto
Split Enc Mode auto
Lookahead      on, 16 frames, Level 0, Adaptive I, B Insert
GOP length     250 frames
B frames       3 frames [ref mode: each]
Ref frames     3 frames, MultiRef L0:auto L1:auto
AQ             off
CU max / min   auto / auto
Others         mv:Q-pel
[mpeg2video @ 00000000101b0300] ac-tex damaged at 39 150:03, GPU 16%, VE 99%, est out size 327.5MB
[mpeg2video @ 00000000101b0300] Warning MVs not available

encoded 25494 frames, 491.52 fps, 2545.50 kbps, 309.44 MB
encode time 0:00:51, CPU: 7.2%, GPU: 13.7%, VE: 97.1%, GPUClock: 1914MHz, VEClock: 1779MHz
frame type IDR   274
frame type I     274,  avgQP  20.70,  total size    6.28 MB
frame type P   10985,  avgQP  19.54,  total size  175.86 MB
frame type B   14235,  avgQP  22.75,  total size  127.30 MB

5. Test-7.82-avhw

NVEncC64.exe --avhw -i "E:\Download\Aria2Down\Test.VOB" --video-metadata clear --metadata clear -c hevc --vbr 2500 --bframes 3 --ref 3 --bref-mode each --preset quality --tier main --lookahead 16 --no-aq --level 3.1 --multipass 2pass-full --mv-precision Q-pel --avsync cfr --interlace tff --vpp-yadif -o "E:\Output\Test-7.82-avhw.mp4"
--------------------------------------------------------------------------------
E:\Output\Test-7.82-avhw.mp4
--------------------------------------------------------------------------------
NVEncC (x64) 7.82 (r3146) by rigaya, Jan 19 2025 09:39:23 (VC 1929/Win)
OS Version     Windows 10 x64 (19044) [UTF-8]
CPU            AMD Ryzen 5 5600 6-Core Processor [4.38GHz] (6C/12T)
GPU            #0: NVIDIA GeForce GTX 1660 (1408 cores, 1785 MHz)[PCIe3x16][572.61]
NVENC / CUDA   NVENC API 12.2, CUDA 12.8, schedule mode: auto
Input Buffers  CUDA, 32 frames
Input Info     avcuvid: MPEG2, 720x576, 25/1 fps
Vpp Filters    cspconv(nv12 -> yv12)
               yadif: mode auto
               cspconv(yv12 -> nv12)
Output Info    H.265/HEVC main @ Level 3.1
               720x576p 16:15 25.000fps (25/1fps)
               avwriter: hevc => mp4
Encoder Preset quality
Rate Control   VBR
Multipass      2pass-full
Bitrate        2500 kbps (Max: 9600 kbps)
Target Quality auto
QP range       I:0-51  P:0-51  B:0-51
QP Offset      cb:0  cr:0
VBV buf size   auto
Split Enc Mode auto
Lookahead      on, 16 frames, Level 0, Adaptive I, B Insert
GOP length     250 frames
B frames       3 frames [ref mode: each]
Ref frames     3 frames, MultiRef L0:auto L1:auto
AQ             off
CU max / min   auto / auto
Others         mv:Q-pel

encoded 25494 frames, 489.00 fps, 2545.33 kbps, 309.42 MB
encode time 0:00:52, CPU: 7.0%, GPU: 15.7%, VE: 96.8%, VD: 24.8%, GPUClock: 1908MHz, VEClock: 1773MHz
frame type IDR   275
frame type I     275,  avgQP  20.69,  total size    6.28 MB
frame type P   11025,  avgQP  19.52,  total size  176.21 MB
frame type B   14194,  avgQP  22.78,  total size  126.93 MB

Finally, both '-- avsw' and '-- avhw' were successful in 7.82. I found that the difference from 8.04 is the NVENC API, I don't know if it's related to this. Thank you very much for your reply.

danielly2020 avatar Apr 22 '25 19:04 danielly2020

Thank you for the detailed information, it will help much.

I'll check further for the --avsw behavior.

rigaya avatar Apr 23 '25 22:04 rigaya

Unfortunately, I were not able to reproduce the issue even with --avsw, it seems to depend on input file.

Checking the source code, I've found a place which might be the cause of this issue, but as I'm unsure if it actually solve the problem, I've created a test build below.

Would you please test using the test build below and check if it solves the problem? https://nightly.link/rigaya/NVEnc/actions/runs/14690619855/NVEncC_release_r3323_x64.zip

rigaya avatar Apr 27 '25 11:04 rigaya

Yes, I did test this version. Unfortunately this version also failed even though I changed the input file. Then I reinstalled the old driver (561.17) for testing, and now both versions call the same api "NVENC / CUDA NVENC API 12.2, CUDA 12.6".

NVEncC64.exe --avsw -i "E:\Download\Aria2Down\Test.VOB" --video-metadata clear --metadata clear --seekto 300.0 -c hevc --vbr 2500 --bframes 3 --ref 3 --bref-mode each --preset quality --tier main --lookahead 16 --no-aq --level 3.1 --multipass 2pass-full --mv-precision Q-pel --avsync cfr --interlace tff --vpp-yadif -o "E:\Output\Test-8.04-avsw-new.mp4"
--------------------------------------------------------------------------------
E:\Output\Test-8.04-avsw-new.mp4
--------------------------------------------------------------------------------
NVEncC (x64) 8.04 (r3323) by rigaya, Apr 27 2025 09:42:56 (VC 1929/Win)
OS Version     Windows 10 x64 (19044) [UTF-8]
CPU            AMD Ryzen 5 5600 6-Core Processor [4.45GHz] (6C/12T)
GPU            #0: NVIDIA GeForce GTX 1660 (1408 cores, 1785 MHz)[PCIe3x16][561.17]
NVENC / CUDA   NVENC API 12.2, CUDA 12.6, schedule mode: auto
Input Buffers  CUDA, 32 frames
Input Info     avsw: mpeg2video(yv12)->nv12 [AVX2], 720x576, 25/1 fps
Vpp Filters    cspconv(nv12 -> yv12)
               yadif: mode auto
               cspconv(yv12 -> nv12)
Output Info    H.265/HEVC main @ Level 3.1
               720x576p 16:15 25.000fps (25/1fps)
               avwriter: hevc => mp4
Encoder Preset quality
Rate Control   VBR
Multipass      2pass-full
Bitrate        2500 kbps (Max: 9600 kbps)
Target Quality auto
QP range       I:0-51  P:0-51  B:0-51
QP Offset      cb:0  cr:0
VBV buf size   auto
Split Enc Mode auto
Lookahead      on, 16 frames, Level 0, Adaptive I, B Insert
GOP length     250 frames
B frames       3 frames [ref mode: each]
Ref frames     3 frames, MultiRef L0:auto L1:auto
AQ             off
CU max / min   auto / auto
Others         mv:Q-pel

NVEncC64.exe --avsw -i "E:\Download\Aria2Down\Test.VOB" --video-metadata clear --metadata clear --seekto 300.0 -c hevc --vbr 2500 --bframes 3 --ref 3 --bref-mode each --preset quality --tier main --lookahead 16 --no-aq --level 3.1 --multipass 2pass-full --mv-precision Q-pel --avsync cfr --interlace tff --vpp-yadif -o "E:\Output\Test-7.82-avsw-new.mp4"
--------------------------------------------------------------------------------
E:\Output\Test-7.82-avsw-new.mp4
--------------------------------------------------------------------------------
NVEncC (x64) 7.82 (r3146) by rigaya, Jan 19 2025 09:39:23 (VC 1929/Win)
OS Version     Windows 10 x64 (19044) [UTF-8]
CPU            AMD Ryzen 5 5600 6-Core Processor [4.38GHz] (6C/12T)
GPU            #0: NVIDIA GeForce GTX 1660 (1408 cores, 1785 MHz)[PCIe3x16][561.17]
NVENC / CUDA   NVENC API 12.2, CUDA 12.6, schedule mode: auto
Input Buffers  CUDA, 32 frames
Input Info     avsw: mpeg2video(yv12)->nv12 [AVX2], 720x576, 25/1 fps
Vpp Filters    copyHtoD
               cspconv(nv12 -> yv12)
               yadif: mode auto
               cspconv(yv12 -> nv12)
Output Info    H.265/HEVC main @ Level 3.1
               720x576p 16:15 25.000fps (25/1fps)
               avwriter: hevc => mp4
Encoder Preset quality
Rate Control   VBR
Multipass      2pass-full
Bitrate        2500 kbps (Max: 9600 kbps)
Target Quality auto
QP range       I:0-51  P:0-51  B:0-51
QP Offset      cb:0  cr:0
VBV buf size   auto
Split Enc Mode auto
Lookahead      on, 16 frames, Level 0, Adaptive I, B Insert
GOP length     250 frames
B frames       3 frames [ref mode: each]
Ref frames     3 frames, MultiRef L0:auto L1:auto
AQ             off
CU max / min   auto / auto
Others         mv:Q-pel

Everything is the same except the version, 7.82 works fine, while 8.04 still fails with --avsw. I tested all versions of 8.x and several 7.x, the result is that 7.x all works fine and 8.x with --avsw all fail, so I think the issue started from 8.00.

danielly2020 avatar Apr 28 '25 15:04 danielly2020

Thanks for testing and letting me know the result. Yes, the issue should have started from 8.00, which I've done a big internal code rearrangement.

Would you please have a test with another build? I've now tried to getting the behavior more close to the older 7.xx. https://nightly.link/rigaya/NVEnc/actions/runs/14722333854/NVEncC_release_r3326_x64.zip

rigaya avatar Apr 29 '25 04:04 rigaya

Thanks for testing and letting me know the result. Yes, the issue should have started from 8.00, which I've done a big internal code rearrangement.

Would you please have a test with another build? I've now tried to getting the behavior more close to the older 7.xx. https://nightly.link/rigaya/NVEnc/actions/runs/14722333854/NVEncC_release_r3326_x64.zip

I did test this build. Unfortunately this build still failed. Sorry, I don't have more Nvidia computers to test with, so I can't provide more test information.

danielly2020 avatar Apr 29 '25 17:04 danielly2020

I'm sorry not having able to solve the problem. It seems it highly depends on the input file, and thinking it difficult in solving the issue (without the exact input file).

Would you please try another way instead, changing option --vpp-yadif to --vpp-yadif mode=tff? This might be able to override the issue we have.

rigaya avatar Apr 30 '25 12:04 rigaya

That's ok, we still have --avhw and 7.x working fine, we're just testing this. One of the test videos I downloaded is named: Tetsuo The Ironman. If you want, you can download it and test it. Here is the magnet link: magnet:?xt=urn:btih:B7B9A8F021A3648381BCC24EA7BD3CA5A76FD782

danielly2020 avatar Apr 30 '25 14:04 danielly2020

OK, I tried --vpp-yadif mode=tff and it worked, thanks for the tip. This option solves the problem.

danielly2020 avatar Apr 30 '25 15:04 danielly2020