Table of Contents

ffmpeg - Hardware transcoding using GPUs - Nvidia GPU

Nvidia GPUs

nvenc_h264
nvenc_h265

Decoding

-hwaccel cuda

Encoding

For video resolution <= 4K

-c:v h264_nvenc

For video resolution > 4K

-c:v hevc_nvenc

Examples

#1 - A corrupt 1920×1080 video:

ffmpeg -y -vsync 0 -hwaccel cuda -i "input.mp4" -c:a copy -c:v h264_nvenc -b:v 2M -pix_fmt yuv420p "output.mp4"

#2 - a 7680×3840 H.265 video with incompatible profile for VHT - a stutter playback 7260×3630 60fps 10bit video

ffmpeg -y -vsync 0 -hwaccel cuda -i "input.mp4" -c:a copy -c:v hevc_nvenc -b:v 80M -pix_fmt yuv420p "output.mp4"

#3 - a 7680×7680 video not hardware decoded because is H.264 encoded

ffmpeg -y -vsync 0 -i "input.mp4" -c:a copy -c:v hevc_nvenc -b:v 62M -pix_fmt yuv420p "output.mp4"