what the data format "cuvidParseVideoData()" can accept?


I’m using CUDA Decoder API to display a mpeg-ts stream from net or ip camera,I’m using the “MPC MpegSplitter” filter to do the demux work(“mpc MpegSplitter” is from the open source project named “mpc player”),below is the dshow graph that I created:


I grabber demuxed es data from the “Video Grabber” filter(it is a “Sample Grabber” filter),and push the data to video parser using below code:

BOOL CuDecoderWorker::RecvData(IMediaSample * pMediaSample)



	if(pMediaSample->IsDiscontinuity() == S_OK)


		nvPacket.flags |= CUVID_PKT_DISCONTINUITY;


	REFERENCE_TIME timeStart,timeEnd;

	if(pMediaSample->GetTime(&timeStart,&timeEnd) == S_OK)


		nvPacket.flags |= CUVID_PKT_TIMESTAMP;

		nvPacket.timestamp = (CUvideotimestamp)timeStart;


	nvPacket.payload_size = pMediaSample->GetActualDataLength();

	pMediaSample->GetPointer((BYTE **)&nvPacket.payload);

	CUresult cuRet = cuvidParseVideoData(




	return (cuRet == CUDA_SUCCESS);


I found if the video format is mpeg2,it is worked fine,video is decoded continuously;but if the video format is h264,video is never be decoded,and I found the “HandleVideoSequence()”,“HandlePictureDecode()” & “HandlePictureDisplay()” callback functions of “VideoParser” class are never be called,so I think is the data I push to parser cause the problem,it is not in the correct format that parser can accept;from some doc I know the parser can accept raw NALUs,but I’m not familar with NALU,now I had get the data that demuxed by mpeg splitter,then how I construct the data to the format that parser can use? :confused:

Check if the data you pass to the parser starts with 0x 00 00 00 01 NALU start code, if not then simply try adding it at the begining of the buffer.