Distorted video with the sample D3D11 encoder, but the CUDA encoder works fine?

I downloaded the latest NVIDIA Codec SDK, and compiled all the sample C++ projects in Visual Studio 2015. I also obtained a raw YUV 4:2:0 video file to use as test.

When using the D3D9 or D3D11 sample applications to encode the video, I get a strange and completely distorted black and white image. This image rapidly scrolls upwards. The amount of frames outputted by the application also does not match (the original video file is 300 frames, while the application only outputs 112).

When using AppEncCuda however, everything works normally and the output is good.

I’m running on Windows 10, GPU driver version 430.64. The GPU is an NVIDIA Quadro M2000M.

Here are the Powershell commands I used, as well as the outputs of these two commands:

.\AppEncD3D11.exe -i .\akiyo_cif.yuv -o .\test.h264 -s 352x288

GPU in use: NVIDIA Quadro M2000M
[INFO ][15:24:54] Encoding Parameters:
	codec        : h264
	preset       : default
	profile      : (default)
	chroma       : yuv420
	bitdepth     : 8
	rc           : constqp (P,B,I=28,31,25)
	fps          : 30/1
	gop          : INF
	bf           : 0
	size         : 352x288
	bitrate      : 0
	maxbitrate   : 0
	vbvbufsize   : 0
	vbvinit      : 0
	aq           : disabled
	temporalaq   : disabled
	lookahead    : disabled
	cq           :  
	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 .\test.h264

.\AppEncCuda.exe -i .\akiyo_cif.yuv -o .\test.h264 -s 352x288

GPU in use: Quadro M2000M
[INFO ][15:26:04] Encoding Parameters:
	codec        : h264
	preset       : default
	profile      : (default)
	chroma       : yuv420
	bitdepth     : 8
	rc           : constqp (P,B,I=28,31,25)
	fps          : 30/1
	gop          : INF
	bf           : 0
	size         : 352x288
	bitrate      : 0
	maxbitrate   : 0
	vbvbufsize   : 0
	vbvinit      : 0
	aq           : disabled
	temporalaq   : disabled
	lookahead    : disabled
	cq           :  
	qmin         : P,B,I=0,0,0
	qmax         : P,B,I=0,0,0
	initqp       : P,B,I=0,0,0
Total frames encoded: 300
Saved in file .\test.h264

Why could this be happening, and how do I fix it?

Hi hugo.zink,

AppEncD3D11 expects the input to be bgra format. Whereas, AppEncCuda can read multiple input formats, with the default format as iyuv. I hope this explains the behavior you see.

Thanks.

Thanks, that explains it! I converted the video to raw bgra using ffmpeg, and the BGRA file works perfectly on the D3D9 and D3D11 encoders now.