New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M4A(AAC) Export does not honor the user's quality settings for bit rates below 196kbps in the export dialog #4309
Comments
I have not yet tested this on Mac - but when I tested last year I found then:
|
If I understand this bit correctly: audacity/src/export/ExportFFmpeg.cpp Lines 446 to 456 in ea8163f
the value is clamped between 98 and 160 kbit/s per channel, meaning that stereo is clamped at 196-320 kbit/s. Further, mediainfo reveals that stereo output is encoded in VBR while mono output is encoded in CBR. I don't know why it switches, or why AAC refuses to use all of the bitrate it's being granted, I'd propose being explicit about when VBR vs CBR is used - and I given that AFAICT AAC-LC supports all modes that MP3 supports as well, it may be possible to just re-use the MP3 options |
Sounds like a plan Leo ...
But that doesn't explain the 258kbps file that I got when I exported at 320kbps (I don't see much "c;lamping" there.
I can and will do some work on the AAC Export page in the manual as it is still showing the slider and still talks about it. |
I'm not sure what exactly do you mean. As it has been previously discussed, we use something called Please do not open issues claiming that current implementation does not work "as iTunes", because it will not work as iTunes. This is how FFmpeg works, we are not using iTunes to create AAC files. On top of that you have a very old FFmpeg version. Please download newer one from Buanzo. The version you have is very bad at hitting the bitrate target. It is 8 years old. Right now, Audacity has a weird limitation Leo mentioned. It was carried over from the original FFmpeg implementation. It will likely be removed in the future, as Import/Export refactoring proceeds. We have plans to add native AAC support on Windows and macOS. However even in this case Audacity on Windows and Audacity on macOS will behave differently. This won't be a bug. And FFmpeg backed compression will still use called |
ACK
I did wonder about that @crsib - I have upfated: But it begs a question ... You now have a very nice mechanism for informing users that a newer stable released version of Audacity is available - BUT the user appears to have no similar mechanism for warning them (as in my case) that their FFmpeg is out of date and should be updated. Is there any chance that we could have such a mechanism for FFmpeg - or even say test at installation time if the user already has an old FFmpeg installed and install it for them? Or possibly a "check for updates" in the Libraries prefs dialog? |
OK so retesting with my updated FFmpeg I get better results for settings of 200kbps and above but 196kbps and below ALL export at 196kbps. Implying that 196 stereo is the lowest that we support - and presumably 98kbps mono? But it would help the user greatly if the M4a(AAC) Export dialog was a lot clearer about its capabilities and limitations with suitable error trapping and warning |
I'm specifically talking about VBR and CBR encoding modes at different bitrates (or bitrate targets in case of VBR), which the FFmpeg AAC encoder in principle is capable of judging by the output I got earlier. However, looking a bit more into it - according to their docs,
Weirder still, when testing with a plain ffmpeg 5.1.1 build I had flying about, a 30s silence always came out as VBR while a 3:30 song always came out as CBR and a 3:30 noise came out backwards (with b being VBR and q being CBR). This makes the bitrate settings and indeed output quality highly unrealiable. Given all that, it seems like this encoder is massive jank, and exposing any UI regarding VBR and CBR is a lost cause.
That is the case. 98-160 mono, 196-320 stereo On the upside, the Windows platform encoder seems simple enough from a user perspective. You get 4 options, take 'em or leave 'em. Their inclusion of HE-AAC v2 as a profile seems kinda weird though, given that Fraunhofer recommends it at bitrates between 8k-56k, and Windows only starts at 98k. Finally, Apple AAC just looks very competent and unproblematic. |
I'm strongly minded to agree |
Summarizing this:We are doing our users of AAC export a grave disservice, implying we can deliver more than we are capable of:
Recommendationa) I recommend that we have a picking list rather than the variable integer selection (just as we do for MP3 export) This would give us a somewhat sparse, but more honest, list: If the FFmpeg exporter that we use ever gets improved than the picking list can be extended |
I updated my Mac today with Monterey 12.6.3, installed 3.2.4 and upgraded my FFmpeg to the latest version from Buanzo's site. I added the full results to the initial post in this thread - but Mac is broadly similar to Windows except that it performs better for 256 and 320, yielding 262 and 321. One other little oddity of a bear-trap, a residual, that I found while testing on Mac is thata) if I use the up/down arrows to set the required bit-rate Audacity uses that bit-rate b) if I type a number into the bit-rate field, the Audacity ignores that "setting" and instead uses the previously used setting This does NOT happen on Windows, only on Mac. Do we need a separate issue for this. or is it OK here as a residual ? |
I think this deserves an issue |
My preferred solution for this would be the following
Do you really want to keep it in the main list and not just remove it from the main dropdown and keep it accessible only through custom ffmpeg exporting? |
At least for Linux I do |
Hell yes - if AAC export was only available through custom FFmpeg exporting, it would likely frighten the life out of most normal users (it frightens and overwhelms me - I've only ever had to use it for QA testing in the past). Custom export really is an expert level user tool, not for the novice, the ordinary Joe, or the faint-hearted ... |
the above is assuming that the platform-specific encoders will replace the FFMPEG encoder as the default option in the main dropdown. |
Done - see #4320 |
I have updated the AAC Export page in the manual: |
I have re-run the tests today on W10 and macOS 12.6.8 Monterey with the latest 3.4.0 alpha, The results have improved somewhat for Windows meaning that both give reasonably close results with stereo for setting of 196kbps and above: Actual behavior with stereo exportsusing the latest FFmpeg that @crsib recommended_ Windows 10 Mac - macOS 12.6.8 Monterey The close result for 256 on both platforms is particularly pleasing as that is a commonly used rate for quality music. |
Bug description
M4A(AAC) Export does not honor the user's quality settings in the export dialog
a) At rates of below 196 kbps all seem to be exported at 196kbps
b) 200-320 seem to be reasonably close
Note too that the quality field in the export dialog can have numbers below 98 - but if you set a low number and then click elsewhere in the export dialog the rate changes to 98kbps (which I'm guessing is the minimum that Audacity/FFmpeg can handle
Steps to reproduce
a) Rates above 200kbps seem OKish - better on Mac than on Windows
b) rates of 196 and below all export at 196kbps
Expected behavior
Audacity should
a) honor the user's required set kbps rate
b) limit itself to only offering rates that can be realistically honored
Ideally it would limit itself to offering only the practical stepped rates that say iTunes offers for its AAC conversions:
Actual behavior with stereo exports
Windows 10
Updated tested results following an upgrade to the latest FFmpeg that @crsib recommended
Set rate / actual rate - stereo
64 - 196
98 - 196
128 - 196
160 - 196 (this is the default setting AAC export)
192 - 196
189 - 196
200 - 200
224 - 224
235 - 231
256 - 233
320 - 235 (this implies that 235kbps is the best we can achieve)
Mac - macOS 12.6.3 Monterey
Set rate / actual rate - stereo
98 - 198
128 - 198
144 - 198
160 - 198 (this is the default setting AAC export)
192 - 198
196 - 198
200 - 202
224 - 227
256 - 262
320 - 321
Audacity Version
3.2.4 and 3.3.0 alpha master
Operating system
Windows 10 and macOS 12.6.3 Monterey
Additional context
The user can use the up/down arrows to set the quality to be any integer value between 98kbps and 320kbps.
Or the user can type into the quality field
a) values below 98kbps are (silently) forced to 98
b) values above 320kbps are (silently) forced to 320
If we are going to offer the granularity of any integer number between 98-320kbps then we really ought to be honoring the user's setting.
But My thinking is that it would be much better of Audacity limited itself to a set of practical rates as Apple does with Music/iTunes as can be seen in the image above in the Expected Behavior section.
Flagging @Tantacrul @DilsonsPickles and @LWinterberg as this is a UX/design issue as much as it is a technical Audacity/FFmpeg issue.
The text was updated successfully, but these errors were encountered: