Introduction:

An open source front-end to an open source version of the H.264 codec (x.264), Handbrake is all in all a great piece of software. I did a comparison earlier this year between Handbrake and Adobe Media Encoder to see if there were tangible benefits to doing a little more work and investing a little more time in order to use this software. The results were quite striking and very much in favour of Handbrake.

I have, however, noticed one problem recently with the default audio encoding. This is a description of what the problem is and how to resolve it.

The Problem:

Handbrake defaults to AAC audio encoding. This is fine, particularly as the recommendation for upload to YouTube (and other video hosting services) is AAC. Unfortunately, the default format is actually AAC (avcodec)…

Audio Problem in Handbrake

I was noticing what can only be described as a ‘fluttering’ sound in my audio under certain conditions such as sibilance on speech, chords / pads and helicopter rotors (don’t ask). This was coming through on the speech of all my tutorials recorded prior to a few months ago and I was blaming YouTube and their shoddy and rather hefty re-compression. I never noticed that this was in the version I was uploading to YouTube despite the audio being at a respectable 320kbps. It’s very much like the type of sound when you would hear when encoding audio at a very low bitrate such as 64kbps. Not quite the same but that’s the best description I can give.

This is actually caused by Handbrake and more specifically, the AAC (avcodec) setting.

The Fix:

Well, pretty simple. Change this setting. I have tested AAC (FDK) at 320kbps and this seems fine but I’m also using 320kbps MP3. Most video hosts are perfectly happy with either of these.

Conclusion:

I’m so glad I noticed this. Even though it is only noticeable under certain high frequency detail conditions, I hate the idea that after putting effort into production, it’s let down because of a simple software setting.

NOTE: Thanks to the guys at Handbrake for putting out such a fantastic and functional program for so long. Many programs like this get sucked up by corporations and ruined or dissolved, or the developers move on. It’s nice that this is still going.

 

Join the discussion 16 Comments

  • Remon says:

    Thanks for the easy fix! It was very distracting in videos with rainy scenes.

    • Torsten says:

      Rain! Of course. A perfect example of when this would be a problem. Here’s me going on about a helicopter and rain would have demonstrated the point much more easily :-). I’m glad it helped.

  • James says:

    I had the same issue, if you change the mixdown to automatic it fixes the issue.

  • Andreas says:

    This does not fix this issue on my end. I have the exact same flattering-bubbling digital artifact sound, similar to those in low bitrate encodings.
    It’s clearly to hear at the kickdrum of the soundtrack, which I have written in Logic Pro at 48kHz, exported as 48kHz 24Bit WAV, used it in After Effects CS6, then exported with the video as Uncompressed 48kHz 32Bit (don’t ask me why AE doesn’t have 24Bit after 16Bit setting).
    Quicktime (Win) and VLC show: 48kHz, 32Bit float, Stereo.

    These settings I have tried (all the variations), with a negative outcome:
    avccodec / FDK
    224 – 448kBps
    Dolby Pro Logic II / Stereo / Automatic
    Sample rate: 48kHz / Auto

    Setting audio to MP3 makes it unplayable by the Quicktime player for Windows. Might also be unplayable on Samsung smart-TVs.

  • Andreas says:

    Correcion!
    VLC shows for the AE-exported uncompressed soundtrack: “Codec: 32 bits float LE (fl32)”

    but at the same time also: “Bits per Sample: 16”

  • Andreas says:

    PROBLEM SOLVED!!!

    My issue was in the quantization (Bit depth) differences – when 32Bit float audio had to be encoded to whatever Handbrake does and it probably can’t handle 32Bit float correctly.

    Just ran a couple of last tests:

    Exported from Premiere Pro as 24Bit uncompressed (same as original),
    encoded it with Handbrake at: 224kBps with avccodec, auto mixdown, auto sample rate – sounds PERFECT! :)
    (I assume, it will result the same, if I exported the soundtrack at 16Bit from Logic Pro and used this Bit depth all the way)

    Exported from After Effects as 16Bit uncompressed (while original was 24Bit),
    encoded with same settings in Handbrake – still can hear the artifacts.

    Conclusion:
    The issue might lay not only with Handbreak, but definitely with the bit depth changes while exporting from other software.
    KEEP THE BIT DEPTH THE SAME through the whole project pipeline!

  • Andreas says:

    UPDATE

    The issue is more complicated than I thought…

    My assumption that keeping the bitdepth at 16Bit throughout the whole project pipeline until the Handbake encoding would solve the issue, hasn’t confirmed.

    I’ve ran some more tests and found an interesting corellation:

    Regardless of other Handbrake audio settings, it was the Bitrate that was responsible for the bad digital artifacts!
    I’ve found that uncompressed audio at 16Bit sounds after encoding with Handbrake as follows:

    112 – 160, 448 kBit/s: very bad!
    192 – 256 kBit/s: bad
    320 kBit/s: GOOD !!!

    So, the solution:
    if you’re to encode a uncompressed stereo soundtrack (PCM), make sure it is INTEGER, not Float and has 16Bit and encode it at 320 kBit/s.
    (avc codec, FDK, mixdown, sample rate – DO NOT MATTER – you can leave them at default)

    Cheers!

    P.S.: don’t use MP3 – not every player can deal with a video, which has an mp3 soundtrack!

  • Andreas says:

    Damn it!

    Forget all I wrote above. The issue still occurs in longer (3,5 minutes) videos. The short test pieces of half a minute length were however okay with 320 kBit/s – both in avc and FDK codecs.

    Now it’s just some kind of evil irony of life – after long encoding time I can not only hear that flatter-bubble-sound instead of a clean solid kick drum, but there are also glitches in the stereo signal. Like some parts of audio jump quickly from normal stereo to left or right channel and then back to normal stereo! Totally weird.

    This sucks and now I’ve ran out of clues..

    • Torsten says:

      Hi Andreas,

      Thank you for the detailed replies. You’re right that it does sound completely like sample rate conversion noise. I might have to do a bit more digging on this one too because this is still working for me but I’m not sure if it’s just a mad coincidence of the formats, sample rate, bit rates and bit depths of the files I’m using.

      Sorry to hear that you didn’t get to the bottom of it.

      Oh, you’re dead right on MP3. I encoded hours of video recently before a trip only to discover that my ‘offlined’ Google Drive files had no sound at all on my iPhone. I’ll avoid MP3 in video now.

      Torsten.

  • Andreas says:

    Hi Torsten,

    I’ve actually found trhough trial and error the recepy that works for me! (with having to downsample the audio at one step)

    1) Have your audio at best settings, in my case it’s 48kHz and 24Bit.
    2) Use it as is in After Effects or Premiere Pro (set your project sample rate accordingly).
    3) Export from AE or PP as 44,1kHz (!!!) and 24Bit.
    4) IMPORTANT: encode your audio in Handbrake back at 48kHz!!! …and, preferably at 320kBit/s (not higher). Whether avc or FDK codec – I’ve heared no difference.

    Yes, it’s kind of strange and a bummer that you need to go from 48 down to 44,1 kHz and doesn’t make sense to go up to 48 again, but at least the encoding doesn’t mess up the sound! Although I still can hear quick slightly changes in stereo in speech (yes, my speech is stereo :) ) over music, but apart from that – no flattering-bubbling bad encoding sounds!

    Now I’ve remembered that I had no such issues half a year ago, because all my audio was at 44,1kHz already and apparently I’ve used 48kHz in Handbrake in final encoding.

    Cheers!

  • Andreas says:

    Oh, and you can use 16Bit instead of 24, of course. The important thing is – to lower the sample rate in Step 3.

  • Andreas says:

    …. and After Effects doesn’t have the 24Bit export setting, so you can use 32Bit, if the soundtrack you’ve used had 24Bit – it won’t hurt!
    I’ve actually used this exact setting in my pipeline :)

  • Tazedoodle says:

    FIXEDD!!!! Thanks to dis website :)

  • ehsan says:

    P R O B L E M F I X E D !!!!
    Hi; I read the post and the answers completely. that was a very good solution to this problem achieved by “Andreas” accuracy and much efforts!!

    I made a quick test (but I’m not sure yet) that if you lower the sample rate to 32 KHz ( in step 3 of Andreas method! ), it gets a better result.
    in fact, when using Handbrake, if you set the “audio sample rate” more than the “source file sample rate” , then output won’t be distorted; and my quick test says: if the difference between (source and output sample rate) become bigger, the result output would be better !
    sorry for my bad English; my language is persian ;)

  • ehsan says:

    I forgot to thank this website for the useful post ;-)

Leave a Reply