From A Unique Perspective

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
Hand On Tha Brizzake
Posts: 18
Joined: Fri Jul 17, 2015 10:27 pm

From A Unique Perspective

Post by Hand On Tha Brizzake »

Hello. I read the now-outdated Tips For Encoding Videos page but have additional questions.

About me – I promise this is relevant to my questions. I am bereft of eyesight and have been since birth; am a self-proclaimed audiophile, audio engineer, and computer programmer, but prefer audio manipulation. Moreover,, I am a collector of first issue/edition pressings of films [Criterion titles remain sealed] on DVD in the main. I remultiplex to the Matroska container from my DVDs for my media server, but also download the highest quality files from the internet especially for VHS transfers. Naturally, I have no concept of how anything looks, and thus cannot preview any images before or after a transcode.

The afore-linked well-written page of the tips pertains to H.264, but I use H.265 and the latest nightly build of HandBrake. I am concerned only to preserve the utmost quality from these internet source files , and thus want not to damage them. I also have terabytes of space and will sacrifice space for quality at the lossless level. Considering I am using a 2018 MacBook Pro with a Core i9 six-core 2,9GHz to 4,8GHz processor, 32 gigabytes of DDR4 RAM, 4 terabyte SSD, and discrete graphics chip, I am not concerned to make my system work hard. In fact, to transcode is one of the reasons I purchased it last year. Below are my settings, and below that are some questions to which I cannot find answers [and I tried for hours]. The audio is passed through always without exception as are sub-titles.
  • Video Tab:
    • Video Encoder: H.265 (x265) – Most efficient by far and compatible with everything I use.
    • Quality: constant – Of course.
    • RF: 0,00 – I know most would call this senseless, but this is the only way to preserve maximum quality from anything that must be decoded thereby degrading quality when encoding whilst removing bits even if no sighted person can discern. Binary is tricky if you do not understand how binary works, but when bits are removed regardless what the eyes can perceive, that means quality is sacrificed and that is not acceptable to me. I guess this is analogous to psychoacoustic analysis of lossy audio – anomalies which I can hear every time I listen to any lossy audio no matter the codec or settings.
    • FPS: same as source – I like to keep as much original as possible so I never modify this.
    • Frame Rate: variable – Continuing in the spirit of efficiency…
    • Encoder Options: placebo – Another point of contention amongst users that this is senseless, but this I discover is truly what results in a super efficient file as the final product. Time is no object for me, and my system can handle this.
    • Tune: none
    • Fast Decode: tick box unticked
    • Profile: auto – I think HandBrake is more trustworthy to choose than I.
    • Level: auto – I think HandBrake is more trustworthy to choose than I.

    Filters Tab:
    • Detelecine: default – I presume this will be used only when HandBrake deems necessary.
    • Interlace Detection: default – I know not if this has any affect if the Deinterlace pop-up menu that follows is off which it is here just in case.
    • Deinterlace: off
    • Colour: greyscale: tick box unticked
    • Rotate: 0º
    • Flip: tick box unticked
    • Deblock: off
    • Denoise: off
    • Sharpen: off

    Dimensions Tab:
    • Anamorphic: auto – I never modify this or the storage size parameters.
    • Modulus: 2 – I never change this either. I wish I understood the mathematics here although I do understand the operator of modulo.

My questions:
  1. Does the Interlace Detect setting have any effect if the Deinterlace setting is on off? If so, what are the effects? Detection implies it will detect but not actually deinterlace.
  2. Considering I cannot see anything before or after and have no manner by which to verify if I destroy or improve the video streams, is it safe to leave enabled the Detelecine and Interlace Detection settings at default? Most of the films I will convert were sourced from VHS, but I am sure the quality and nuances vary. Default is vague; I wish the HandBrake documentation was not sparse in this regard.
  3. Do you recommend to enable the Deinterlace setting in general? The options are YADIF and Decomb. If so, which and why?
  4. Do you recommend to leave disabled the Deblock and Denoise filters? I like the idea of a clean picture, but obviously want not ruin anything I cannot see and never know.
  5. Do you have any additional tips with regards to H.265 and Matroska? Am I doing anything gravely wrong to guaranteed ruin each picture?


I dig details – the more verbose the better. Much thanks in advance for any insight.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: From A Unique Perspective

Post by JohnAStebbins »

  1. No. It flags frames that are interlaced. The deinterlace or decomb filters will use these flags to only filter interlaced frames. Deinterlacing degrades quality. So if the frame isn't interlaced, more quality is preserved by not applying a deinterlace filter to it.
  2. Yes. Interlace detection will slow the encode a bit, but considering that you are using a slow encoder (x265) it's in the noise. The interlace detection filter will get a few false positives, but it's typically on the order of a dozen over the length of a movie, so won't be noticeable.
  3. If you are using the interlace detect filter, then yes it is ok to also leave either deinterlace yadif or decomb enabled. The default settings of decomb do pretty much the same thing as the default setting of yadif. Yadif is faster in some cases because it uses had coded assembly. decomb is faster in some cases because it is multthreaded. They each also have a 'bob' setting that creates a frame for each interlaced field. I prefer the bob setting because it preserves motion better. If you use 'bob' you must also adjust the output framerate on the video tab for each video to be double the original framerate. The decomb filter has additional 'EEDI2' and 'EEDI2 bob' settings. EEDI2 improves the quality of deinterlacing at the cost of speed. It is *very* slow.
  4. Deblock is rarely needed these days. It removes encoding artefacts around block boundaries. Years ago, the encoders of the day tended to produce these kinds of artefacts. Denoise may be useful for your VHS sources. Removing noise from source video has 2 beneficial effects. It improves perceived quality (you can't add objective quality which is why I say "perceived"), and it improves the quality for filesize tradeoff of the encoder. Noisy video is difficult to encode. The NLMEANS denoise filter is excellent, but slow. It has presets that adjust the strength of the filter and tunes for particular use cases, one of which is 'Tape'. Unfortunately, use of denoise when it is not needed does degrade quality, as does using too strong of a setting. So you may want to solicit feedback from a friend if you want to use this filter.
    • RF 0 is overkill. I can't see the difference in side by side still frames with RF 12 and the difference in file size between those settings is huge. And nobody watches a video one frame at a time inspecting every deteal. If I'm creating an 'archival' video meant to preserve quality and not necessarily for watching, I use RF 16. Even RF 0 looses quality in the objective sense. But you would have to do many generations of re-encoding before you could really see the difference even with RF 16. But as is said around here often, disks are cheap and getting cheaper all the time. If the cost of disk space means nothing to you, by all means, use whatever RF you like ;)
    • FPS same as source is preferred unless you are using bob deinterlacing. Then you should set double the source framerate and 'Peak framerate' aka PFR. This is only necessary because we are missing a feature in the deinterlace filter that I really should add. The filter should adjust the framerate for you when 'bob' is selected. A project for another day.
    • VFR is preferred unless using bob deinterlacing as noted above.
    • placebo as the name implies really doesn't do anything helpful. And in fact I would argue it may be harmful because it is so infrequently used that it does not get the amount of testing and critical feedback of all the other encoder presets. I would avoid it.
    • detelecine generally does not harm *NTSC* interlaced content or progressive content. But it can ruin interlaced PAL content. I only use it when I know for certain that the source is NTSC *hard* telecined content. "Hard telecine" means there are no flags in the video bitstream indicating the telecine pattern. If these flags exist, HandBrake interprets them and decodes progressive frames at the proper framerate. If they are not present, the detelecine filter looks for the pattern and reconstructs the progressive frames.
The rest of your settings are sensible.

You didn't address what you prefer for audio tracks or whether you want subtitles. If these selections are important to you, you should investigate the settings in the audio track selection and subtitle track selection panes. Myself, I prefer the first audio track to be the native language of the film if it's a foreign film, followed by a DUB track if there is one. For subtitles I use the 'Foreign audio search' feature to add subtitles for English language film that has short segments of foreign audio spoken. Then I'll add an English subtitle track if the native audio of the film is not English.
Hand On Tha Brizzake
Posts: 18
Joined: Fri Jul 17, 2015 10:27 pm

Re: From A Unique Perspective

Post by Hand On Tha Brizzake »

  • If you are using the interlace detect filter, then yes it is ok to also leave either deinterlace yadif or decomb enabled. The default settings of decomb do pretty much the same thing as the default setting of yadif. Yadif is faster in some cases because it uses had coded assembly. decomb is faster in some cases because it is multthreaded. They each also have a 'bob' setting that creates a frame for each interlaced field. I prefer the bob setting because it preserves motion better. If you use 'bob' you must also adjust the output framerate on the video tab for each video to be double the original framerate. The decomb filter has additional 'EEDI2' and 'EEDI2 bob' settings. EEDI2 improves the quality of deinterlacing at the cost of speed. It is *very* slow.
Is EEDI2 Bob a combination of the two? If so, does the frame rate adjustment rule apply? Aside from the speed penalty, does exist any disbenefit to use Decomb with EEDI2 not EEDI2 Bob?
  • Deblock is rarely needed these days. It removes encoding artefacts around block boundaries. Years ago, the encoders of the day tended to produce these kinds of artefacts.
I did not know that, but that is quite useful to know.
  • Denoise may be useful for your VHS sources. Removing noise from source video has 2 beneficial effects. It improves perceived quality (you can't add objective quality which is why I say "perceived"), and it improves the quality for filesize tradeoff of the encoder. Noisy video is difficult to encode. The NLMEANS denoise filter is excellent, but slow. It has presets that adjust the strength of the filter and tunes for particular use cases, one of which is 'Tape'. Unfortunately, use of denoise when it is not needed does degrade quality, as does using too strong of a setting. So you may want to solicit feedback from a friend if you want to use this filter.
This is the one filter that I have been afraid to enable due to degradation of quality. All VHS transfers are not the same of course, hence each transcode would optimally have finely tuned denoise settings.
  • RF 0 is overkill. I can't see the difference in side by side still frames with RF 12 and the difference in file size between those settings is huge. And nobody watches a video one frame at a time inspecting every deteal. If I'm creating an 'archival' video meant to preserve quality and not necessarily for watching, I use RF 16. Even RF 0 looses quality in the objective sense. But you would have to do many generations of re-encoding before you could really see the difference even with RF 16.
That is interesting RF of 0 and RF of 12 have no perceived visual differences. I wonder if everyone concurs with that who have compared intensely 0 with 10, 12, 15, 16, 20 et cetera. The one concept I fail to understand is how the output of a conversion with RF of 0 can be gigabytes more large than a source file encoded using some old version of XviD. Blood cannot come from a stone; no quality is added magically. HandBrake, using the settings detailed in my initial post, output a file 3,92 gigabytes with a constant frame rate of 25 FPS and a high bit rate. The original is approximately 734 megabytes at the supposed constant frame rate of 25 FPS. MediaInfo does not make all details clear for streams in the AVI container as it does for streams in the MKV container. I guess the question is why a RF of 0 sometimes results in a larger file whilst retaining the quality of the source using an encoder and settings supposedly much more efficient than XviD. I notice some transcoded files have a constant frame rate even though I selected the variable frame rate radio button. If the source has a constant frame rate, does this indicate the transcoded file will as well regardless of what the x265 encoder thinks about each frame? My apologies if none of that is sufficiently clear.
  • detelecine generally does not harm *NTSC* interlaced content or progressive content. But it can ruin interlaced PAL content. I only use it when I know for certain that the source is NTSC *hard* telecined content. "Hard telecine" means there are no flags in the video bitstream indicating the telecine pattern. If these flags exist, HandBrake interprets them and decodes progressive frames at the proper framerate. If they are not present, the detelecine filter looks for the pattern and reconstructs the progressive frames.
MediaInfo does not make obvious if a film is telecine hard or soft. Are there any indications I am missing to discern amongst hard and soft or none at all?
You didn't address what you prefer for audio tracks or whether you want subtitles. If these selections are important to you, you should investigate the settings in the audio track selection and subtitle track selection panes. Myself, I prefer the first audio track to be the native language of the film if it's a foreign film, followed by a DUB track if there is one. For subtitles I use the 'Foreign audio search' feature to add subtitles for English language film that has short segments of foreign audio spoken. Then I'll add an English subtitle track if the native audio of the film is not English.
I concur with those preferences. I always pass through the original audio. To this day, I never in my life downloaded a transcoded video from the internet that contained lossless audio – my preferred of course. This is rare on DVD discs; I have only one that contains PCM audio. Considering 99.98% of audio streams are lossy, I pass through always because decoding and re-encoding is a guaranteed loss of the little quality that remains. I will be able to hear that. The original audio streams go to the output file. However, I do have one that contains audio in encoded in MP2 for which there is no pass through option. MP2 is rarely used in transcodes online, but it would be nice to have a pass through option like there is for MP3. I must re-encode that to something. It bothers me that loss of quality by doing so is inevitable regardless what I use. With regards to sub-titles, any sub-titles in the original source are added. However, foreign audio search is first and burnt in whilst all original tracks are not and begin as second after foreign audio search.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: From A Unique Perspective

Post by JohnAStebbins »

Is EEDI2 Bob a combination of the two? If so, does the frame rate adjustment rule apply? Aside from the speed penalty, does exist any disbenefit to use Decomb with EEDI2 not EEDI2 Bob?
Yes. bob generally means create a frame for every field and doubles the framerate. The benefit of bob is more fluid motion.
The one concept I fail to understand is how the output of a conversion with RF of 0 can be gigabytes more large than a source file encoded using some old version of XviD
When transcoding, the fist step in the process is to decode the source into raw frames. Each raw frame of standard definition video as an example is 518KB. A 30fps movie length video will have 216000 frames. So the size of the raw frames in that movie is 112GB. This is what the encoder starts with as input. If you then tell the encoder to preserve as much detail as possible in those raw frames, it's going to do it's best to do so. Some of what you are telling it to preserve will be the encoding artefacts that were created by the previous encoding. You are actually creating something that has higher quality than the previous encoding, but the quality in this case is measured with respect to those raw frames and not with respect to the original content before it was initially encoded.
MediaInfo does not make obvious if a film is telecine hard or soft. Are there any indications I am missing to discern amongst hard and soft or none at all?
I've seen different output from different versions of mediainfo. But the version I currently run outputs these settings that are relevant for soft telecined content.

Code: Select all

Frame rate                               : 23.976 (24000/1001) FPS
Scan type                                : Progressive
Scan order                               : 2:3 Pulldown
For soft telecine, the framerate will be film rate (23.976), scan type progressive, and scan order 2:3 pulldown
For hard telecine, the framerate will be video rates (29.97), scan type interlaced, and scan order top or bottom field first

Unfortunately, there is no way to distinguish hard telecine content from regular intelaced content.
Hand On Tha Brizzake
Posts: 18
Joined: Fri Jul 17, 2015 10:27 pm

Re: From A Unique Perspective

Post by Hand On Tha Brizzake »

Yes. bob generally means create a frame for every field and doubles the framerate. The benefit of bob is more fluid motion.
How does that relate to EEDI2 in the context of the EEDI2 Bob preset? I assume both Bob and EEDI2 Bob require the frame rate adjustment whereas EEDI2 obviously does not.
When transcoding, the fist step in the process is to decode the source into raw frames. Each raw frame of standard definition video as an example is 518KB. A 30fps movie length video will have 216000 frames. So the size of the raw frames in that movie is 112GB. This is what the encoder starts with as input. If you then tell the encoder to preserve as much detail as possible in those raw frames, it's going to do it's best to do so. Some of what you are telling it to preserve will be the encoding artefacts that were created by the previous encoding. You are actually creating something that has higher quality than the previous encoding, but the quality in this case is measured with respect to those raw frames and not with respect to the original content before it was initially encoded.
Understood; very interesting information. The ‘quality’ increase is pointless because it is a preservation of the artefacts rather than an actual improvement of the video stream. I think the answer to this question is not a definite threshold due to specific composition of each source, but is there a general consensus of RF number that will preserve no artefacts thereby bloating the file size and not sacrifice anything that should be preserved and encoded?
I've seen different output from different versions of mediainfo. But the version I currently run outputs these settings that are relevant for soft telecined content.

Code: Select all

Frame rate                               : 23.976 (24000/1001) FPS
Scan type                                : Progressive
Scan order                               : 2:3 Pulldown
For soft telecine, the framerate will be film rate (23.976), scan type progressive, and scan order 2:3 pulldown
For hard telecine, the framerate will be video rates (29.97), scan type interlaced, and scan order top or bottom field first

Unfortunately, there is no way to distinguish hard telecine content from regular intelaced content.
Thanks for those data points. I use the Mac App Store build of MediaInfo and do recall those attributes. On PAL, how does telecine relate to 25 FPS?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: From A Unique Perspective

Post by JohnAStebbins »

How does that relate to EEDI2 in the context of the EEDI2 Bob preset? I assume both Bob and EEDI2 Bob require the frame rate adjustment whereas EEDI2 obviously does not.
bob and EEDI2 bob both require double framerate. When deinterlacing, you are essentially interpolating the pixels of one field to fill in the other field. EEDI2 is an improved interpolation algorithm. Bob simply tells it to perform the interpolation twice, once for each field.
is there a general consensus of RF number that will preserve no artefacts thereby bloating the file size and not sacrifice anything that should be preserved and encoded?
Not really. You can't avoid preserving artefacts. And you can't really know what's an artefact and what is legitimate content. The safest choice is to assume you have a clean source without artefacts and set your RF for creating output that is visually indistinguishable from such a source. There are a lot of people who are more sensitive about disk space that will try to match their output quality to the source quality either by using a similar bitrate or by eyeballing the source and estimating a suitable RF for each encode. I don't do that and don't recommend it unless you have a lot of content that is badly degraded and don't want to waste a lot of disk space on it. I always try to get the best source content that I can, and if all I can get is of poor quality, I'll do the best I can to clean it up with filters first.
On PAL, how does telecine relate to 25 FPS
Movies are telecined to convert the 24fps film rate to 29.97fps video rate. Telecine is basically a pattern of interlaced fields that maximizes motion smoothness. PALs 25fps rate is close enough to 24fps that they typically just allow the video to play 1/25th too fast. They may or may not pitch bend the audio to fix distortion. So if you apply the detelecine filter to PAL content, the best case is that it does nothing. The worst case is that it will incorrectly detect a telecine pattern and recombine fields in the wrong way.
Hand On Tha Brizzake
Posts: 18
Joined: Fri Jul 17, 2015 10:27 pm

Re: From A Unique Perspective

Post by Hand On Tha Brizzake »

You can't avoid preserving artefacts. And you can't really know what's an artefact and what is legitimate content. The safest choice is to assume you have a clean source without artefacts and set your RF for creating output that is visually indistinguishable from such a source.
The only truly clean sources are both analogue and digital media based on my experience. I never found a clean source online that was not the closest digitisation of a VHS, betamax, laserdisc, et cetera. I considered to transcode my DVD collection instead of using MakeMKV to demultiplex for Plex, but decided against it because they are how they are from original source and I know they are not ruined visually.
There are a lot of people who are more sensitive about disk space that will try to match their output quality to the source quality either by using a similar bitrate or by eyeballing the source and estimating a suitable RF for each encode. I don't do that and don't recommend it unless you have a lot of content that is badly degraded and don't want to waste a lot of disk space on it. I always try to get the best source content that I can, and if all I can get is of poor quality, I'll do the best I can to clean it up with filters first.
I concur wholeheartedly. I do my best never to sacrifice quality at any cost. To clean up content with filters is something I wish I could do correctly, but this thread is my attempt to procure the necessary data to hopefully do it properly. The denoise filter would likely help the perceived quality of the VHS rips I find, but that is where I know I need sighted assistance.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: From A Unique Perspective

Post by mduell »

RF 0 is senseless, and unless you need the video codec changed for compatibility, completely pointless as the output is likely to be larger than the input.

Reasonable values are, as always, far better choices than extremes. Try a few values and as your viewers what they can see. High teens to low twenties is reasonable for high quality depending on who your viewer is.
nhyone
Bright Spark User
Posts: 252
Joined: Fri Jul 24, 2015 4:13 am

Re: From A Unique Perspective

Post by nhyone »

Hand On Tha Brizzake wrote: Mon Apr 15, 2019 2:43 am I also have terabytes of space and will sacrifice space for quality at the lossless level.
I do have a question: why not leave the source files as-is? Why do you need to transcode?
Hand On Tha Brizzake
Posts: 18
Joined: Fri Jul 17, 2015 10:27 pm

Re: From A Unique Perspective

Post by Hand On Tha Brizzake »

I do have a question: why not leave the source files as-is? Why do you need to transcode?
I know the VHS rips I have are not ‘clean’, videlicet they could be more pleasant to the eyes. This is my attempt to make them so.

Also, I am contemplating transcoding the remultiplexed sources that is my DVD collection. I do like that those are the original DRM-free content of the VOB files howbeit in another container, and because of that I cannot go wrong leaving them untouched. However, even with the settings detailed in the initial post above, I cannot help to presume they might gain some efficiency by transcoding them from MPEG2 to HEVC. I never did so, but I do know MPEG2 is not very efficient with regards to ratio of compression and size.
nhyone
Bright Spark User
Posts: 252
Joined: Fri Jul 24, 2015 4:13 am

Re: From A Unique Perspective

Post by nhyone »

On general encoding:

IMO, if you are encoding 1080p or lower, just use H.264. :)

Two years ago, H.265 looked like it would be the future, but it kind of fizzled out -- no doubt due to patent royalties.

The good thing about x264 is that it is really easy to get good encoding, no secret sauce needed.

My suggestion for a start (here is where everyone starts to disagree :D): either veryfast or veryslow preset, CRF 18 to 20 (depending on your threshold), 2 reference frames and 5 b-frames. Add tune film or animation as needed. That's it.

CRF 18 is generally accepted as transparent. But if you aren't sure, use 16.


On audio:

I use 96 - 128 kbps AAC for most shows and 160 kbps for music / concert. Not all AAC encoders are alike. Use good ones. :D


On DVD:

I always enable decomb for DVD, no point for other sources as I don't encounter interlaced video files. I enable inverse-telecine (IVTC) if it is film and the frame rate is 29.97 fps.

I typically also enable light denoising. I have the impression this helps with blocky MPEG-2 (when it runs out of bandwidth).

MPEG-2 DVD can be converted to H.264 transparently with x264 at just 25 - 33% bitrate.


On VHS and difficult sources:

Do what you want, but keep the source. Whatever filtering you use today may not be acceptable to you tomorrow. Re-do again from the source.
Hand On Tha Brizzake
Posts: 18
Joined: Fri Jul 17, 2015 10:27 pm

Re: From A Unique Perspective

Post by Hand On Tha Brizzake »

IMO, if you are encoding 1080p or lower, just use H.264.

Two years ago, H.265 looked like it would be the future, but it kind of fizzled out -- no doubt due to patent royalties.

The good thing about x264 is that it is really easy to get good encoding, no secret sauce needed.
I disagree wholeheartedly respectfully. x264 is not close to being efficient as x265, and I am attempting to maximise efficiency. Patent royalties aside, x265, based on my research, is much better in every way than x264.
either veryfast or veryslow preset, CRF 18 to 20 (depending on your threshold), 2 reference frames and 5 b-frames. Add tune film or animation as needed. That's it.
Oh, no… no, no, no. Again I disagree respectfully. I do not take the fast route nor do I sacrifice quality. Tune settings may be more appropriate for certain sources, but considering I have no eyesight I do not use too many filters to potentially ruin the transcoded video stream.
I use 96 - 128 kbps AAC for most shows and 160 kbps for music / concert. Not all AAC encoders are alike. Use good ones.
This is where I know without question you are sacrificing quality unless the audio is passed through and contains those specific attributes. I can discern lossy from lossless, period. My entire life has been based on my ears, and have no choice but to hear what most sighted persons do not. Worst case scenario is inferior audio cannot be passed through and must be converted [e.g. MP2 192KBPS 48000Hz to MP3 with those same attributes]. Best case scenario is the original audio is passed through regardless what are the type and attributes. Upsampling audio is 500% useless and an unquestionable waste of space. I hear the same artefacts afterwards [tested that for others years back].

I typically also enable light denoising. I have the impression this helps with blocky MPEG-2 (when it runs out of bandwidth).
I would enable the Denoise filter and use NLMeans if I had the eyesight to ensure any source truly requires such gain of perceived quality.
Post Reply