我的 NVIDIA 和 FFMPEG 配置如下:Linux TestBox1 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 2 20:41:06 UTC 2024 x86_64 x86_64 x86_64 GNU/LinuxNVIDIA-Linux-x86_64-560....
我的NVIDIA和FFMPEG配置如下:
Linux TestBox1 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC 2024 年 8 月 2 日星期五 20:41:06 UTC x86_64 x86_64 x86_64 GNU/Linux
NVIDIA-Linux-x86_64-560.31.02
ffmpeg version git-2024-08-19-507c2a577
encoders:
V....D av1_nvenc NVIDIA NVENC av1 encoder (codec av1)
V....D h264_nvenc NVIDIA NVENC H.264 encoder (codec h264)
V....D hevc_nvenc NVIDIA NVENC hevc encoder (codec hevc)
decoders:
V..... av1_cuvid Nvidia CUVID AV1 decoder (codec av1)
V..... h264_cuvid Nvidia CUVID H264 decoder (codec h264)
V..... hevc_cuvid Nvidia CUVID HEVC decoder (codec hevc)
V..... mjpeg_cuvid Nvidia CUVID MJPEG decoder (codec mjpeg)
V..... mpeg1_cuvid Nvidia CUVID MPEG1VIDEO decoder (codec mpeg1video)
V..... mpeg2_cuvid Nvidia CUVID MPEG2VIDEO decoder (codec mpeg2video)
V..... mpeg4_cuvid Nvidia CUVID MPEG4 decoder (codec mpeg4)
V..... vc1_cuvid Nvidia CUVID VC1 decoder (codec vc1)
V..... vp8_cuvid Nvidia CUVID VP8 decoder (codec vp8)
V..... vp9_cuvid Nvidia CUVID VP9 decoder (codec vp9)
filters:
... bilateral_cuda V->V GPU accelerated bilateral filter
T.. bwdif_cuda V->V Deinterlace CUDA frames
... chromakey_cuda V->V GPU accelerated chromakey filter
... colorspace_cuda V->V CUDA accelerated video color converter
..C crop V->V Crop the input video.
T.C cropdetect V->V Auto-detect crop size.
... hwupload_cuda V->V Upload a system memory frame to a CUDA device.
... overlay_cuda VV->V Overlay one video on top of another using CUDA
... scale_cuda V->V GPU accelerated video resizer
... scale_npp V->V NVIDIA Performance Primitives video scaling and format conversion
... scale2ref_npp VV->VV NVIDIA Performance Primitives video scaling and format conversion to the given reference.
... sharpen_npp V->V NVIDIA Performance Primitives video sharpening filter.
... thumbnail_cuda V->V Select the most representative frame in a given sequence of consecutive frames.
... transpose_npp V->V NVIDIA Performance Primitives video transpose
T.. yadif_cuda V->V Deinterlace CUDA frames
我希望能够使用 CUDA 来裁剪和缩放视频,但我找不到正确的语法。我的努力通常在缩放方面有效,但在裁剪方面无效,下面是我遇到的问题类型的一个示例:
本例中的源文件是一个简短的 mpeg2 视频(960x540,顶部和底部有黑条)。该命令当前从 bash 脚本运行。
ffmpeg -y -hwaccel cuda -hwaccel_output_format cuda -c:v mpeg2_cuvid -crop 960x408x0x66 -i $1 -vf scale_npp=1280x544 -c:a copy -c:v h264_nvenc -b:v 2M -preset slow $2
这将引发以下错误:
[mpeg2_cuvid @ 0x5e6d9deb56c0] cuvid decode callback error
[vist#0:0/mpeg2video @ 0x5e6d9de85b40] [dec:mpeg2_cuvid @ 0x5e6d9de7b7c0] Decoding error: Generic error in an external library
我的 ffmpeg 构建有问题吗?过滤器列表是否应该包含类似 crop_cuda 或 crop_npp 的内容,或者我是否使用了错误的语法来在 GPU 上执行所有操作(这可能吗?)。