Bulk Encoding DVDs with FFMPEG

TheJoeCoder

ffmpegwindowspowershelldvd

776 Words … ⏲ Reading Time:3 Minutes, 31 Seconds

2025-08-20 00:16 +0100


Welcome to the second day of this stupid project I didn’t need to do but chose to do anyway!

Space Must be Saved

I’ve ripped 78 discs so far and I’ve done some calculations. These 78 discs take up about 600GB of space. I think my 230 estimate of before was a severe underestimate too. We’re looking at >1.2TB for all the media, probably closer to 2-3TB realistically.

Oh, and I didn’t mention I actually have a couple dozen Blu-Ray discs and quite a few dozen HD DVD discs. They can range from 15-100GB each (maximum of 30GB for a HD DVD disc and up to 66 for a dual layer blu-ray and 100 for a BDXL). That’s easily another 1TB at least.

While I do actually have about 6TB remaining on my NAS, I’d prefer to use it for other files instead of just movies and TV shows. And while I care greatly about preservation and would love to keep the originals of everything, I can’t really afford to buy more storage now or in the distant future.

ffmpeg

After some testing, I’ve found out the following:

  • H265 and H264 work similarly for low resolution media. H265 is marginally smaller.
  • My AMD Ryzen 7 5700X gets 0.1 FPS on AV1 encoding.
  • My RTX 2060 doesn’t support AV1 hardware encoding.

I’ve also found my preferred settings: H264, p7 preset, hq tuning, CQ 19, no upscaling. While I’ve heard online that upscaling to 2x scale and then encoding can improve video quality, at least from my eyes, my choice seems to be better than the default H265 settings. If I lower the CRF (in H264/5) for the upscaled footage (H265 28->22 was what I tested), the file size becomes large enough that I don’t consider it warranted to re-encode it.

The Command

The ffmpeg command is a monster and is as follows:

ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i "input.mkv" -c:v h264_nvenc -preset:v p7 -tune:v hq -rc:v vbr -cq:v 19 -b:v 0 -profile:v high -c:a copy -c:s copy -map 0 "output.mkv"

This uses NVIDIA’s hardware acceleration to encode the h264 video with the specified settings. You should just be able to remove the hwaccel and hwaccel_output_format switches and change h264_nvenc to h264 to get it to run on a non-nvidia system but I haven’t tested it.

Automation

Believe it or not, most of this is an incredibly manual process. I don’t have any device to automate the insertion and removal of DVDs, nor do I have a magical script to detect the DVD and start ripping automatically. I also don’t have any form of artificial intelligence or algorithm to remove the parts that aren’t the movie, TV show, or extras or a one to rename the files. And while I could certainly automate some of that, it’d probably take longer than it’s worth. There’s always the trap of spending time on automating something only for the automation to take longer than just doing the thing itself.

Let’s talk about my manual process. I have 3 folders: temp, temp to process, and temp cleaned.

  • temp is where the files are ripped to. I move the files from here into temp to process every once in a while.
  • When files get into temp to process, I go through and delete all the trailers and things which aren’t related to the movie, and rename the things to somewhat legible names. I then move the files over to temp cleaned.
  • Once they’re here, I encode them using that ffmpeg command. I do a double check once they’re done, and can then delete the original files once I’m sure.
  • I move the files over to their respective movie or tv show library folder, renaming and changing folder structure as I move the files.
  • The files are now picked up by Jellyfin, indexed, and added to the web UI so I can watch them anywhere.

The easiest part of that to automate is the part which requires no human intervention - the encoding. So, as my main rig was booted into Windows at the time, I wrote a PowerShell script to automate at least one part of it.

ls -recurse **/*.mkv | foreach { 
	ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i "$($_.FullName)" -c:v h264_nvenc -preset:v p7 -tune:v hq -rc:v vbr -cq:v 19 -b:v 0 -profile:v high -c:a copy -c:s copy -map 0 "$($_.Directory.FullName)\$($_.BaseName)_enc.mkv"
}

All it does is list out recursively all mkv files, then encodes them with ffmpeg using the command above and some powershell magic to extract the path and file name.

So that’s it! If I find yet more ways to improve my setup I’ll be sure to create another blog post.