My first post, yay!
I recently started encoding and ripping my Blu-ray discs for private local storage on my computer, and I have tried a few different applications to do that task, and the one that has me the most impressed is Handbrake.
I have done lots of testing with it and found the settings I like to use the most. It has involved a lot of research (and Handbrake usefully also provides its own explanations for some settings), but I feel like I have been able to understand all of the answers and explanations I have seen on the Web so far... except for this one.
In Handbrake, I discovered the Modulus setting and I actually don't understand what that means at all. Explanations and answers on the Web have been counter-arguing each other, making me very cautious about trusting one source when another source disagrees. Can someone give me an explanation that doesn't get overly technical? I have learned a lot these past few days of testing and researching, but I am still learning about all this stuff, so I'd prefer an explanation "dumbed down" as much as possible.
More information to personalize the answer to my needs:
Right now, I want to encode a half-hour TV episode into a 1280x720 H.264 .MKV release with CRF 14, constant framerate, Auto H.264 profile and level, and Medium x264 preset. All of the content I will be encoding will be 1280x720 encodes, but with varying lengths and maybe different CRF values.
The content will be played back on my computers, both OS X and Windows operating systems, and sometimes through the HDMI port on a TV, other times via an external hard drive connected to the USB port on a Blu-ray Disc player. I have no plans on burning it onto a new disc, as I specifically want it as actual files on my PC.
I have encoded the episode two times, one time with Modulus 2, the other with Modulus 16. I see no difference when watching it on my PC, and MediaInfo does not report any difference whatsoever either. So what is it really? XD
Any help would be really appreciated!
+ Reply to Thread
Results 1 to 30 of 78
Modulus refers to how it can be resized. For instance, modulus 16 is only divisible by 16, and modulus 2 is only divisible by 2, so on and so forth...
Sent from my 831C using Tapatalk
I don't use Handbrake, but you'll be okay using Mod8 or lower. 1080 is the only one of the four that isn't Mod16. Maybe it doesn't resize the input resolution, no idea. Maybe Mod8 is the default, I don't know.
Edit: After reading the later posts, I went back and realized I meant to say Mod8 or higher. Me, although it's often okay, I don't use Mod4 myself.
Last edited by manono; 3rd Jan 2016 at 19:13.
Handbrake's default setting. Hasn't caused any issues for me so far, so I just hope it won't in the future and I will stick to that!
Last edited by Hmmm; 3rd Jan 2016 at 11:12.
It's very unlikely to cause you problems, but some people prefer to stick to more traditional mods, such as mod16 or mod8. The downside is it potentially limits the accuracy of the resizing (set to mod2, Handbrake can resize however it likes), although you can compensate by adjusting the cropping if need be.
For example if you resized 1280x720 to 704x396 there'd be no aspect error as they're both exactly 16:9. The latter is mod4 (width and height evenly divisible by 4 but not 8 or 16). If you wanted to resize to mod16 dimensions (evenly divisible by 16) you might use 704x400, but it'll stretch the picture a tiny bit as it's not exactly 16:9.
I haven't seen the newer Handbrake so I don't know how much aspect ratio info it displays.
Have a play with this:
It'll tell you the amount of aspect ratio distortion when cropping and resizing so you can adjust either to reduce it if need be. For instance in my previous example if you removed 6 pixels from the left of the picture and 6 from the right, you could then resize the remaining 1268x720 to 704x400 with very little aspect distortion.
By the way..... all of the above applies only to Handbrake's Anamorphic "None" option, which resizes to square pixel dimensions. If you use Anamorphic "Loose", Handbrake will adjust the pixel aspect ratio a little if need be to prevent any display aspect error. Think of it like this (extreme example) in theory you could resize a 1280x720 video to 540x800 if you wanted to, and as long as the player stretches that 540x800 video to 16:9 on playback, there'll be no picture distortion. It's not something you'd do.... in fact it'd be silly..... but if you use Anamorphic "loose", the modulus setting shouldn't effect the display aspect ratio. Whatever the resizing when encoding, Handbrake will adjust the display aspect ratio to compensate and assuming your player obeys the aspect ratio, it'll display without being stretched or squished etc.
Using my previous example once more, you could resize a 1280x720 video to 704x400 and as long as a 16:9 display aspect ratio is set when encoding (Handbrake will set it automatically when using anamorphic "loose") it'll display correctly at 16:9 even though 704x400 isn't exactly 16:9.
I really appreciate your reply! It gave me some valuable info! Thank you! However, I noticed that you wrote a lot about resizing 1280x720 to smaller resolutions. I am going to keep all my media on the 1280x720 resolution (well, approx. 1280x536 for movies). I'm not going to do anything other than watching my media on Windows + OS X + TV, but I'd prefer to encode correctly when I'm starting these days rather than discovering some form of error in the future and having to re-encode my entire collection.
In Handbrake, I have the "Keep Aspect Ratio" box checked and "None" selected on Anamorphic, so all I enter is 1280 in the Width box, which is always going to be the same regardless of whether it's a movie or a TV episode (unless I have misunderstood something), and it fills out the Height box automatically.
I did notice, though, when trying to watch a specific movie ("Vantage Point") on my TV through external hard drive connected via USB that the picture was stretched out to fit the entire screen rather than showing black bars at the top and bottom like movies are supposed to do. That wasn't my encode, though, but could that have been caused by this 16:9 issue you were describing?
So to sum this all up: My media will be encoded in TV's resolution and in movies' resolution and I will not do anything other than watching it on TVs and PCs. Should I choose the "Loose" option in Anamorphic setting in Handbrake to avoid the specific issue I just described? Does this information change your view on the matter in any way?
I wasn't suggesting you should downscale, just offering examples of resizing.
Not all hardware players support aspect ratios in MP4s and MKVs (they assume the resolution and aspect ratio are the same), so if you have one of those the only way to ensure the picture displays with the correct aspect ratio is to resize it to square pixels as you're already doing. Anamorphic encoding is mostly used for DVDs because they're anamorphic (non-square pixels). When the source video has square pixels anamorphic encoding is less advantageous. I'd just keep the pixels square (anamorphic none).
Most TVs have some sort of option for stretching the video to fill the screen, so even if the player doesn't understand MKV or MP4 aspect ratios, you can still view anamorphic 16:9 video correctly by using the TV's "fill the screen" option. Maybe it's enabled? Of course it's only useful if the video is actually 16:9. Anything else would be stretched.
If it's a Samsung TV the setting can be configured independently for each input, and there's a tiny, little, hard to find button on the remote marked "pict size" or something similar that toggles through the picture options (different inputs have different options too).
It's unlikely the video filling the screen when it shouldn't is an encoding problem. I'd be fairly confident it's a TV setting as most encoder GUIs try to prevent you from doing silly things, so as long as "keep aspect ratio" is checked when resizing you should be right.
Thank you so much for your reply! Lots of great information and useful feedback! Thanks!
Don't use mod2, some devices have problems with it. Stick with mod4 or higher.
Hmmm.... Well, that worries me a little :P Sounds like there's no clear-cut answer to which mod is closest to "universal".
Can you give any examples of devices that would have problems with mod2? Just curious.
There's almost no down side to using mod4 (vs. mod2). You can't tell the difference between 1280x534 (mod2) and 1280x536 (mod8) or 1280x532 (mod4) upon watching them. You can't see the ~0.4% aspect ratio difference. The difference in bitrate will be tiny. How would you like to have dozens of videos that you converted at mod2 then find that they don't play properly in the new player you buy next year? If you want to be really safe, use mod8.
The mod2 problem is really a Windows-only problem. I'm not aware of any hardware players that have issues with mod2.
Having said that, and partly due to jagabo making me a little paranoid, I do tend to stick to mod4 myself these days...... kind of.....
MeGUI has an anamorphic option that'll automatically adjust the cropping to ensure the width is mod4. The height can be anything (mod2) so I figured maybe MeGUI is trying to tell me it's only a width problem, so now I stick to mod4 widths while trying very hard not to think about the height, although sometimes an irrational OCD thing kicks in anyway and I also have to make the height mod4. Of course that's just me attempting to cut down on therapy by confabulating a few untested theories into a personal encoding rule, but so far it hasn't caused any playback issues.
If the accurate way to resize a video resulted in 1280x724 (I'm just making up numbers) mod4 or mod2 wouldn't matter because it's already mod4. If the resizing needed to be 1280x722 then mod4 forces you to resize to either 1280x720 or 1280x724 instead. Mod2 would be more accurate, but it's a very small amount of aspect error for mod4.
Yes, mod4 may result in the video being resized a little less accurately than mod2, but that's why I posted the link for the resize calculator earlier. Handbrake will do the resizing for you, but I don't think it tells you how much the picture is being distorted (aspect error). If you're resizing to a particular mod and it increases the aspect error, a way to reduce is it to adjust the cropping. Generally it doesn't require much. You might crop the black bars and then need to crop an extra few pixels from the picture somewhere so it can be resized accurately. If Handbrake doesn't display the aspect error, use the calculator (input the same cropping and resizing you're using with Handbrake), check the aspect error and adjust the cropping if need be to reduce it, then change Handbrake's cropping/resizing to match.
You can work it out in your head if the source uses square pixels.
(Source Height / Source Width) x Output Width = Output Height. ie
(1080 / 1920) x 1280 = 720
(800 / 1920) x 1280 = 533.33
So for the second example you might use 1280x532, but try playing with the calculator. It'll definitely be easier to use the calculator if the source is anamorphic (ie a DVD) because that requires adding pixel aspect ratios to the equation and life's too short.....
Last edited by hello_hello; 4th Jan 2016 at 03:18.
I haven't found a way to change the height and width mod separately in Handbrake, so I think it encodes both in the mod I input? Anyways, given the helpful replies, I do think I should stick to either mod 4 or mod 8 and not mod 2 so I am as "safe" as possible. Now to decide which of those two... XD
You mentioned MeGUI. I haven't tried that one. I assume it's an encoding program similar to Handbrake? Does it offer any advantages/disadvantages to Handbrake that you know of?
And regarding your second comment, thank you for the great info! I have just downloaded the resize calculator and I am testing it out now. I have a few questions about it, though, but they aren't really related to this thread, so would it be OK if I sent you a private message?
MeGUI is an Avisynth based GUI. Aside from having a proper video preview (how anyone can use a GUI without a decent preview is beyond me) out of the box MeGUI does pretty much what Handbrake does. There's differences..... in reality it has more of a learning curve, and then there's Avisynth filters, which aside from the ones MeGUI uses would require you to start learning the basics of Avisynth, but there's a whole world of Avisynth filters for you to eventually explore.... if you want to.
I will try out MeGUI to see how advanced it is. As much as I want to get started encoding everything, I do want to learn to have the best possible results when I do finally get started, so I will give MeGUI a chance
You mentioned in your edited comment that a DVD is anamorphic. Does that apply to Blu-ray Discs as well? If it does, how do I figure out the pixel aspect ratio, and how do I figure out if the source has, as the calculator requires, square 1:1 pixels or PAL/NTSC? I know what PAL and NTSC mean, but let's say I buy a TV show Blu-ray in the United States, which would be NTSC, does that mean the option in the calculator should be NTSC 16:9 or do I need to figure out if the BD has square 1:1 pixels? Does it say so on the packaging? I don't have it in my hands right now, so I'll check later, but I thought I'd ask in case you have an answer.
Also, my earlier mistake in writing has been a little confusing throughout the thread. I specified that all the content I will be encoding will be 1280x720 resolution, but I forgot all about movies, which are closer to approx. 1280x536. That's not 16:9, so is that one of the scenarios where I need to calculate which mod to use and how much to resize/crop using the calculator?
The reason odd frame sizes aren't supported is because almost all video uses YUV 4:2:0 chroma subsampling (aka YV12). That means the luma (greyscale image) is encoded at full resolution but the chroma (color) is encoded at 1/2 the resolution (horizontally and vertically). So a 1280x720 video has a 1280x720 luma channel and two 640x360 color channels. Odd frame dimensions would lead to fractional chroma channels, which isn't legal.
The reason some codecs don't like mod2 is that they optionally support interlaced video. In that case each frame encodes two separate pictures, one in all the even scan lines, one in all the odd scanlines. And each of those half-pictures need to be an even size because they are YV12. Meaning the full frame height must be mod4 in height. So a 1920x1080i frame encodes two 1920x540 images, each with a 1920x540 luma channels and 960x270 chroma channels.
I'll be honest. I only understood about half of all that. I want to sound more impressive and confident and understanding, but this is almost alien to me XD I knew encoding would be a tough task because, in the past, using all the simple tools have given me unimpressive results. I just recently, approximately 2 weeks ago, started thinking I want to learn more and see if I can successfully make a quality encode. That has yet to happen XD I have a lot to learn, but there's also a limit to how much I want to learn as encoding isn't actually a hobby for me (at least not yet). This was all meant to make things easier and more practical for me so I can have my collection on my computer instead of physically. :P
All that said, thank you so much for all the info! It is very appreciated and it could prove very useful in the future if encoding does become a big hobby for me.
As of right now, I have begun testing MeGUI. I'm not sure if I like it or not yet. On one hand, it offers far more control and that tells me that it's complex, advanced and decent at its job, but on the other hand, darn there's an overwhelming amount of settings and configurations! haha. Isn't there a "Press this button for the best HD encode you will ever get!" option? hahaha XD
All I actually wanted when I started all this was easy, high-def encodes of my TV shows and movies. I guess the "easy" part is what I misunderstood :P Sorry, I'm just frustrated :/
Regarding the actual mod value, though, I am honestly still unsure of what to use. Mod 4 / 8 / 16, hmm... It is fully possible that I am just confused at this point and simply can't draw a conclusion. It was frankly an easier time not knowing what it was at all as DVDFab, my first encoding application, didn't give me any such option.
I will be doing a little more testing and researching now, and then I need a break from all this for a little while :P
Handbrake in respect to what it can do, so unless you need/want to use Avisynth filters the end result won't be much different.
There's only three different HD resolutions and they're square pixelled except for 1440x1080. It must be anamorphic if it's 16:9.
I guess there's a reason for 1440x1080 being part of the Bluray spec, but I don't think I've ever seen one.
The two SD resolution are the ones I referred to as PAL and NTSC. They're anamorphic.
I don't know which PARs Handbrake uses when calculating resizing. There's a list here:
The PAR situation is a bit of a mess. It'll be nice when NTSC and PAL are a thing of the past and everything's square pixelled. Here's my rule of thumb. It's not a perfect rule but I think it'd be correct most of the time.
All 4:3 DVDs are ITU. If you use the calculator to work out 4:3 DVD resizing, make sure "Use ITU-R BT.601 Coeff" is checked.
Most 16:9 DVDs are not ITU, so make sure it's unchecked for 16:9 resizing. If a 16:9 DVD is old and has a fair amount of black down each side (more than 8 pixels) that'd indicate it's probably ITU, but for newer 16:9 DVDs where the picture pretty much covers the whole 720 width.... not ITU.
There's several different theories regarding the "correct" ITU PARs but they're very, very similar, so it doesn't matter too much.
- The first list of ITU aspect ratios in the link above are probably correct but rarely used, probably because of the large fractions.
- The "Almost exact and commonly used ITU-PAR" are the one's MeGUI uses by default. I think years ago the majority of encoder GUIs used them, but probably not so much now. Fortunately though, MeGUI lets you specify custom aspect ratios for the source video, so you can use whatever DAR you prefer, and once you've set it MeGUI will calculate the resizing based on that.
- The "MPEG-4 PARs" are the official Bluray PARs for PAL and NTSC, although I'm starting to suspect they might often use the generic PARs instead. I haven't encoded many of them so I don't really know, but I suspect......
- The "Generic" PARs are the PARs that result in DVD video being resized to exactly 16:9 or 4:3 dimensions. If you untick the "Use ITU-R BT.601 Coeff" in the calculator, it'll be calculating based on the generic PARs.
And.... might as well complete the story....
The display aspect ratios the Yoda calculator uses are based on the "exact ITU" PARs in the list I linked to, but the result when calculating the display aspect ratio or resizing is ever so slightly different to what you'd expect. Well, ever so slightly different to what my calculator and I expected. The explanation for that can be found here.
iTunes video is mod4 than mod16, and if it was likely to cause playback problems, I suspect it wouldn't be. iTunes 720p video still caters to ancient Apple TV devices which means a maximum 24fps frame rate at the maximum resolution of 720p, and no CABAC as apparently they can't decode it, but mod4..... no problem.
I don't know why so much iTunes video has "odd" resolutions. Mod2..... I've thought about it and I think Apple may draw the line there. I'm sure I remember seeing mod2 iTunes video now and then but I couldn't find any when I went looking so maybe my brain invented that memory to help me get through the day.
No way could I encode at 1280x716. I can encode at all sorts of weird and wonderful resolutions but not something so close to being 16:9 and 720p without actually being 16:9 and 720p. My OCD tenancies would kick in and prevent it.
Last edited by hello_hello; 4th Jan 2016 at 08:45.
That's possibly true, but on the other hand.... Apple products are probably the lowest common denominator.
I think I'll stick with HandBrake. It gives me all the options I need without bombarding me with settings, and multiple tests have given me great releases.
Even if I have to re-encode my entire collection in a few years, is it a safe choice, at least for now, to encode with mod 4? Mod 8? 16? I need help picking one, as you all seem to have more knowledge of this than I do and I valuable your opinion very much!
Also, I have the "Anamorphic" option set to None and as I fill in 1280 in the Width field, it automatically fills in the Height since I have "Keep Aspect Ratio" checked. Is that a good thing, or should I try the "Loose" setting? Still a bit unclear on that one (my mind is so confused after all this, so sorry if some things need repeating.) I am going to browse the previous page now to see if this has already been answered and explained somewhere.
Thanks for all the great feedback so far! It has been very interesting to see how multiple encoding software works! HandBrake does seem like the one for me, as long as I can get the mod and anamorphic options figured out
Having done further testing with the resizing calculator you linked me to earlier in this thread, I now understand more what you talked about when you said aspect error. Currently, trying to encode a movie, with the mod set to 8, Handbrake tells me the resolution of the output file will be 1280x536. Inputting that in the resize calculator tells me it has an aspect error of approx. -35.33%. That doesn't sound good.
In the top right corner of the resize calculator, I can see the Crop options. I tried inputting a few numbers in the boxes just to see what would happen, but I am not sure how to make it adjust the aspect error, because as soon as I press Enter on the keyboard, it puts 0 back in the crop field. What am I doing wrong?