Open morphogencc opened 2 years ago
I've tested hardware decoding with h264_cuvid
. It works. You need to create codec context using something like this:
av::VideoDecoderContext vdec(stream, av::findDecodingCodec("h264_cuvid"))
It works with Nvidia GPU decoding, if you build ffmpeg with support for it. I have not tested with encoding, however. https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/ https://trac.ffmpeg.org/wiki/HWAccelIntro
Hardware-accelerated encoding also works (tested with nvenc). You may need to set low-level libavcodec's fields: hw_device_ctx
and hw_frames_ctx
using av::VideoDecoderContext::raw()
accessor.
Transcoding without raw frames leaving GPU's internal RAM (VRAM) is also possible if hw_frames_ctx->format
is set to appropriate hardware "pixel format", e.g. AV_PIX_FMT_CUDA
. It makes transcoding less PCIe-bandwidth-intensive. I can provide more details if anyone is interested in it.
@teowoz , thanks for answer! I am so happy if you send a PR with minimal sample for nvenc usage. And will thinking about proper wrapping with high level code...
Does avcpp support gpu-accelerated decoding/encoding via nvenc?