[FFmpeg-devel] cuda-gl

Philip Langdale philipl at overt.org
Mon Apr 30 20:07:31 EEST 2018


On 2018-04-30 08:20, Daniel Oberhoff wrote:
>> On 30. Apr 2018, at 15:52, Daniel Oberhoff 
>> <danieloberhoff at googlemail.com> wrote:
>> 
>> Hello All,
>> 
>> I am fighting since a few days to get the frames from the cuvid 
>> decoder using the cuda pixel format transfered to opengl.
>> 
>> What i have done is create textures on gl using glGenTextures and 
>> glTexStorage2D. The actual format is NV12 in my case, and i properly 
>> allocate two planes with the first one being full size, 1bpp, and the 
>> second size halve size (in both dimensions) and 2bpp. The transfer is 
>> done with cuGraphicsMapResources, cuGraphicsSubResourceGetMappedArray, 
>> cuMemcpy2DAsync, cuGraphicsUnmapResources, running on an allocated 
>> stream, followed by cuStreamSynchronize. But when i draw this (i have 
>> a yuv aware shader) i am missing all the red information, as if the v 
>> channel where 0 everywhere.
>> 
>> Has anyone succeeded in this before? It seems like someone at least 
>> has interest in this, given that the needed functions appeared in 
>> nv_codec_headers recently.
> 
> Ok
> 
> So i found i had a very stupid mistake where the code later assumed
> triplanar pixel format. Sorry for spamming, works like a charm :).
> 

I'm glad it worked, but to answer your question - I added cuda-gl 
interop to mpv and the headers
were added when I moved mpv to use nv-codec-headers instead of having 
its own separate loader.

You can look at mpv for a working example, if you still want one.

--phil


More information about the ffmpeg-devel mailing list