Hi all,

I have been re-encoding using handbrake’s presets (Matroska hevc 480p/1080p) and results are good for the most part, some issues here and there. I started trying out ffmpeg with cuda and hevc_nvenc and p7 preset. Video quality looks way better but audio is very bad. I am using aac 128k and the audio is very compressed and quite frankly hurts my ears. I started looking into the handbrake options and there’s auto pass through and stereo downmixing, etc. I tried reading the ffmpeg documentation but there is a lot there and I’m not really sure what I’m doing.

tldr; Anyone have tips on getting good quality audio encoding (aac) from my bluray rips?

  • vzq@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    27
    ·
    9 months ago

    I am 90% sure handbrake is an ffmpeg front end. If you dig around in the config files or source repo you can probably find the exact settings used.

    • notfromhere@lemmy.oneOP
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      3
      ·
      9 months ago

      My understanding is that handbrake uses some of the ffmepg libraries but is not on top of the ffmpeg binary, so things do that translate directly. I’ll check out the source code and see what I can figure out about the preset to ffmpeg option mapping.

  • Nawor3565@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    13
    ·
    9 months ago

    Handbreak is just a GUI for FFmpeg, so the only thing it could be is your settings. Are you using the -c:a copy option with FFmpeg to copy the audio instead of transcoding it?

    • notfromhere@lemmy.oneOP
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      2
      ·
      9 months ago

      I’ll give copy a try instead of transcoding and see how that works. I wanted the video, audio, and container format to be the same across my library, so as long as it’s always using the same codec across my movies, that should be fine.

  • bbbhltz@beehaw.org
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    1
    ·
    9 months ago

    Some things to look at:

    Is it possible that Handbrake is just copying the audio from the source, and ffmpeg is transcoding it? I make podcast videos for my partner and I have run into problems with audio quality, so I think I have heard what you’re talking about.

    Also, what are you running this on? It is possible that the Ffmpeg on your system was not compiled with all the options you need.

    • notfromhere@lemmy.oneOP
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      9 months ago

      Running on Ubuntu LTS. I will try out copying the audio and comparing. I have a huge backlog and already made a good dent before I caught this problem.

  • sqw@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    3
    ·
    9 months ago

    yes basically handbrake is an easy button but not as powerful as ffmpeg. ffmpeg has aac encoding options, sometimes you can get into easier syntaxes just to make it easier on the mortal mind by first demuxing your source file into individual streams, re-encoding those as needed, then remuxing together. i still have no idea how to get ffmpeg to use cuda/nvenc and also do other things as the syntax becomes arcane to me

    • notfromhere@lemmy.oneOP
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      1
      ·
      9 months ago

      Yea easy button means I’m not learning much about the process. I think I just need to take the plunge and learn all about ffmpeg.

  • qfjp@lemmy.one
    link
    fedilink
    English
    arrow-up
    1
    ·
    9 months ago

    It’s hard to know for sure, but I’m guessing if you’re forcing hevc_nvenc in ffmpeg then handbrake is using libx265. Nvidia’s encoder rips through files, but that speed comes at the cost of bigger file sizes. libx265 uses the cpu so it’ll be much slower, but you’ll probably see files 30% smaller. As for audio, you could always try -c:a copy as an option for ffmpeg. I don’t actually use handbrake myself, so I don’t know how to directly copy streams.

    As a side note, if you don’t need to worry about licensing issues mp4 will compress much better than mkv.