Ffmpeg - fast but bad results, handbrake - slow but good results
from notfromhere@lemmy.one to piracy@lemmy.ml on 24 Sep 2023 20:22
https://lemmy.one/post/4465042

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?

#piracy

threaded - newest

sqw@lemmy.sdf.org on 24 Sep 2023 20:37 next collapse

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.one on 24 Sep 2023 22:26 collapse

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.

vzq@lemmy.blahaj.zone on 24 Sep 2023 20:37 next collapse

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.one on 24 Sep 2023 22:25 collapse

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.

bbbhltz@beehaw.org on 24 Sep 2023 20:58 next collapse

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.one on 24 Sep 2023 22:23 collapse

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.

Nawor3565@lemmy.blahaj.zone on 24 Sep 2023 21:30 next collapse

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.one on 24 Sep 2023 22:27 collapse

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.

qfjp@lemmy.one on 01 Oct 2023 15:01 next collapse

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.

Cyberflunk@lemmy.world on 02 Oct 2023 15:24 collapse

It’s live to know how rarbg did this x265 rips