Optimizing Video Compression with ffmpeg and hevc_nvenc

ffmpeg -i fileName.mp4 -c:v hevc_nvenc -preset slow -rc:v vbr -cq:v 24 -b:v 0 -c:a aac -b:a 128k -vf scale=1280:-1 -movflags +faststart fileName_compressed.mp4
FlagExplanation
-i fileName.mp4Specifies the input file as fileName.mp4
-c:v hevc_nvencSets the video codec to NVIDIA’s HEVC encoder
-preset slowSets the encoding preset to “slow” for better compression efficiency
-rc:v vbrSets the rate control mode to variable bitrate
-cq:v 24Sets the Constant Quality (CQ) value to 24 (lower values mean higher quality)
-b:v 0Sets the target bitrate to 0, allowing CQ mode to determine the bitrate
-c:a aacSets the audio codec to AAC
-b:a 128kSets the audio bitrate to 128 kbps
-vf scale=1280:-1Scales the video width to 1280 pixels, height scaled proportionally
-movflags +faststartOptimizes the file for web streaming, allowing faster video startup
fileName_compressed.mp4Specifies the output filename
This command utilizes your NVIDIA GPU for encoding, which can be significantly faster than CPU encoding. The quality control is managed through the CQ (Constant Quality) value, where lower values result in higher quality but larger file sizes.

smaller:

ffmpeg -i 1.mp4 -c:v hevc_nvenc -preset slow -rc:v vbr -cq:v 29 -b:v 450k -c:a aac -b:a 96k -vf scale=960:-1 -movflags +faststart 2.mp4

留下评论

通过 WordPress.com 设计一个这样的站点
从这里开始