Experiments in Digital Video Remastering #1 – Live Action
Howdy and welcome to the first Experiments in Digital Video Remastering series post!
Today I’m going to go through the options used for side-scaling anamorphic/non-anamorphic videos that were ripped from a 10-year-old DVD source.
The original video(s) were filmed with a widescreen camera, but anamophised to 5:4 PAL Standard Def for storage on the DVD.
I’ll go through some of the settings I used to side-scale the videos to force their native filmed widescreen format to be the stored digital format.
I say side-scale because “upscale” isn’t quite accurate here, as all we are doing is forcing an anamorphic widescreen PAL video (stored at 720×576) into a non-anamorphic widescreen PAL video (stored at 1024×576).
Even though 1024 is greater than 720, the source video as mentioned previously is filmed in widescreen, so the 720×576 video is “squashed” and makes actors/objects look ‘skinny’.
On the left is the original straight-from-DVD source, and on the right is our final output.
The images above are displayed on this site at a reduced responsive resolution which means you will have to click the image for it’s full size.
I used MakeMKV to backup the original DVD to an uncompressed MKV container.
The size of the untouched rip depends on the actual content of the video, whether it’s animation, high action, dramatically dark and low-movement, etc, will all play a big part in the resulting filesize.
For this example, the episode was 887mb uncompressed MKV MPEG-2 container, for 42mins and 17secs @@ 25fps, 720×576, 2.0 Stereo AC3 @ 224kbps | 48000hz
The output after Handbraking is approx 285mb MKV MPEG-2, same length, same FPS, 1024×576, 2.0 Stereo AC3 @ 224kbps | 48khz
As you can see, we have dramatically decreased the filesize, while increasing the horizontal resolution, without losing any noticeable image fidelity.
How is this possible? I hear you ask…
Well, without getting too complicated, the encoder, Handbrake, and the source video itself are helping “fill in the blanks” in order to be able to “add” an extra 304 pixels to the horizontal resolution.
Make no mistake, these extra pixels don’t exist somewhere hidden in the source video, so there is no way of actually getting the original widescreen ‘pixels’ without another transfer from the source film to a wider frame digital container.
This is why Lucas keeps re-re–re–re-re-releasing Star Wars in different formats and mediums because the actual source film is able to be “transferred” over and over again to higher and larger frame formats (Like Full HD 1080 instead of SD 540). Most studios, however, take much longer to do this, whereas Lucas, for the most part, seems to like his bigger and better video formats, and who can blame him!
The whole idea of this post is basically a more rudimentary version of what Lucas does to his films over time, in order to keep them fresh (in a technological sense, not sure from an art sense, though!).
Now for the fun part 😉
I use Handbrake CLI to achieve this, but these settings are basically the same in the GUI, so I’ll leave it up to you to find them, but they should all be translatable from these CLI settings.
You end up with something crazy like this;
-m -E ac3 –audio-fallback ffac3 -e x264 -q 28 -a 1 -A “2.0 Stereo” -B auto -R 48000 -6 stereo -w 1024 -l 576 –crop 4:4:4:4 –custom-anamorphic –display-width 1024 –modulus 8 -s 1
What a mouthful!
Lets break (brake?) this down further to get a better understanding of the individual settings/commands;
Stands for “Markers”, and as our source MKV contains chapter markers, we need to specify this or else Handbrake will drop them.
The audio encoder. As the source is AC3, and destination is same MKV type, we’ll keep this the same, but if not specified, HB will default to MP3
Related to above, but is basically a fall back encoder if the -E fails for some reason…
The video encoder. In this case, we’re using x264 for various reasons, but it is great for an MKV and Handbrake offer lots of presets to use.
The constant quality delta. NOTE: with “x264” this range is reversed. Lower numbers mean higher quality, and high numbers mean more compression, lower visual quality, but smaller filesize, and faster encoding.
20 is very close to the uncompressed source.
25 introduces some edge-noise and blocking, but barely noticeable.
30 introduces “noticeable” blocking and pixel-distortion/noise throughout the entire image.
The chosen “28” and if newer source 26 or thereabouts is a good trade-off between quality, filesize, and encoding time (but I mainly work with PAL videos, this could be different for NTSC)
The audio track selection. Here, we just have 1 main audio track.
-A “2.0 Stereo”
The OUTPUT audio track’s friendly name. This has no effect apart from giving the output audio track a name that you can read when playing back the video.
The audio bitrate. “auto” may or may not use the source bitrate, in this case, it does, but for 5.1 tracks it seems to reduce the bitrate in my experiments so far.
The audio hertz rate. Our source is 48khz (slightly impressed for 20 year old source material)
The audio channel type. Options are mono, stereo, dpl1, dpl2, 5point1, 6point1 and 7point1.
Dual Stereo (3.1 or 4CH) will be upmixed to 5point1 (5.1 or 6CH). This will increase filesize by about 40%.
The width of the output video. Not needed when using display-width, but we force this here for making sure the output is exactly the width we need.
The height of the output video. (L meaning length).
Again, we’ll force to be sure
–crop 0:0:0:0 or –crop auto
The overall crop of the output.
HB will always try to crop something unless you specify 0 for Top, Bottom, Left and Right respectively. (T:B:L:R)
Our source video isn’t perfectly cropped to frame, but has no black cinema bars or pillars. Most of the episodes I have checked from this show have a 4 pixel black border in the source video, so the –crop auto function should work, but because we know the actual dimensions, we could instead specify –crop 4:4:4:4 and the effect would be essentially the same.
Force the anamorphic to be “custom”.
The “display” width of the output video. This overrides “-width” and HB will let you know this too.
Set the modulus of the output to be divisible by 8 (default 16, strict-anamorphic will always be “2”)
The subtitles track.
Our source MKV has 1 subtitle track so we don’t need to specify anything crazy here. If you have 2 subtitles tracks, one might be regular subs, the other for hearing-impaired, then you would use -s 1,2
The full command;
“C:\Program Files\Handbrake\HandBrakeCLI.exe” -i “input.mkv” -o “output.mkv” -m -E ac3 –audio-fallback ffac3 -e x264 -q 26 -a 1 -A “2.0 Stereo” -B auto -R 48000 -6 stereo -w 1024 -l 576 –crop auto –custom-anamorphic –display-width 1024 –modulus 8 -s 1
In this next example, I’ll demonstrate the differences between the previous 1024×576 “side-scaled” video and an upscaled 1280×720 (720p) version of the same video.
The full command;
“C:\Program Files\Handbrake\HandBrakeCLI.exe” -i “input.mkv” -o “output.mkv” -m -E ac3 –audio-fallback ffac3 -e x264 -q 25 -a 1 -A “5.1 Surround Sound” -B auto -R 48000 -6 5point1 -w 1280 -l 720 –crop auto –custom-anamorphic –display-width 1280 –modulus 2 -s 1
Denoise / Deblock / Enhance etc
In this next example I’ll demonstrate an advanced technique for applying denoise, and deblocking filters to an older DVD video to MKV transfer.
This is taken from the Pilot episode, filmed late 1996/early 97, and re-encoded to DVD9, (but quality not changed) in 2004. It is basically as close to the original aired quality as I have access to, and it’s a great example for this exercise.
As before, here are 2 examples of the original source video (on the left) and the result of the advanced techniques used that we’ll outline below.
The first is a more extreme example using a 7th quantization parameter, with “medium” denoise and nlmeans filters, and using the “high motion” tune adjustment preset.
This second demonstration is from the same video, with different settings, and illustrates the difference between the noisy source and the final output encode.
This is using more of a “lighter” touch and preserves details excellently, while removing the film noise/grain that, in this particular episode, is quite strong.
And here are some more examples using the same scene as the first example, same episode, same source.