0

I wanted to transcode my videos that have hevc encoding into h.264 using ffmpeg with Nvidia CUDA acceleration. Basically I've followed the guide provided in the official documentation and read through CUDA part in here

My GPU is GeForce RTX2060 and the OS is Windows 10

ffmpeg configuration just after start says:

ffmpeg version 5.1.2-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100

So all the required options for Nvidia encoding are in the list.

Then I tried to transcode a video in mkv format with encoding H.265 (hevc) into h.264 using h264_nvenc . Here is the line

 ffmpeg -hwaccel cuda -hwaccel_device 0 -hwaccel_output_format cuda -extra_hw_frames 14 -i .\input.mkv -c:v h264_nvenc -profile:v high444p -pixel_format yuva444p16le -preset lossless -b:v 1M output.mp4 -y

Even when I leave just this, the error is the same

 ffmpeg -hwaccel cuda -hwaccel_device 0 -hwaccel_output_format cuda -i .\Violet1.mkv -c:v h264_nvenc output.mp4 -y

Here is the error message:

Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_nvenc @ 000002023642d7c0] 10 bit encode not supported
[h264_nvenc @ 000002023642d7c0] Provided device doesn't support required NVENC features
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Also, If I take another file with encoding H.265 (hev1) in mp4 format and use the command below, then it works fine.

ffmpeg -hwaccel cuda -hwaccel_device 0 -hwaccel_output_format cuda -extra_hw_frames 5 -i .\hev1.mp4 -gpu 0 -c:v h264_nvenc -profile:v high444p -preset lossless -b:v 1M output.mp4 -y

It's the same as the first command but with different extra_hw_frames and output file

My guess is that the problem in encoding from mkv or hevc codec specifically or maybe I have to change some options, but I haven't found anything about this error in the net. Thanks everyone how could help

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.