GPU-accelerated video processing with ffmpeg

前端 未结 3 1159
孤城傲影
孤城傲影 2020-12-13 06:25

I want to use ffmpeg to accelerate video encode and decode with an NVIDIA GPU.

From NVIDIA\'s website:

NVIDIA GPUs contain one or more hardwa

3条回答
  •  盖世英雄少女心
    2020-12-13 07:01

    Quick use on ​supported GPU:

    CUDA

    ffmpeg -hwaccel cuda -i input output
    

    CUVID

    ffmpeg -c:v h264_cuvid -i input output
    

    Full hardware transcode with NVDEC and NVENC:

    ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input -c:v h264_nvenc -preset slow output
    

    If ffmpeg was compiled with support for libnpp, it can be used to insert a GPU based scaler into the chain:

    ffmpeg -hwaccel_device 0 -hwaccel cuda -i input -vf scale_npp=-1:720 -c:v h264_nvenc -preset slow output.mkv
    

    Source: https://trac.ffmpeg.org/wiki/HWAccelIntro

提交回复
热议问题