Closed darkstardew closed 7 years ago
@darkstardew No, there's no API to change the bitrate of AAC audio in transcode-video
without using --handbrake-option
.
Why is that?
First, simplicity. It's one less option in an already overcrowded API.
Second, unlike the AC-3 bitrate which is—by default—quite large, there is little to no benefit to reducing or increasing the AAC bitrate. At 160 Kbps for stereo, AAC is essentially transparent for the kind of audio in movies. Making the bitrate larger can actually cause compatibility problems with certain devices, e.g. most Apple hardware. And making the bitrate smaller doesn't save very much space compared to the size of the video.
HandBrake is very smart. So I let it figure out what to do with AAC, i.e. deciding the number of channels and bitrate. For example, if the input is mono, the output will also be mono at 80 Kbps.
However, if enough people want this, I could add an API, something like --ac3-bitrate
, to set the AAC bitrate directly. Not per track, but per job.
My question to you is: why do you think you need this?
I work with a lot of live concert video which will sometimes have things like an uncompressed PCM stereo audio track, no AC3. If listening on a good system there's going to be a noticeable difference in quality (IMO)on a good system with 160Kbps vs. 256 or 320 for example. I have done this with Handbrake and don't have issues with my iPhone, AppleTV, etc. If it will be used by few I can work with --handbrake-option I'll just need to figure out the proper syntax.
@darkstardew The most recent Apple TVs do support 320 Kbps AAC. Buy many of them don't.
OK, here's how to use --handbrake-option
to set the audio bitrate for an AAC track:
1) First execute your command with the --dry-run
option.
2) Look for --audio=
and --aencoder=
in the output for HandBrakeCL
. That will tell you how many tracks you have and which encoders are used for those tracks. For example, that output is probably --audio=1,1 --aencoder=ac3,ca_aac
for most videos. IOW, two audio tracks in the output and the second one is AAC format.
3) Look for --ab=
in the output for HandBrakeCL
. Normally it's not there unless you're changing the default bitrate for AC-3 audio. If it is there, then you'll need to copy its arguments for the next step.
4) Add --handbrake-option ab=,320
(that comma isn't a typo!) to your command line if you only have two audio tracks in the output and the second one is AAC format. Otherwise, modify ab=,320
to match your output track layout or any existing arguments for --ab-
that you found in step 3.
Let me know if that works for you.
Works great! Thanks for your prompt response. I ended up using ab=320 (no comma) in this case because there was only one audio stream. If I understand correctly I'd use the comma if I had a second output stream for audio.
@darkstardew I'm glad that worked!
Yes, that comma in my example was used to separate two bitrate values, the first value being blank to indicate the default bitrate for the AC-3 audio track.
If this is working for you now, one of us can close the issue.
Is there any way to change the default AAC bitrate without changing the code and recompiling? I can't seem to find any options for this, unlike AC3. It looks like I can also pass options directly to HandbrakeCLI but I was wondering if the ability exists to do it or would be added. Thanks!!!