问题描述
我有Nvidia 1050Ti GPU
我用cuda测试ffmpeg
ffmpeg -hwaccel nvdec -hwaccel_output_format cuda -i input.mp4 -y \
-c:v h264_nvenc -c:a libmp3lame -b:v 3M \
-filter_complex hwdownload,scale=w=iw*min(1280/iw\,720/ih):h=ih*min(1280/iw\,720/ih),hwupload out.mp4
错误:
[hwupload @ 00000199b49c1080] A hardware device reference is required to upload frames to.
[Parsed_hwupload_2 @ 000001999ba8ee80] Query format Failed for 'Parsed_hwupload_2': Invalid argument
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion Failed!
我想要不使用cpu的完整硬件转码。
解决方法
您可以使用硬件NVIDIA GPU对其进行完整的转码。
您需要启用CUDA功能的手动编译FFmpeg。因为services:
mongodb:
image: mongo
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
是使用CPU资源的软件。另一方面,scale
和scale_npp
使用GPU资源(有限的选项)。
scale_cuda
:向下移动到ram,这意味着GPU VRAM-> RAM中的数据。
hwdownload
:倒置hwupload
。注意:NVENC仅适用于GPU VRAM。