I encountered some problems when installing ffmpeg with the NVIDIA video codec 12.2. It went smoothly when I built ffmpeg following the instructions on the web page. However, when conducting basic tests, problems occurred. It seemed that the GPU wasn’t detected or recognized properly.
The command is following.
ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i 05.mp4 -c:a copy -c:v h264_nvenc -b:v 5M ~/05__01.mp4
I got the error message:
[hevc @ 0x55cca2df4e80] decoder->cvdl->cuvidGetDecoderCaps(&caps) failed -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
[hevc @ 0x55cca2df4e80] Failed setup for format cuda: hwaccel initialisation returned error.
[h264_nvenc @ 0x55cca1f09c00] OpenEncodeSessionEx failed: unsupported device (2): (no details)
[vost#0:0/h264_nvenc @ 0x55cca2079e40] [enc:h264_nvenc @ 0x55cca2077bc0] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[vf#0:0 @ 0x55cca1f05b80] Error sending frames to consumers: Function not implemented
[vf#0:0 @ 0x55cca1f05b80] Task finished with error code: -38 (Function not implemented)
[vf#0:0 @ 0x55cca1f05b80] Terminating thread with return code -38 (Function not implemented)
[vost#0:0/h264_nvenc @ 0x55cca2079e40] [enc:h264_nvenc @ 0x55cca2077bc0] Could not open encoder before EOF
[vost#0:0/h264_nvenc @ 0x55cca2079e40] Task finished with error code: -22 (Invalid argument)
[vost#0:0/h264_nvenc @ 0x55cca2079e40] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 0x55cca2087b00] Nothing was written into output file, because at least one of its streams received no packets.
The output of nvidia-smi
root@99bfc7c77719:/data/src/a0/ffmpeg# nvidia-smi
Thu Dec 19 02:43:57 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.142 Driver Version: 550.142 CUDA Version: 12.5 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA A10 Off | 00000000:00:08.0 Off | 0 |
| 0% 36C P0 23W / 150W | 1MiB / 23028MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
and run deviceQuery
root@99bfc7c77719:/data/src/cuda-samples# ./bin/x86_64/linux/release/deviceQuery
./bin/x86_64/linux/release/deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "NVIDIA A10"
CUDA Driver Version / Runtime Version 12.5 / 12.5
CUDA Capability Major/Minor version number: 8.6
Total amount of global memory: 22716 MBytes (23819976704 bytes)
(072) Multiprocessors, (128) CUDA Cores/MP: 9216 CUDA Cores
GPU Max Clock rate: 1695 MHz (1.70 GHz)
Memory Clock rate: 6251 Mhz
Memory Bus Width: 384-bit
L2 Cache Size: 6291456 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total shared memory per multiprocessor: 102400 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 2 copy engine(s)
Run time limit on kernels: No
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Enabled
Device supports Unified Addressing (UVA): Yes
Device supports Managed Memory: Yes
Device supports Compute Preemption: Yes
Supports Cooperative Kernel Launch: Yes
Supports MultiDevice Co-op Kernel Launch: Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 0 / 8
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 12.5, CUDA Runtime Version = 12.5, NumDevs = 1
Result = PASS
I’ve checked the DataSheet. The A10 should support Nvidia video codec. So I’d like to ask what the possible problems could be.
I use nvidia/cuda:12.5.1-devel-ubuntu24.04 as base image.