[Libav-user] av_hwdevice_ctx_create fails when using AV_HWDEVICE_TYPE_CUDA
Santosh Kamble
skamble at cemtrexlabs.com
Tue Jul 5 12:10:31 EEST 2022
Helo,
I am trying to decode a video stream in C++ application using ffmpeg cuda
hardware acceleration.
My windows machine has GPU is GTX1060 Update driver version 512.59
err = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_CUDA,
NULL, NULL, 0)
Function fails with errorcode -12
but when I pass AV_HWDEVICE_TYPE_DXVA2, it succeeds.
----------------------------
My observations about ffmpeg cuda compiled tool :
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.
ex1. ffmpeg -hwaccel cuda -i "D:\myvideo.avi" output.mp4
ex2. ffmpeg -hwaccel cuda -i D:\myvideo.mp4 -y ./tests/%04d.jpg
also the tool shows it supports cuda hardware acceleration.
command: ffmpeg.exe -hwaccels
output: ffmpeg version 4.4.git Copyright (c) 2000-2022 the FFmpeg developers
built with Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30140
for x64
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'
libavutil 57. 24.101 / 57. 24.101
libavcodec 59. 28.100 / 59. 28.100
libavformat 59. 23.100 / 59. 23.100
libavdevice 59. 6.100 / 59. 6.100
libavfilter 8. 38.100 / 8. 38.100
libswscale 6. 6.100 / 6. 6.100
libswresample 4. 6.100 / 4. 6.100
libpostproc 56. 5.100 / 56. 5.100
Hardware acceleration methods:
cuda
dxva2
d3d11va
-----------------------------------------
So it looks like the compiled libraries are fine. I am missing some other
thing.
Can someone help on this cuda based decoding using ffmpeg.
Thanks
Santosh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220705/dc5951d3/attachment.htm>
More information about the Libav-user
mailing list