Hi!

It is possible to do what you want to do. We do that, and more. Have a look at 
the ffmpeg-dev forums. There are some pretty interesting discussions about how 
to use your own cuda context, and even your own cuda stream.

Good luck!

Oscar

El 23 maig 2018, a les 8:24, joep 
<[email protected]<mailto:[email protected]>> va escriure:

Hello,

I am trying to create a program that does the following:
1. decode frames with cuvid
2. run CUDA kernels on the decoded frames
3. encode result with nvenc

In order to do step 2, I need the CUDA kernels to access the decoded frame 
which should be stored in the GPU memory.
For this I think I need to provide the CUDA CUcontext to ffmpeg and give the 
pointer to the decoded frame to the kernel.

I could not find any documentation about this topic.
In the ffmpeg docs I see the AVCodecContext has hw_device_ctx which is a 
AVHWDeviceContext.
AVHWDeviceContext has a hwctx field which can be a AVCUDADeviceContext.
AVCUDADeviceContext has a cuda_ctx field which is a CUcontext.

So I think I need to create a AVHWDeviceContext and set it on the 
AVCodecContext before calling avcodec_open2.
Are my assumptions right?
And how can I create a AVHWDeviceContext with the correct hwctx?

Thanks,
Joep
_______________________________________________
Libav-user mailing list
[email protected]<mailto:[email protected]>
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to