'Nvidia codec SDK samples: can't decode an encoded file correctly

I'm trying out the sample applications in the Nvidia video codec sdk, and am having trouble getting a useable decoded result. My input file is YUV 4:2:0, taken from here, which is 352x288px. I'm encoding using the AppEncD3D12.exe sample, with the following command:
.\AppEncD3D12.exe -i D:\akiyo_cif.y4m -s 352x288 -o D:\akiyo_out.mp4
This gives the output

GPU in use: NVIDIA GeForce RTX 2080 Super with Max-Q Design
[INFO ][17:46:39] Encoding Parameters:
        codec        : h264
        preset       : p3
        tuningInfo   : hq
        profile      : (default)
        chroma       : yuv420
        bitdepth     : 8
        rc           : vbr
        fps          : 30/1
        gop          : 250
        bf           : 1
        multipass    : 0
        size         : 352x288
        bitrate      : 0
        maxbitrate   : 0
        vbvbufsize   : 0
        vbvinit      : 0
        aq           : disabled
        temporalaq   : disabled
        lookahead    : disabled
        cq           : 0
        qmin         : P,B,I=0,0,0
        qmax         : P,B,I=0,0,0
        initqp       : P,B,I=0,0,0
Total frames encoded: 112
Saved in file D:\akiyo_out.mp4

Which looks promising. However, using the decode sample, a single frame of the output contains what look like 12 smaller frames of the input, in monochrome. I'm running the decode sample like this:

PS D:\Nvidia\Video_Codec_SDK_11.1.5\Samples\build\Debug> .\AppDecD3D.exe -i D:\akiyo_out.mp4
GPU in use: NVIDIA GeForce RTX 2080 Super with Max-Q Design
Display with D3D9.
[INFO ][17:58:58] Media format: raw H.264 video (h264)
Session Initialization Time: 23 ms
[INFO ][17:58:58] Video Input Information
        Codec        : AVC/H.264
        Frame rate   : 30000/1000 = 30 fps
        Sequence     : Progressive
        Coded size   : [352, 288]
        Display area : [0, 0, 352, 288]
        Chroma       : YUV 420
        Bit depth    : 8
Video Decoding Params:
        Num Surfaces : 7
        Crop         : [0, 0, 0, 0]
        Resize       : 352x288
        Deinterlace  : Weave

Total frame decoded: 112
Session Deinitialization Time: 8 ms

I'm quite new to this so could be doing something stupid. Right now I don't know whether to look at encode or decode! Any ideas or tips most appreciated.

-I've tried other YUV files with the same result. I read that 4:2:2 is not supported, the above is 4:2:0.

  • Using the AppEncCuda sample, the decoded video (played with AppDecD3D.exe) is the correct size and in colour, but the video appears to scroll to the right as it is played, with colour information not scrolling at the same rate as the image


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source