How to use NVCUVID

hi all. I am using NVCUVID to decode H264. I do not want to use the parser NVIDIA provide,but as there is no document about NVCUVID, i do not know the meaning of the struct CUVIDPICPARAMS, so i can’t fill the struct, anyone knows how to solve this problem? Many thanks~

anyone knows~~

I do not have what I am doing working 100% yet, but it is getting there.

I do NOT recommend trying to replace the parser - this is a complete black box as are the rest of the components. There is no documentation and there is little in the way of help for what you would appear to be trying to do. I suspect the parser may be operating partly in host memory and partly in device memory such that it would be impossible to sort out what is going on - leastwise without any source.

Replacing the VideoSource component is probably closer to what you want to do and is quite doable. It operates entirely in host memory and simply reads a file and servers it up to the parser in chunks. 64KB chunks works well and appears to be what the VideoSource component is doing.

First, thanks for your reply. Yes,you are right, it is difficult to decode the bitstream without using NV’ parser, so i used it, but another problem occurred. It is said in many websites that the NV’s parser can parse raw NALU, so i give the NALU to the parser, but when i debug, i set a breakpoint in the parser’s callback functions, i find that the callback functions does not execute, what kind of data does the parser can parse?

Besides, this is the website where i find the parser can parse raw NALU http://neuron2.net/dgdecnv/cuda/cuda.html, i use the demo and data it gives, when i use his NALU file “holzi.264”, the callback functions can execute, but when i use mine, it does not execute, i am really confused

I have my code working fine on H.264 video where I am feeding the parser simply 64K blocks from a file. However, when I do this with an MPEG2 video it does not work at all - I get black frames and exceptions on the GPU in cuvidDecodePicture. The sample program for video decode works fine with both the H.264 and MPEG2 video, so I know it has to be something I am doing…

I also feed the parser simply 64K blocks from a mp4 file,but i can not work. Yesterday i have confirmed that the parser can parse the raw NALUs.The problem i face now is that how to get NALU from a mp4 file. I read the mp4 file and calculate the sample offset according chunk offset and sample offset in the chunk, then i read it from file, i get data like this"00 00 6B DB 25 B8 4A FF F3 E7 51 00 00 20 3F 45 26 4D 20 D5 39 DA F1 57 88 29 B7 28 0D 01 38 82", the “00 00 6B DB” means length, does the data "25 B8 4A FF F3 E7 51 00 00 20 3F 45 26 …"means NALU? When i feed this data “00 00 00 01 25 B8 4A FF F3 E7 51 00 00 20 3F 45 26 …” to parser, it can not parse, so i doubt this is not standard NALU. Now i am figuring out the relationship between MP4 sample and NALU.

Well, I’m not sure I can be a lot of help… but I will tell you what I know.

MP4/MPEG 4 is a container and I believe it is structured generally like a Quicktime .MOV file. You have a container with H.264 in it, right? Only the .MP4 “container” is obscuring the lower level of the structure you are looking for.

I don’t think you are going to get raw H.264 out of a .MP4 file very easily, and I am pretty sure the NVCUVID parser does not handle the .MP4 file sturcture. Taking .MP4 apart to get the H.264 content is going to be your responsibility - and I do not believe it is trivial.

The parser takes in elementary video streams, so you probably need to have a demultiplexer to extract raw elementary stream form the container.
The decoder picture parameters are actually quite similar to DXVA picture parameters on Windows, and most of the fields come directly from the associated ITU H.26x specification (you have to know what you’re doing if you want to bypass the parser component)