Introduction
Re-encoded BD anime series are my go-to when watching animes. They have great quality while being a fraction of the size of a Blu-ray disc. Let alone they come with all kinds of extra contents.
Nowadays, re-encoded BD anime series usually have video tracks compressed using 10-bit x265 (a software implementation of the H.265/HEVC video compression standard), and audio tracks compressed using FLAC (a lossless audio codec).
The video tracks are great, generally a good balance between size and quality, no complaints. The audio tracks are my main problem. Sometimes they take up too much space with no real benefit for most viewers.
Other versions like WEB-DL are not considered because they are already heavily compressed so they don’t have the space concerns.
Video Tracks
I am totally satisfied with the video tracks, because:
- the x265 encoder is very efficient (especially at variable bitrate controlling, which most hardware encoders still suffer from, i.e. NVIDIA NVENC, Intel QuickSync, and AMD VCN), being able to compress video to a fraction of the size of the BD original while preserving video quality;
- the encoding team usually does a great job doing manual optimizations to fix problems in the original video, such as aliasing, ringing, and color banding. (Some team even goes as far as AI upscaling the video, although a bit controversial.)
Despite being one third (or even less) of the original bitrate, you can barely tell the difference between the re-encoded video and the original one, even when comparing side-by-side. In fact, the re-encoded video is sometimes even better due to the manual optimizations by the encoding team. This saves a lot of space while preserving video quality.
Video encoding is a complex topic, involving a huge amount of trial and error, even x265-encoding alone has a TON of dials and knobs to tweak, and this is only part of the whole encoding process. I will not go into details here, simply because of my lack of knowledge.
Samples
For example, you can see what the encoding team (VCB-Studio) does to optimize the original video quality from the note of Haiyore! Nyaruko-san / 潜行吧!奈亚子 :
For Season 1, the source is of nothing special. Its native resolution is 720p, then upscaled by a poor algorithm. This leads to many defects: lines featuring severe aliasing and ringing as well as serious ringing on the image borders. Dark scenes are widely spread throughout Season 1, together with the plentiful use of dark fades, resulting in heavy colour banding. For the lines, most of the problems can be solved by descaling and reconstruction, then slight AA and moderate de-ringing as supplements. For colour banding, since most scenes have only a little colour banding, in order to deal with severe colour banding in dark scenes, we designed a complex mask for protection in combination with luminance information. We also use a colour banding detection algorithm. Thanks to all those, we finally adaptively controlled the strength of de-banding. At the end, we added some grains to improve the viewing exprience.
第一季原盘画质一般。原生分辨率为 720p,被比较劣质的算法拉升上来,导致线条带有严重锯齿和振铃,而且画面的边框部分有很强的拉升带来的边缘振铃。画面暗场极多,而且大量运用暗式淡入淡出,这些场景出现了严重的色带。 对于线条,大部分问题都可以通过逆向拉升再重构解决,然后补上轻微的抗锯齿处理和中等强度的去振铃处理。对于色带,由于大部分场景的色带都很少,只有少部分暗场有较严重的色带,我们结合亮度信息设计了复杂的保护手段,并使用了一个色带检测算法,根据检测的结果对去色带的力度进行了自适应调整。最后加上了一定强度的动态噪点,以改善原盘噪点的观感。
MediaInfo: Haiyore! Nyaruko-san episode 1 from VCB-Studio
|
|
As of video quality, you can verify yourself. Here are some frames extracted from Haiyore! Nyaruko-san / 潜行吧!奈亚子 (VCB-Studio). Can you tell any difference between the original and the re-encoded video? Remember that the re-encoded video has a bitrate of only 4028 kbps, while the original video will at least triple that.
This blog uses Responsive Images to improve experience, so what you see here may be scaled down. To view the original image, you can download the original file from the links provided.
Original | Re-encoded |
---|---|
original-0 | re-encoded-0 |
original-1 | re-encoded-1 |
original-2 | re-encoded-2 |
original-3 | re-encoded-3 |
Can’t notice any difference? Or the re-encoded one look better? Save the image locally and zoom in further :p. Yes, I DO put the correct pictures in the correct places.
The static images are already hard to tell apart. The difference will be even smaller when you are watching the video, simply because there are motions in the video and you will not be able to focus on the details.
So yeah, the video tracks are great. I will not touch them.
Audio Tracks
Lossless Compression Problem
However, the audio part is where I have a problem. It’s not about quality, but about size. Let me explain.
Unlike the video tracks, which is compressed using a lossy codec (H.265/HEVC), the audio tracks are usually losslessly compressed, which means that its quality is 100% same to the original, literally. This is great for archival purposes, but it’s a overkill for most people. Because what comes with great quality is size. FLAC tracks usually have a bitrate of 1000+ kbps. One FLAC track in a single episode will typically be over 200 MB in size, as you can seen from the example below. By compressing them to 200 kbps, for example, you save 800+ kbps per track, or put it simply, cut a 200 MB track to 40 MB, which saves a lot of space. This is especially true for animes with multiple FLAC tracks. An extreme example is Kobayashi-san Chi no Maidragon / Miss Kobayachi’s Dragon Maid / 小林家的龙女仆 from team AI-Raws. It has three FLAC tracks, with a total bitrate of 3955 (1432+1294+1229) kbps. Compressing them to 600 (200*3) kbps will cut the entire episode size from 1.89 GB to 1.3 GB, which is a 36% reduction in size, saving 400 MB per episode. That’s a lot.
MediaInfo: Kobayashi-san Chi no Maidragon episode 1 from AI-Raws
|
|
Lossy Compression
But compressing them so hard will certainly bring quality losses… Or will it? Well, yes, there must be quality loss when using lossy codecs, but the question is how much? Is it acceptable? You have seen that the example video tracks are compressed to 4028 kbps, which is a lot less than the original video. But the video tracks are still great. So, is the quality loss acceptable for audio tracks?
In fact, using a modern codec at 256 kbps (or even half that), the quality loss is so little that I can almost guarantee that you will NOT hear a difference for two reasons:
- most codecs are considered “transparent” at 256 kbps or above (better codes will be “transparent” at even lower bitrate), which means that you cannot tell the difference between the original and the compressed one (more on this later);
- when watching anime, you are usually not paying attention to details in the audio, but the video. This makes the difference in audio tracks even less noticeable.
So we can safely compress audio without worrying about quality loss. But how much should we compress? Well, that depends on your own preference. Generally, you can choose a codec and a bitrate that is better than what is “transparent” to you.
But hold on, how do I know what is “transparent” to me?
Audio Transparency
There is a concept called “transparent” in audio encoding, which means the compressed audio is so good that a person cannot tell a difference between the original and the compressed one. This is usually done through ABX blind tests, where the listener is not told which one is the original and which one is the compressed one. If the listener cannot tell the difference, then the audio is considered transparent. Of course, this differs from person to person. You have to do the test with your own ears with different encoders at different bitrates to find your “transparent” threshold (which codec at which bitrate). When you find your threshold, any better codec at any better bitrate will also be transparent to you.
About Bitrate and quality:
They cannot be compared directly. For example, 320 kbps MP3 is not the same as 320 kbps AAC. (AAC is generally considered a better codec than MP3, so it can achieve the same quality with a lower bitrate.)
When dealing with the same codec (same encoder, same settings), the higher the bitrate, the better the quality. For example, MP3 at 320 kbps wll have better quality than MP3 at 256 kbps.
But when dealing with different codecs, the bitrate is not the only factor that affects the quality. The codec itself, the encoder, encoding settings, and etc. all affect quality. For example, AAC (qaac, vbr, default settings) at 256 kbps is often said to have similar quality to MP3 at 320 kbps.
But the general consensus is that Opus is transparent at 160kbps and above, and AAC is transparent at 192kbps and above:
A blind test of multiple codecs at ~192kbps VBR shows that codecs at 192k is transparent to the test subject. Opus being the most transparent codec at 192k;
Tests of different encoders at different bitrates published by SoundExpert show that most codecs at 128kbps and above are transparent to most test subjects. Detailed results can be found at http://soundexpert.org/encoders-128-kbps;
A topic from HydrogenAudio forum even shows that Opus at ~80kbps is transparent to an average listener;
It’s interesting to observe that 4 members have mentioned Opus@80kbps as point where is hard to spot artifacts for them.
Opus ~80 kbps is roughly equivalent to LAME ~130 kbps (V5) which lands in an “excellent” area of quality (MOS 4.5+) http://listening-tests.hydrogenaud.io/sebastian/mp3-128-1/results.htm
So one could say that Opus 80 kbps is “excellent” at least for an average listener. It’s clear that an experienced listeners can spot artifacts at much higher rates.
I never noticed any artifacts at 80kbps though, though I haven’t tried to find any either. Quote from: noiselab on 2017-09-18 06:49:15
I tried it and for me it’s 80 kbit. Quote from: hlloyge on 2017-09-18 11:49:01
I’ll be honest, I struggled to ABX at 64kbps. 80kbps is enough for me. Quote from: Funkstar De Luxe on 2017-09-18 13:35:01
80kbps is pretty much my limit as well, can’t be bothered listening to killer samples all the time. Quote from: bstrobl on 2017-09-18 14:39:30
All iTunes music is delivered in AAC at 256kbps (before the arrival of Apple Music Lossless), which is an indication that most people cannot tell the difference as Apple is a company that cares about quality;
As you can see I am only focusing on AAC and Opus (as of lossy codecs), because AAC offers good sound quality and great compatibility while Opus has great sound quality and “okay” compatibility. Other codecs like MP3 are just not good enough to compete with them, so they will not be my choice later.
Listening Samples
Now bring your best audio equipment. Same as before, let’s listen to some samples to see if you can tell a difference, or you can do blind ABX tests by yourself to find your “transparent” threshold.
All lossy codecs are encoded using VBR (CBR is not considered because it is not size-efficient) with a quality setting to match the resulting bitrates of different encoders as close as possible.
Encoder versions
|
|
Note that if you cannot playback some audio tracks, make sure your browser supports this type of audio or you can download the audio tracks and play them locally. Latest versions of Chromium-based browsers should be fine. Safari might have some issues with Opus and Ogg.
Orange / オレンジ
For the first example, I will use Orange / オレンジ by 7!! — the 2nd ending song from Shigatsu wa Kimi no Uso / 四月は君の嘘 / Your Lie in April / 四月是你的谎言 for its female voices. The audio is not complex (simpley put, do not contain many instruments), so it is easier for the encoders to achieve good results.
Vocal
Reference track:
Compressed tracks:
VBR Bitrate | Opus | AAC | Ogg | MP3 |
---|---|---|---|---|
~256k | ||||
~192k | ||||
~160k | ||||
~128k | ||||
~96k | ||||
~64k |
Vocal with simple instruments
Reference track:
Compressed tracks:
VBR Bitrate | Opus | AAC | Ogg | MP3 |
---|---|---|---|---|
~256k | ||||
~192k | ||||
~160k | ||||
~128k | ||||
~96k | ||||
~64k |
Vocal with more complex instruments
Reference track:
Compressed tracks:
VBR Bitrate | Opus | AAC | Ogg | MP3 |
---|---|---|---|---|
~256k | ||||
~192k | ||||
~160k | ||||
~128k | ||||
~96k | ||||
~64k |
Vision
The second song will be a more complex, or demanding one — Vision by 中島岬:
Vision reference track:
Vision compressed tracks:
VBR Bitrate | Opus | AAC | Ogg | MP3 |
---|---|---|---|---|
~256k | ||||
~192k | ||||
~160k | ||||
~128k | ||||
~96k | ||||
~64k |
You can clearly see the AAC and MP3 encoders tend to give a higher bitrate than target bitrate in VBR mode to handle complex songs.
Want to listen to your own song at differnet bitrates? Use this script to encode it to all formats. This is exactly the same script that I wrote to encode the songs and generate the table above.
Now, you should have your own understanding of the different codecs: above which bitrate of which codec is transparent to you.
My take on the codecs
Here is my opinion: since ~192k Opus is already transparent to me (and to most people), why use 1000+ kbps FLAC? I can save a lot of space, without even tell a difference! Unless you have outstandingly gifted ears with high-end equipments, or you do heavy post-processing on audio, you should and will be fine with a transparent lossy encoding.
Also, most audio in animes is voice, which is usually not complex for encoders, so the actual bitrate can be even lower to sound good.
Still writing…
The rest is still being written…