<div dir="ltr">Helo dr.strashni,<div>I tried this, though LOG(LOG_LEVEL_ERROR) was not compiling.</div><div>the output is:</div><div>Available device types:<br>dxva2<br>d3d11va<br></div><div><br></div><div>output does not contain cuda.</div><div>but as I mentioned in my issue post, ffmpeg outputs it in hardware accelerators list.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 5, 2022 at 4:59 PM Strahinja Radman <<a href="mailto:dr.strashni@gmail.com">dr.strashni@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On 5. 7. 2022., at 11:10, Santosh Kamble <<a href="mailto:skamble@cemtrexlabs.com" target="_blank">skamble@cemtrexlabs.com</a>> wrote:<br>
> <br>
> Helo,<br>
> I am trying to decode a video stream in C++ application using ffmpeg cuda hardware acceleration.<br>
> My windows machine has GPU is GTX1060  Update driver version 512.59<br>
> <br>
> <br>
> err = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_CUDA,<br>
> NULL, NULL, 0) <br>
> <br>
> Function fails with errorcode -12<br>
> but when I pass AV_HWDEVICE_TYPE_DXVA2, it succeeds.<br>
> <br>
> ----------------------------<br>
> My observations about ffmpeg cuda compiled tool :<br>
>   I observed that cuda based image decoding and video decoding is working fine using ffmpeg tool as below example works and use GPU for decoding purpose.<br>
> ex1. ffmpeg -hwaccel cuda -i "D:\myvideo.avi"  output.mp4<br>
> ex2. ffmpeg -hwaccel cuda -i D:\myvideo.mp4 -y ./tests/%04d.jpg<br>
> <br>
> also the tool shows it supports cuda hardware acceleration.<br>
> command:  ffmpeg.exe -hwaccels<br>
> output: ffmpeg version 4.4.git Copyright (c) 2000-2022 the FFmpeg developers<br>
>   built with Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30140 for x64<br>
>   configuration: --enable-nonfree --enable-shared --enable-ffnvcodec --enable-cuda-llvm --enable-gpl --disable-debug --enable-cuda-nvcc --enable-libnpp --toolchain=msvc --extra-cflags=-I../nv_sdk --extra-ldflags='-libpath:../nv_sdk' --nvccflags='-gencode arch=compute_60,code=sm_60 -O2'<br>
>   libavutil      57. 24.101 / 57. 24.101<br>
>   libavcodec     59. 28.100 / 59. 28.100<br>
>   libavformat    59. 23.100 / 59. 23.100<br>
>   libavdevice    59.  6.100 / 59.  6.100<br>
>   libavfilter     8. 38.100 /  8. 38.100<br>
>   libswscale      6.  6.100 /  6.  6.100<br>
>   libswresample   4.  6.100 /  4.  6.100<br>
>   libpostproc    56.  5.100 / 56.  5.100<br>
> Hardware acceleration methods:<br>
> cuda<br>
> dxva2<br>
> d3d11va<br>
> <br>
> <br>
> -----------------------------------------<br>
> <br>
> <br>
> So it looks like the compiled libraries are fine. I am missing some other thing.<br>
> Can someone help on this cuda based decoding using ffmpeg.<br>
> <br>
> <br>
> Thanks<br>
> Santosh<br>
> _______________________________________________<br>
> Libav-user mailing list<br>
> <a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
> <a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
> <br>
> To unsubscribe, visit link above, or email<br>
> <a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe”.<br>
<br>
<br>
Hello Santosh,<br>
<br>
You can try this piece of code in order to get the type by name or search for available types for your GPU.<br>
<br>
    type = av_hwdevice_find_type_by_name("cuda");<br>
    if (type == AV_HWDEVICE_TYPE_NONE)<br>
    {<br>
        LOG(LOG_LEVEL_ERROR) << "Device type " << "cuda" << " is not supported.";<br>
        LOG(LOG_LEVEL_ERROR) << "Available device types:";<br>
        while ((type = av_hwdevice_iterate_types(type)) != AV_HWDEVICE_TYPE_NONE)<br>
            LOG(LOG_LEVEL_INFO) << av_hwdevice_get_type_name(type);<br>
    }<br>
<br>
<br>
<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br>
</blockquote></div>