so if you have ripped your bluray discs because you got sick of throwing them in and out of a player like it’s 1999… then you probably want to conserve space. some people rip them properly without any loss of quality direct from the disc commonly known as ‘remuxing’ in the video world. but if you did it to shows and have it nice and organized it sucks to be wasting space on media you hardly watch. so most people want to encode this to hevc which really crushes it down. i figured i’d give people an example of ffmpeg methods using nvenc. this assumes you have a functional nvidia gpu in your system (i personally have an ancient P400 because crypto and chip shortages make getting anything newer or better a chore)…
this will help you encode an entire directory (good for shows adjust to your system)
for i in *.mkv;
do name=echo "$i" | cut -d'.' -f1
echo “$name”
ffmpeg -i “$i” -map 0:a? -map 0:s? -map 0:v -tag:v hvc1 -c:v hevc_nvenc -cq:v 28 -c:a copy -c:s copy -preset slow -tune hq -rc:v vbr -b:v 0 “/some/directory/for/encoding/${name}.mkv”
done
so just to understand. you must be in the directory with a lot of files (in this case mkvs). then just run it. typically you add it to your path to make it quick and easy or you can alias it or something. what it does is it grabs a list of files and runs each one in order through the ffmpeg command. if you lower the ’28’ to a lower number then the quality is supposed to increase (i think). i just sort of slapped this together to get something functional going. i am sure there are better flags for ffmpeg when using nvenc but this one has given me the best quality vs space.
another quick and easy for individual files.
ffmpeg -i “$1” -map 0:a? -map 0:s? -map 0:v -tag:v hvc1 -c:v hevc_nvenc -preset:v p7 -cq:v 28 -c:a copy -c:s copy -preset slow -tune hq -rc:v vbr -rc-lookahead 20 -b:v 0 “/some/directory/for/encoding/$1”
this one requires that the individual files (when using it) be placed in quotes “iwantthis.mkv” when using it. it sort of sucks trying to rummage through the man page but at least this may get you in the right spot where you can start tweaking things. in this case the focus was only on turning h264 video into h265 but you can also use ffmpeg to convert the audio etc if you would like. in these it just copies everything else and encodes the video.
just a note: subtitles are a special case. i have never really tried to convert them into something else ever so you’re on your own with that. from my understanding it is a little bit more difficult especially if you are trying to change to different formats. good luck.