In my quest to cut down how much space some video archives take up, I came across the monster that is known as the DVD VOB format. Or at least, it was a monster at first. Several of my archives are "VOB chains" -- video chunked into files up to 1024MB each. I hadn't played with these in a long time and forgot that VOB is a subset of MPEG, after which knowledge let me sigh in relief. MPEG-2 files can be concatenated, so that's what I did with my first set:
cat VTS_01_01.VOB VTS_01_02.VOB VTS_01_03.VOB VTS_01_04.VOB > MOVIE.VOB
FFMPEG has a
concatoperator you can use on the input file but I decided to use
cat since it is less unwieldy to handle and I knew my ffmpeg incantation was going to already be pretty long. It also let me have a pre-concatenated file so that I didn't run the concatenation each time I wanted to tweak other settings.
After verifying that the concatenated file worked as intended, I started to convert it to mp4, but was running into massive frame duplication, which I really did not like. After finding that -vsync 0 copied frames and their timestamps, I incorporated that.
ffmpeg -i MOVIE.VOB -vsync 0 movie.mp4
This was going fine but I noticed that quality was garbage because I forgot to set crf to 18. I set it to 18 because it is what I've found to be "visually lossless" while still being lossy enough to reduce some size. I also decided that I wanted to convert the audio while I was at it. Hearing the fans in my PC spin up as I started crunching the file, I also decided that I wanted to try my GPU, since it's a quieter option, and possibly a bit faster.
After some misleading internet searches, I wandered onto the official FFMPEG wiki. Somehow, I always forget about official documentation in my search for knowledge (though to be fair, a lot of open software has atrocious documentation). I came across HWAccelIntro, and since I use VA-API, the VAAPI page helped a lot.
The end result for my conversion of VOB to MP4:
ffmpeg -vaapi_device /dev/dri/renderD128 -i MOVIE.VOB -c:v h264_vaapi \
-vf 'format=nv12,hwupload' -vsync 0 -qp 18 -c:a libopus -ar 48000 movie.mp4
A few times, I forgot to set the audio bit rate, which was kinda silly because the default is 96000 and MOVIE.VOB is 48000. Additionally, h264_vaapi does not support using
libx264 does, so I had to settle with using
-qp. As CRF is 18 as previously mentioned, I also used it for QP.