Page 1 of 1

HandBrake – Optimizing Video Encoding (h264)

HandBrake – Optimizing Video Encoding (h264)
   71

Optimizing video encoders is not easy with all the video lingo, trying to get a file as optimized as much as you can. With optimizing I mean finding a balance between file size and video quality.

In this article a few tips and tricks on how to optimize your encoder settings in HandBrake.

HandBrake is freely available on multiple platforms (Windows, MacOS X, Linux) and is probably one of the better encoders out there.




Optimizing Video Encoder Settings

Optimizing or fine tuning of video encoders comes basically down to:

  • What file size do I want?
  • What quality do we want?
  • How fast should encoding go?

Personally I believe that fine tuning should be a balance between file size and quality.

The time to encode a movie should be irrelevant – sometimes the time difference is really not worth it, for a few minutes extra you will get a better quality and/or smaller file size. The times that encoding a movie from DVD took 8 hours are long gone, most of my computers can convert a DVD easily under 15 minutes.

So based on personal experience (note that I’m not an expert) a few pointers:

  The chosen file format, or “container”, has hardly any effect on file size or quality (MP4, MKV, AVI).

Since the “container” file has a minimal or even negligible impact on file size or quality. Therefor I’d recommend using the container that is most compatible with your devices and/or software. AVI is widely supported but MP4 is definitely the strong upcoming format to use. MKV is (in my humble opinion) better, but not as widely supported.

The common containers (AVI, MP4, MKV) typically support a variety of so called codecs (enCoder/Decoders) and the selection of the codec is what influences quality and file size.

Preferred setting in HandBrake: MP4.

  A great codec is not a guarantee for quality but has a great influence on file size.

Some codecs (enCoder/Decoder) are more efficient than others when it comes to compressing and storage.
The compression settings can make it that an old MPEG-2 codec can actually out perform a modern codec like h264. These settings or options can also be the root of all problems. For example: older devices that are h264 capable might not yet support the newer “options” of this codec, resulting in crappy or even unplayable files.

Preferred setting in HandBrake: h264.

  High bitrates do not guarantee quality but seriously impact file size.

Although in general there is a good correlation between quality and bitrate, a higher bitrate is not a guarantee for quality.

For example when transcoding a existing MP4 file with a low bitrate, to an MP4 with a high bitrate is total nonsense. It will only increase the file size but most certainly not increase quality – and probably even make the quality worse.

Note that so called “single pass” encoding can result in a less good quality or less efficient compression when compared to “multi pass” or “double pass” encoding – but that doesn’t have to be the case. The good thing of “double pass” – and that is just my opinion – is that it does a pre-flight analysis of your video source, allowing it to better anticipate changes in the video. “Single pass” encoding however has become significantly better these days.

Rule of thumb: When converting never use a bitrate higher than the source file.

  Quality Setting for “Constant Quality” can be overdone.

HandBrake has a slider at “Constant Quality” allowing you to set an RF value, between 50 (low quality) and 0 (highest quality).

The default value is set to “20” which can be considered adequate for a DVD copy. For HD video (720p and up) an RF of 21 – 23 is recommended, and some even recommend “30” – but you’ll have to play a little with this to find what works best for you.

Also keep in mind that RF=0 means NO COMPRESSION at all, which is … useless. You’d end up with a gigantic file, larger than the original file, and with zero improvements on the picture quality. You will have to keep in mind that DVD’s and even Blu-Ray discs are compressed in such a way that they already come with “loss” – i.e. it kind-a has it’s own RF value already. Going below that value will not add improvements to your copy, and will only increase the file size unnecessarily. (reference)

Rule of thumb: DVD RF 20, BLU-RAY RF 22

  Doing things in a hurry gives half-assed results.

This rule goes for pretty much anything in life: the difference between doing it fast and doing it well. The same goes for converting movies/video. The faster you try to encode a movie, the less “good” (in size and quality) the result will be.

Settings like “fast” basically means: we’re doing our best to maintain a reasonable quality, but speed of conversion is our main goal. So the slower we go, the more attention your encoder will pay to detail!

The Placebo setting goes totally nuts on quality, and takes forever to complete.

Preferred HandBrake setting: Medium (which gives a nice balance between speed and quality).

  Sizing Video: Do crop the black borders, but do not “upscale” video.

Like with increasing bitrates from a low bitrate source, upscaling (or enlarging) the video resolution is probably one of the worst things you can do. First of all, you’re not adding any quality improvements, instead you’re adding only more useless data which results in a larger file for no good reason. Second of all: Your playback devices is typically much better at “upscaling” if needed.

Under normal circumstances, HandBrake will do a fine job in determining size, aspect ration, and cropping – it bases these settings on the information it gets from the video source you’re using. If you’d like though, you can look under the option “Picture Settings” and tweak cropping, size and aspect ratio. Just do not make the size more than what HandBrake suggests by default.

When it comes to cropping, HandBrake will remove the excessive “data” automatically, by removing the black borders often seen in movies (the gray area in the image on the right).

Please note : Cropping the black bars doesn’t really save a lot of disk space. It will however, as correctly noted by Thomas, have a potential negative side effect when it comes to playback. The cropped video (removing the black bars) will make it harder for devices to determine what the correct aspect ratio and/or resolutions are and as a result in possibly distorted playback.

HandBrake - Automatically cropping black borders

HandBrake – Automatically cropping black borders

Preferred HandBrake settings: Leave Sizing, Aspect Ratio.

  Use filters or optimal settings for the type of video you’re working with.

Some encoders, like h264 in HandBrake, offer special settings and filters geared towards the type of movie or video you’re working with.

Let’s compare a regular movie with a cartoon as an oversimplified illustration.

Movie versus Cartoon

Movie versus Cartoon

What do we notice? The first thing you’d notice is that cartoons appear to be using a smaller palette of colors, shapes are simplified and filled with one color and there are hardly any shadings or patterns when compared to a regular movie. In the example above: simply look at the difference in fine details when you look at the hair – the picture on the left contains MUCH more data than the cartoon on the right.

These special settings use these characteristics to compress better and more efficient.

HandBrake - Encoder presets for h264

HandBrake – Encoder presets for h264

HandBrake h264 Presets
 Preset Details
 none  Use when you’re not sure what to use – uses HandBrake’s defaults.
 film  Use this for regular video and modern 3D animated movies.
 animation  Use for classical animations (including Manga).
 grain  Use this for movies with high levels of grain (for example ancient movies).
 stillimage  Use this for still images, for example a photo slideshow.
 psnr  Only use if you know what PSNR is (not useful for normal use).
 ssim  Only use if you know what SSIM is (not useful for normal use).
 zerolatency  Only useful for streaming video.

Preferred HandBrake setting: Match your video type or none if unsure.

Donation options


Donations are very much appreciated, but not required. Donations will be used for web-hosting expenses, project hardware or a motivational boost (a drink or snack). Thank you very much for those have donated already! It's truly AwEsOmE to see that folks like our articles and small applications.

Comments


There are 71 comments. You can read them below.
You can post your own comments by using the form below, or reply to existing comments by using the "Reply" button.

  • Sep 4, 2013 - 10:27 AM - Eliel Comment Link

    Thanks !!! It help me a lot :)

    Reply

    Eliel

    • Sep 4, 2013 - 10:31 AM - hans Comment Link

      Thanks Eliel for the feedback!

      Glad to hear this article was helpful for you 

      Reply

      hans

  • Sep 12, 2014 - 2:04 PM - jfjfjf Comment Link

    Prima!!!… Simple. Straight to the point.

    Reply

    jfjfjf

  • Apr 9, 2015 - 3:02 PM - Rudi Comment Link

    I do agree with most of the article, except for the x264 preset. You advice to set it to placebo, but the only thing this does is make the file a little smaller at the expense of a lot of encoding time and sometimes even some quality. The default setting ‘medium’ will be sufficient in most cases. My experience is that everything from fast to placebo is in the same ballpark; the differences are in the order of 3-7% in file size between steps and the quality does not improve with lower settings. This all by the same CRF of course…

    Reply

    Rudi

    • Apr 10, 2015 - 3:11 AM - hans - Author: Comment Link

      Hi Rudi,

      thanks for your feedback. I cannot disagree with what you’re saying about the “Placebo” setting.
      It’s super slow, provides minimal gain in size, and … I cannot see the quality difference (not saying that there is no difference, I just cannot see it).

      Maybe it’s better that I say “Prefered is Medium”, with a side note that ludicrous setting would be “Placebo”.  

      Reply

      hans

    • Apr 10, 2015 - 3:15 AM - hans - Author: Comment Link

      I made the suggested correct.

      Thanks again Rudi! 

      Reply

      hans

  • Jul 6, 2015 - 11:52 AM - karn Comment Link

    Very useful tips.Thanks.

    Reply

    karn

  • Sep 1, 2015 - 8:45 PM - Mike Comment Link

    Thank you for the easily understood explanations of the settings. 

    I deviated from your suggestions in one place. I found that subtitles were getting cropped off the bottom with standard settings, so I use Custom Cropping with Bottom=0.

    Reply

    Mike

    • Sep 2, 2015 - 3:27 AM - hans - Author: Comment Link

      Hi Mike,

      thanks for leaving a nice comment, it’s much appreciated!
      Glad to hear it worked well for you too.
      And … thank for the tip … others might benefit from that as well … 

      Reply

      hans

  • Sep 21, 2015 - 5:56 AM - Otis Comment Link

    Awesome, and thank you! This broke down a lot of settings that individual searches for made confusing.

    Reply

    Otis

    • Sep 21, 2015 - 6:01 AM - hans - Author: Comment Link

      Thanks Otis for taking the effort to post a “Thank you” – it’s much appreciated,

      Just some additional info … 

      To make things more complicated: a newer codec has surfaced (x265 or h265 aka HEVC), at this moment the quality should be the same as 264, yet compression should be better.

      I did a few tests and the quality is indeed good, and as far as I can see you could gain about 8% better compression, but there is a big but ….

      1) Compression is much slower (slower than realtime)
      2) Not every application supports it yet …

      Reply

      hans

  • Oct 8, 2015 - 9:19 PM - Jason Comment Link

    Who wrote this rubbish? Increasing resolution is ESSENTIAL if viewing vids in VR. All my music videos that are not HD have been increased from as low as 480 to 1080 – it absolutely sharpens up the image (especially with the magnifying-glass tech of the Rift). But, of course,  you can’t increase size with idiot Handbrake. You can with Vidcoder.

    Reply

    Jason

    • Oct 9, 2015 - 2:38 AM - hans - Author: Comment Link

      Hello Jason,

      I’m very open to criticism, but you could have brought it in a somewhat nicer way … 

      When I look at upscaling (for regular video), I look at playback devices with limited resolution, where the video has (almost) the same or higher resolution than the screen resolution of the playback device. With regular video, when the original video is for example 720p, and the screen of say your phone is 720p as well, then upscaling to 4K doesn’t add value. It only increases file size, and might even make the end result a tiny bit blurry.

      However … it is very well possible that upscaling while transcoding could result in a better video, especially when the playback device does not use any of the more advanced upscaling techniques. So for example for playback of a 720p video on a 4K screen, where the TV does a crappy job in upscaling the video, but your transcoder does a fantastic job.
      Some examples can be seen in this article, showing how some TV’s do a great job in upscaling and others not so much.
      Another interesting read is this article (The secret of YIFI – not the highest quality, but an interesting read).

      Keep in mind though that most of those reading this article typically look for the best valance between quality and file size.

      So your comment is valid for very particular applications (both software and purpose) for sure.

      Thank you though for the VidCoder tip.
      I should take a look one of these days, unfortunately it only runs on Windows.
      Note however that VidCoder is a GUI for the HandBrake engine – from the VidCoder website: “The core encoding engine is written by the amazing HandBrake team). VidCoder is however, is supposed to have a much easier UI than HandBrake.

      Note: As I have read elsewhere, the upcoming x265/h265 might be a better codec choice as well, although compressing takes much more time, it could reduce the file size up to 10% maintaining the same or sometimes better video quality at lower bitrates.

      Reply

      hans

  • Oct 9, 2015 - 5:33 PM - anonymous Comment Link

    Thanks for the info. For us lazy folk though, it would’ve been even better to include a download link, with all of the best presets, to simply import into Handbrake. ;)

    Reply

    anonymous

  • Oct 17, 2015 - 8:05 PM - marcos Comment Link

    thanks for your post, could you please explain IN THE SAME WAY(you did it amazing :)) how the filters and the advanced tab works? please

    Reply

    marcos

    • Oct 18, 2015 - 2:55 AM - hans - Author: Comment Link

      Hi Marcos! 

      Thank you for the compliment 

      Thank you for the suggestion …
      As for the Filters, I assume you mean the Filters under Picture Settings?
      And the Advanced tab, you mean the one under Preferences?

      Reply

      hans

  • Nov 18, 2015 - 10:08 AM - Khalid - Author: Comment Link

    I had been doing video encoding for awhile mostly for testing . In
    past I was know nothing about Video Codec I thought file extensions has
    same video codec .avi is AVI and mp4 is MPEG4 . and I was using many
    crape softwares that pretend they have best compression methods . until
    couple years ago I notice most of online videos are using same Codec
    (H264) . I do tests converting my old video to this codec using
    Handbreak and the result was shucking for me .

    what h264 saying
    about it’s gives double in quality or half in size was absolutely true ,
    I did test comparing mpeg-4 with same compressing setting , I got the
    double of file size an much lower quality , I even feel the other codes
    focusing in loosing quality to reduce file size with same old
    compressing methods .

    Last I did testing on h265 (HEVC) and again
    the results was amazing , I never thought some one will beat H264 in
    compressing and video quality , but the did , even it’s still new technology but the improvement were very notable , I got at less
    20% file size reduce even 40% in some cases with max compress setting ,
    but I cant tell about quality due the different way that h265 compress
    image use , all my test on HEVC I use already compressed video so I cant
    judge on it right now , if some one have uncompressed or lossless video
    you can do better tests .

    Reply

    Khalid

    • Nov 18, 2015 - 5:32 PM - hans - Author: Comment Link

      Hi Khalid,

      I think you’ve went the path a lot of us have went.

      As for testing h264 vs h265, I’d start with a “neutral” video. Doesn’t really matter what format it is, as long as it’s not h264/h265. Encode with each of the 2 formats and compare. As long as both use the same source. Compare all 3 – the original, the h264 and the h265.

      But … comparing is a complicated business, and there are a lot of criteria you’d have to look at.
      Experts will have a big list of (valid) arguments, … 

      Reply

      hans

  • Dec 26, 2015 - 11:40 PM - James Comment Link

    Hiya.

    I’m trying to transcode a lossless audio and video of an Audiobook (video_ts files with no compression) so I can upload this on YouTube.

    It’s a standard 720×480 video format.

    The video image (text on screen) changes once around every 30 seconds.

    Instead of writing out all of the things I can’t seem to do right, could you please help me on the settings?

    Cheers.

    Reply

    James

    • Dec 27, 2015 - 8:35 AM - hans - Author: Comment Link

      Hi James,

      What is going wrong when you try the settings mentioned in this article?

      It seems YouTube prefers MP4 (h264), so that’s the first setting I’d do.
      For the Audio track I’d pick AAC, and the video filter I’d set to “stillimage” or “animation“.
      Some more info on the supported codes, see also these YouTube Recommended Upload Codec Settings.

      Hope this solves the issue(s) you’re running into. If not; feel free to ask. 

      Reply

      hans

  • Dec 27, 2015 - 11:49 AM - James Comment Link

    I’m not sure what I was doing wrong, but Handbrake kept crashing on me and I would have to hard reset the computer several times.

    I changed it to Constant Framerate and that did the trick.

    Reply

    James

    • Dec 28, 2015 - 8:58 AM - hans - Author: Comment Link

      Hi James,

      that sounds like a potential bug in HandBrake, maybe you’d like to report that at the HandBrake Forum …?
      If you do report the bug; mention operating system and version, and HandBrake version.

      I have not [yet] experienced that. I’m more of a fan of variable bitrate, as it is more efficient in storage space. Or did you mean “Constant Quality”? Constant Quality does use variable bitrate, as far as I know anyway.

      Reply

      hans

  • Dec 27, 2015 - 12:05 PM - James Comment Link

    Can you do me a favor?

    Can you please compare these two YouTube videos and tell me any difference or what one has the better quality?

    https://www.youtube.com/watch?v=c6rrfRrafRI

    https://www.youtube.com/watch?v=Mt5ysyhy2k0

    The first one somehow was transcoded as an mp4.

    All the other ones I’ve done so far are m4v.

    I don’t think I changed any settings either.

    Anyway, I’m not sure if I should go back to mp4 or keep doing what I’m doing now.

    Thanks ahead.

    Reply

    James

    • Dec 28, 2015 - 8:54 AM - hans - Author: Comment Link

      Both look pretty much the same when it comes to quality. As a viewer I cannot distinguish any difference.

      M4V is actually almost the same as MP4, if you’d have an MP4 you can rename it to M4V and it would work just fine.
      As far as I understand the only differences are:

      – M4V is used specifically for Apple devices
      – M4V can contain DRM (by Apple) to protect it from being copied

      More details: Difference between MP4 and M4V, and this post on the HandBrake forum.

      So I would say: keep working with MP4, unless you have Apple devices, but even then you can just rename the MP4 to M4V. 

      Reply

      hans

  • Jan 3, 2016 - 3:53 PM - Anyx Comment Link

    Hi Hans

    I am exploring Handbreak and trying to find the best preset for keeping my VOB to MP4 conversions the same as my DVD in terms of quality. I don’t care about file size or encoding time. Quality is my main concern. I own a few DVD’s that I want to play on my Plex server which does not support VOB files and I don’t want to have to swop DVD disks constantly. I ripped these DVD’s to VOB files with DVD Shrink. I now need to convert these VOB files to MP4 in order to make them compatible via Plex.

    Can you point me to a preset that can set this up in Handbreak for me or at least let me know which settings I should change from the default (if any) to get the desired result?

    Thanks a million

    Reply

    Anyx

    • Jan 4, 2016 - 8:20 AM - hans - Author: Comment Link

      Hi Anyx,

      I’m not aware of the perfect preset … you have to keep in mind that when you’re transcoding one codec (MPEG2) to another (h264 or h265), that there will always be loss. If you set “Constant Quality” to 0 (zero) then you should get the max quality. I have never tried this though, and I have no clue about the impact in quality.

      Additionally you can set the preset to “slow” or “medium”, the slower, the more effort is taking to get it perfect, but also the more time it takes.

      h264 will be much faster than h265, but some users claim that h265 might result in a better quality. I cannot confirm this though.

      Reply

      hans

  • Feb 13, 2016 - 6:21 AM - Just-another_dude Comment Link

    Thanks man, that improved my videos a lot. especially the de interlace, i hate it…

    thanks

    Reply

    Just-another_dude

  • Feb 24, 2016 - 10:52 PM - Devon Comment Link

    Hi, is there anyway you can tell me what I’m doing wrong?? I have been trying to encode a dvd and get it onto my external hard drive and every single time I encode it and then try to watch it after it finishes, it is distorted and pixelated and you can’t even make out what they’re saying. Helpppp!

    Reply

    Devon

    • Feb 25, 2016 - 5:09 AM - hans - Author: Comment Link

      Hi Devon,

      sounds like the decryption (CSS) of the DVD is not working for the DVD you’re trying to rip. This can happen, especially since the HandBrake team has abandoned the decryption part.

      You have a few options …

      1) Get the latest libdvdcss (I’ve described that in these articles: Mac, Windows, Linux)

      2) Rip the entire DVD before running it through HandBrake. Since I don’t know which OS you’re running, for Windows you could use DVDShrink for example, but there are other tools that can do this.

      3) Use another ripping and converting tool, like for example DVDFab (available for Mac or Windows, unfortunately commercial but works very well – I think they offer a trial version so you can test your DVD).

      Reply

      hans

    • Feb 25, 2016 - 5:09 AM - hans - Author: Comment Link

      I forgot to mention DVDDecryptor for Windows with option 2.

      Reply

      hans

  • Apr 14, 2016 - 8:11 PM - Kit Ballard Comment Link

    How interesting. Thanks for this rather nice rundown. Didn’t even know much about the x264 tune option. While my laptop is slower than molasses, I’m trying to crush files as small as I could while keeping some good quality to upload, as I’m always data capped on my cell. I’ll have to try a few of these next time I run my compression rounds. And I guess I’ll stop using “Very Slow” preset then haha.

    What would you recommend for Game Recordings for the Tune setting? Been recording Super Mario Maker (which has Mario Bros, Mario Bros 3, Super Mario Bros, and New Super Mario Bros U) and trying to pick a good option.. Since 3 of the 4 game style modes are 2D sprites, I was thinking of using the “Animation” setting.. or should I just leave it on “Film”?

    Thank you again ^_^

    ~Kit

    Reply

    Kit Ballard

    • Apr 15, 2016 - 4:39 AM - hans - Author: Comment Link

      Hi Kit! 

      Thanks for the compliment .
      Yeah the “very slow” preset is indeed what it says … very slow hahah.

      For game recordings you could test “animation” indeed, especially with games like Mario … they look mostly like animation anyway. Even the 3D Maria variant would do (probably) well with “animation” as well.

      For more advanced 3D games, you could consider “film”, but then I’m thinking about modern games, like Call of Duty etc, where the surroundings and game play looks very much real-life. 

      Reply

      hans

  • Apr 25, 2016 - 12:50 PM - Robert Comment Link

    Hello, 

    Very instructive article. One question; experimenting with h264, I create the file , and copy it to a thumb drive and play it on my Sony Blu-ray. However the playback starts and freezes the picture every few seconds making the video unwatchable. When I encode in MPEG 2, picture quality is smooth . Is this because the player doesn’t handle h264 well, or is there something I can do in Handbrake to make a better quality file?

    Thanks

    RFD

    Reply

    Robert

    • Apr 25, 2016 - 5:33 PM - hans - Author: Comment Link

      Hi Robert!

      Well, of course it could be that your BluRay player is picky about it’s h264 files.

      Not sure if “Profile” and “Level” will help – but it might be worth doing some tests with those settings – you could give the “Baseline” profile a try.
      More info on profiles and levels can be found on this MediaCoder page.

      Another issue might be your thumbdrive – there are a few models out there notoriously slow, which, with normal use, might not be that noticeable or obvious since your computer might be caching file transfers. Especially with USB 2.0 drives; test a regular USB harddrive, or another USB stick.

      Another thing I do, not sure if it helps, is checking “Web optimized” and “iPod 5G support“.
      It’s something I do automatically from the first day I started using Handbrake, not even sure if that even still makes sense to do.

      Reply

      hans

      • Apr 25, 2016 - 6:04 PM - Robert Comment Link

        Thanks, I will try it 

        Reply

        Robert

        • Apr 26, 2016 - 3:12 AM - hans - Author: Comment Link

          Cool! Please let us know which setting did the trick for you – other might benefit from that as well. 
          (totally optional of course)

          Reply

          hans

  • Jun 9, 2016 - 1:57 AM - Raoul Comment Link

    Nice info thanks for this. I have a simple question I have an old computer I plan to upgrade so I can do more encoding properly. What hardware requirements can you suggest that’s suitable for x264 encoding. I mean in terms of processor that might not burden the cpu etc. Thanks

    Reply

    Raoul

    • Jun 9, 2016 - 2:57 AM - hans - Author: Comment Link

      Hi Raoul,

      it’s a little difficult to define what would be the best hardware config.
      It’s usually a balace between memory (RAM), CPU speed and number of cores, the application you use, and disk speed. Some tools even use the GPU for transcoding. And of course; what is your goal? As fast as possible? Or should it just transcode, and it’s OK that it takes more time.

      For example, for a “slow” computer, you could add a decent video card (CPU) that is supported by handbrake’s GPU Encoding (see this post in the Handbrake Wiki).

      Reply

      hans

      • Jun 9, 2016 - 5:18 AM - Raoul Comment Link

        Hi Hans, 

        Thanks for the reply. Anyway what I was aiming for is a descent pc or laptop just for encoding my dvds to x264. My old pc is okay but for a 2hr video to encode for 3days seems a drain to the pc. I’m planning to buy a new one so I was asking inputs on what specs should I look for if my plan was to use it for encoding. I am not after a super so fast encoding time like minutes just may be a fair balance between quality and encoding time may be cutting that 3 days time in half that would make me happy.😊

        Reply

        Raoul

      • Jun 9, 2016 - 6:45 AM - hans - Author: Comment Link

        Oh wow, yeah 3 days seems a little long indeed ….

        If you’re picking a computer for this purpose, I’d look for an intel quad core i7 CPU, at a decent clock rate. Not necessarily max speed, but a good speed somewhere in at least the 2+ Ghz range. A good chunk of memory will be beneficial als well, say 16Gb. If you’d like, and if the budget allows, use an SSD disk – you’ll enjoy a significant speed boost there.

        Not required, and not tested either, but a nice video card could be beneficial – but if you’re not playing games on your computer, then don’t waste too much on that.

        Since you’re talking about DVD’s; consider getting a decent speed Blu-Ray player, just in case you run into Blu-Rays at some point. The price difference should not be excessive (just need a Player, not a burner).

        Reply

        hans

        • Jun 9, 2016 - 7:13 AM - Raoul Comment Link

          Thanks for that info Hans I will take down this is what I was actually looking for. Nope I have no plans of playing video games for encoding not sure what video card would be nice. Ajd great idea on getting that BluRay player I forgot about that I’ll probably choose a drive that can read Blurays.

          Reply

          Raoul

  • Jul 1, 2016 - 3:34 AM - Randy Pratama Comment Link

    You are a life saver. I have been editing my vids since two days ago but I even din’t get anything yet. Haha it sounds terrible tho. I recorded my vids with Samsung Galaxy Note 3 which means the video is 4K. And I edited the video through Filmora and I got a lag while editing the video. It’s about the FPS. But I got so much better things when I tried to compress them with HandBrake. Would you mind to give me a few suggestions? I still get a problem with the lag (FPS). I am still newbie tho, I really want to edit my video to be uploaded on YouTube. I am an English learner, so I want to share some English Lessons to my friends and people.

    Reply

    Randy Pratama

    • Jul 1, 2016 - 5:57 AM - hans - Author: Comment Link

      Hi Randy,

      you’re most welcome and thank you for posting here! 

      If you are experiencing a lag in your converted movie, then there are 2 possible causes.

      1) Filmora (never used it myself) is not keeping up or using a conversion library that cannot keep up.
      2) You’re using a codec like H.265 (often referred to as HVEC) which might be too much for your computer to playback.

      Not sure what the Samsung Galaxy Note 3 uses as a default codec. But 4K on it’s own can be pushing the computer to it’s boundaries, especially when using H.265 with that (not to be confused with H.264).

      For H.265 you’ll need a very potent computer or a computer with a video chip / graphics card that can handle this in hardware.
      As far as I know only certain expensive video cards (at the moment) support H.265. Seems some of the latest Intel chipsets might offer support for this as well.

      Do you know what codec the Samsung is using?

      Reply

      hans

  • Jul 29, 2016 - 1:32 PM - Kris Comment Link

    Great great write up!  FYI Handbrake was taking hours to covert MKV  to  H.264 so after some research I used msconfig to force enable all 8 cores on my i7.   Holy Freaking Cow!!!!!!    SD movie converted in 15 min.  Also made sure to covert from one SSD to another SSD not sure if one change was more important than the other but this same encode took 45min before the 2 setup changes.  Disk utilization is at 8% on the read disk and 1% on the write  disk.  All 8 cores at 100%.  Thanks again! I made many alterations in Hanbrake based on your advice here 👊🏻

    Reply

    Kris

    • Jul 30, 2016 - 3:39 AM - hans - Author: Comment Link

      Awesome Kris!

      Thanks for the compliment! 
      With proper hardware, HandBrake sure flies … 

      What changes did you make in msconfig to force all 8 cores?

      Reply

      hans

    • Jul 30, 2016 - 3:46 AM - hans - Author: Comment Link

      OK found it … this is how you can force all cores for Windows in MSConfig.
      Note that theoretically this should not be necessary, as Windows is supposed to use all cores by default.

      1. Run “msconfig” as Administrator,
      2. Click the Boot tab and choose Advanced Options.
      3. Check the box labeled Number of processors.
      4. Pick from the list how many cores you want to run.
      5. Click OK.
      6. Click OK again click Restart to reboot your computer.

      Cool beans! Hope this is helpful for others! 

      Reply

      hans

  • Aug 31, 2016 - 12:11 AM - Tomei Comment Link

    Really informative post, thanks! Do you have similar recommendations for preferred audio settings? (codec, bit rate, sampling etc?).

    T.

    Reply

    Tomei

    • Aug 31, 2016 - 8:19 AM - hans - Author: Comment Link

      Hi Tomei!

      Thank you for the compliment … 

      As for audio settings,… it all depends on what your personal preferences are. If you’re happy with just stereo, then Id just pick 2 Channel AAC.
      Personally, I’d pick:

      First track (surround): AC3 or DTS passthrough (if available on the original video).
      As an alternative, you could consider using AAC for this. Set it to 5.1 and the bitrate to 384kbps or 448kbps.

      Second track (stereo): AAC, mix down to stereo, with a bitrate of say 128kbps.

      It all depends on your goal. AC3 and DTS can chew up a bit of space, but I think it’s worth it.
      The second channel I use for devices that cannot play AC3 or DTS.

      Obviously, if there is no surround track available, then only use the (second) stereo AAC track.

      Reply

      hans

  • Dec 25, 2016 - 3:13 PM - littlejeem Comment Link

    Hello There

    First of all thanks for writing this up. It’s because of people like you on the internet that people like me (complete novice) can now run a Linux based headless media server….

    Everything you have said is really clear apart from this section:

    “HandBrake has a slider at “Constant Quality” allowing you to set an RF value, between 50 (low quality) and 0 (highest quality).

    The default value is set to “20” which can be considered adequate for a DVD copy. For HD video (720p and up) an RF of 21 – 23 is recommended, and some even recommend 30”

    ….The way that I read this first paragraph is that the lower the number the higher the quality.

    ……The second paragraph however seems to contradict this: “20 which can be considered adequate for a DVD copy. For HD video (720p and up) an RF of 21 – 23”

    Can you help me by explaining this? I am backing up my bluray discs. File size is not the greatest issue so I wanted to go for file that including HD audio are around 6-8gb.

    Littlejeem

    Reply

    littlejeem

    • Dec 26, 2016 - 9:52 AM - hans - Author: Comment Link

      Hi LittleJeem …

      Thank you for the compliment!

      I do understand that it sounds conflicting. It is one of the reasons why I actually wrote the article – I have to think for a minute as well whenever I use Handbrake (which is not very often).

      Yes: A lower number for Constant Quality, means less “loss” because less compression was used, which translates on better quality.
      So read Constant Quality as “compression level” – the higher this number, the more loss and the smaller the resulting file.

      Now for HD Video, a higher number for CQ would be OK as the little bit of loss will be less noticeable (the lower resolution of DVD for example, makes the same amount of loss much more visible to the viewer) – I presume that is why quite a lor of user recommend a higher CQ value.

      You have to keep in mind that lower QC = lower compression = higher quality = larger file.

      To make things more confusing:

      When re-compressing a video, Handbrake first has to decompress the video. Since DVD, BluRay, etc use lossy compression, some of the details got lost when the DVD or BluRay was created by the manufacturer or your recording device. Decompressing the video will not bring back this loss.

      After decompressing, Handbrake will compress the video again, and will use a lossy compression as well (where RF=20 is comparable-ish with regular DVD compression and RF=22 is kind-a like standard BlueRay compression). So if we’d recompress a DVD with an RF lower than 20, we in essence do not add any value in quality, yet your file will get bigger.

      A more extreme example: Using RF=0 (no compression) is useless for most video files. During the original compression, some details already gort lost. Decompressing the file (RF=0) will not bring the lost details back. However,… the resulting file will be ginormous.

      Hope this helps with the confusion 

      Reply

      hans

      • Jan 3, 2017 - 3:55 PM - Littlejeem Comment Link

        Thanks Hans

        That cleared it up for me greatly :), appreciate you time and happy new year.

        Littlejeem

        Reply

        Littlejeem

  • Dec 30, 2016 - 2:33 PM - Thomas Comment Link

    Thank you so much for your great article. I learned couple good tit bits I didn’t know. Well written and well explained.

    I must disagree with you on one important point thou. That is the advice to crop the “Black Bars” from the video. Doing this will permanently destroy the original aspect ratio of your video. Letterbox 2.35:1, CinemaScope 1.85:1, and PanaVision 1.66:1 etc are film aspect ratios based on the height and width of the video in 1080p (or 720p) and NOT 800p (or 544p). This is a 16:9 ratio. Once the video is cropped that ratio is gone, forever. If you try and play that video on a 1200p screen which is 16:10, how is the video player going to know how to display the image?  4K screens can be 4096 × 2160 or
    3996 × 2160. Even worse if you have something like a tablet with a 3000×2000 pixel display. That’s a 3:2 ratio. Those “Black Bars” are part of the image and need to be kept.

    Now I know what you are thinking. You don’t want to waste space on your drive or sacrifice download speed to your clients. But with modern codecs you are not really saving THAT much space. The codec will just write “make this pixel (or group of pixels) black for the next so many frames. Sure it adds a little bit to the overall file size, but not much. And it’s better then having peoples faces taller and skinny or short and fat on different devices no? The Director, Cinematographer, Editor, Producer, etc wanted you to see their work in a certain way. Why destroy that?

    Give it a try for yourself to see the file size difference. Set up Handbrake the way you usually would. This article is an amazing first step. Run your video through first with cropping. Now do it again with everything exactly the same except go into  Picture and set it to 1920 x 1080, Anamorphic: None, Modulus: 8, Cropping: Custom, Top/Bottom/Left/Right: All to Zero. Now run it again. See, not really a huge difference. Other then the fact you can play it anywhere on any device and get proper ratio and proper up-scaling.

    Cheers eh

    Reply

    Thomas

    • Dec 30, 2016 - 3:43 PM - hans - Author: Comment Link

      Hi Thomas,

      thank you for the compliments and the feedback.

      You make a valid point concerning the black bars, especially since the actually space saving is minimal. Add to that the compatibility, or better playback, with all the different screen sizes … I’ll add this to the article. So in hind sight; I agree! 

      Reply

      hans

      • Feb 5, 2017 - 2:00 AM - aa pp Comment Link

        WRONG ******, the device should handle the resizing of the video, YOU DON’T ENCODE BLACK BARS ******* noobs….

        Reply

        aa pp

        • Feb 5, 2017 - 12:34 PM - hans - Author: Comment Link

          There is no need for this kind of language.

          I can see 2 scenario’s where either could be beneficial.
          One is where the device is simply not capable to handle resizing properly, and this happens with older equipment, and makes the suggestion valid.
          The other is modern device that do proper resizing, where encoding the black bars is not desired.

          For each it’s own.

          Reply

          hans

  • Feb 2, 2017 - 5:07 PM - Hunter - Author: Comment Link

    I recently started encoding in x265 and the side is reduced to nearly 1/5th i hope everyone should try this out. I mean it can save a lot of disk space..

    Reply

    Hunter

    • Feb 3, 2017 - 8:07 AM - hans - Author: Comment Link

      Hello Hunter,

      that has been my experience as well. The only downside of h265 is that quite a lot of HTPC’s out there are not able to handle h265 all that well (for example simple x86 PC’s, Amazon Fire TV, etc). An additional downside is that h265 takes more time to compress.

      Having said that; it most certainly is the future … and once I get a HTPC that can handle h265, I’ll most certainly write something similar for that codec as well. Any suggestions and tips are most welcome of course! 

      Reply

      hans

  • Feb 13, 2017 - 6:12 PM - Brian Comment Link

    Brother, stumbled upon your article and very glad I did!  Very clear and informative.  I was doing audio and video editing/encoding in 2001 when mp3 and DivX Mpeg 4 were still babies.  Co-started the very first Fan Website for a contestant on the first season American Idol TV show the end of June 2002.  Got a million hits the first 24 hours.  I used to digitally record the shows and create video and audio files of the performances and upload them to the website.  Back when TV networks didn’t know what to do about it and most people couldn’t figure out how it was being done.  Until I was contacted by the attorney representing the contestant. :)  Apparently they were so impressed they made it the Official Fan Website.  I used TMPEnc Video Encoder when it was first started in 2000 (when it was free) for many years.  Back then there wasn’t much in the way of video converter/encoder progs.  However, I got burnt out on tech and it’s been several years since I played with video editors/encoders.  I just started using Handbrake and totally love it for what it’s designed for.  Your tips are very much appreciated!  Thanks again bro.

    Reply

    Brian

    • Feb 14, 2017 - 8:49 AM - hans - Author: Comment Link

      Hi Brian!

      Wow, that’s pretty impressive! 

      I too started around 2001 tinkering with audio and video on the PC with the modified Microsoft MPEG4 codec, later called DivX ;-) …
      Feel free to post your link here (and post my link on your website hahah!) …

      I’m glad to hear this was useful to you and thank you very much for taking the time to write a thank you note and sharing your experience. Very cool! 

      Reply

      hans

  • Feb 25, 2017 - 5:23 PM - Kev Comment Link

    Hello,

    thanks for this clear and useful information which just now got me using Handbrake with more confidence – got a better idea of what I can do!  

    • I tried H265 and it is great but couldn’t play back on my Tv equipment – H264 is fine.
    • Handbrake automatically changes the original 1280×720 video to 960×720. Is there a reason and is it not better to keep the original frame size?
    • My original capture file and the encoded one have a flickering line along the bottom of the image on playback on my PC but not (thankfully) on my TV.

    I wonder if video encoders really use the full potential of our computers? I notice when testing other software that HD Video Converter Factory Pro is faster and has processor options including for GPU.

    Reply

    Kev

    • Feb 26, 2017 - 8:49 AM - hans - Author: Comment Link

      Hi Kev!

      Thank you for posting a thank-you! That’s very much appreciated! 

      I agree with your issue with h265 – I have the same issue here. Most playback devices cannot handle this just yet – with the exception of a few devices that either have a great processor (i7) or hardware encoding (depends on GPU). My $39 Android box is pretty good at it, but my older quad-core AMD is horrible at it.
      Space efficiency is pretty good though, but I hear mixed messages on h265 vs h264.

      Handbrake automatically crops the black bars away. Now there are folks in favor of keeping the bars, and those who’d rather not include them. Either way, it’s up to you which you prefer. After an earlier comment I looked at it closer, and when you’re using older devices (that do not properly correct the video aspect ratio) then keep the bars, if you are using newer equipment then have Handbrake remove them.
      Keep in mind that Handbrake has been around for a while and the developers and community around Handbrake is a very active one. I’m sure they know what they are doing .

      The flickering line can be a reside from information like Teletext, etc. You can crop that out in Handbrake by taking away that or those lines. I have seen it before with PAL sources.

      My guess is that video encoders try to use the mac they can get (Handbrake uses multiple cores!), however … some of the really fast encoders try to take shortcuts which negatively affect the quality. Now, having said that: the difference in quality is not noticeable for everybody, I do however see the difference especially with fast changing sceneries. But again; it’s all about personal preferences and if you even notice or care for the difference in quality.
      Note that I’m not familiar with HD Video Converter Factory Pro, and the GPU use can be seen in other applications as well.
      If you have a very potent GPU, then this might be useful – note that HandBrake can support GPU’s as well, but I honestly have not tested this since my GPU’s are kinda slow hahah

      Reply

      hans



Your Comment …

Friendly request to not post large files here (like source codes, log files or config files). Please use the Forum for that purpose.

Please share:
*
*
Notify me about new comments (email).
       You can also use your RSS reader to track comments.


Tweaking4All uses the free Gravatar service for Avatar display.
Tweaking4All will never share your email address with others.