Last active
January 9, 2025 23:49
-
-
Save jungin500/d412986ad633889e5968531a138d82ca to your computer and use it in GitHub Desktop.
FFmpeg recommended GPU transcoding command sets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# hevc_nvenc AVOptions (See https://gist.github.com/nico-lab/c2d192cbb793dfd241c1eafeb52a21c3 ) | |
" | |
-preset <int> E..V...... Set the encoding preset (from 0 to 18) (default p4) | |
default 0 E..V...... | |
slow 1 E..V...... hq 2 passes | |
medium 2 E..V...... hq 1 pass | |
fast 3 E..V...... hp 1 pass | |
hp 4 E..V...... | |
hq 5 E..V...... | |
bd 6 E..V...... | |
ll 7 E..V...... low latency | |
llhq 8 E..V...... low latency hq | |
llhp 9 E..V...... low latency hp | |
lossless 10 E..V...... lossless | |
losslesshp 11 E..V...... lossless hp | |
p1 12 E..V...... fastest (lowest quality) | |
p2 13 E..V...... faster (lower quality) | |
p3 14 E..V...... fast (low quality) | |
p4 15 E..V...... medium (default) | |
p5 16 E..V...... slow (good quality) | |
p6 17 E..V...... slower (better quality) | |
p7 18 E..V...... slowest (best quality) | |
" | |
# Original Script | |
ffmpeg -hwaccel cuda -hwaccel_output_format cuda -t 02:00:00 -i "input.mkv" -vcodec hevc_nvenc -profile:v main -preset p1 -rc vbr -cq 24 -qmin 24 -qmax 24 -b:v 0K -acodec libfdk_aac "output.mp4" | |
# Partial script documentation | |
ffmpeg \ | |
-hwaccel cuda \ # HWAccel on Device (see https://developer.nvidia.com/blog/nvidia-ffmpeg-transcoding-guide/ ) | |
-hwaccel_output_format cuda \ # See upper | |
-t 02:00:00 \ # Crop first 2 hour! | |
-i "input.mkv" \ # input is Matroska extension | |
-vcodec hevc_nvenc \ # uses HEVC encoding along with HWAccel | |
-profile:v main \ | |
-preset p1 \ # p1's equivalent is fastest preset | |
-rc vbr -cq 24 -qmin 24 -qmax 24 -b:v 0K \ # VBR and CQ=24 | |
-acodec libfdk_aac \ # just for testing | |
"output.mp4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment