1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-04-26 07:53:42 +02:00

Bug 344 - FFmpeg: M4A Quality slider has no control of bitrate setting or AAC quality

This commit is contained in:
James Crook
2019-07-15 13:10:34 +01:00
parent 53eb72103d
commit 6eb612bb73

View File

@@ -399,11 +399,15 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
switch (mSubFormat) switch (mSubFormat)
{ {
case FMT_M4A: case FMT_M4A:
mEncAudioCodecCtx->bit_rate = 98000; {
int q = gPrefs->Read(wxT("/FileFormats/AACQuality"),-99999);
mEncAudioCodecCtx->global_quality = q;
q = wxClip( q, 98, 160 );
// Set bit rate to between 98 bps and 320 bps (if two channels)
mEncAudioCodecCtx->bit_rate = q * 1000;
mEncAudioCodecCtx->bit_rate *= mChannels; mEncAudioCodecCtx->bit_rate *= mChannels;
mEncAudioCodecCtx->profile = FF_PROFILE_AAC_LOW; mEncAudioCodecCtx->profile = FF_PROFILE_AAC_LOW;
mEncAudioCodecCtx->cutoff = 0; mEncAudioCodecCtx->cutoff = 0;
mEncAudioCodecCtx->global_quality = gPrefs->Read(wxT("/FileFormats/AACQuality"),-99999);
if (!CheckSampleRate(mSampleRate, if (!CheckSampleRate(mSampleRate,
ExportFFmpegOptions::iAACSampleRates[0], ExportFFmpegOptions::iAACSampleRates[0],
ExportFFmpegOptions::iAACSampleRates[11], ExportFFmpegOptions::iAACSampleRates[11],
@@ -415,6 +419,7 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
&ExportFFmpegOptions::iAACSampleRates[0]); &ExportFFmpegOptions::iAACSampleRates[0]);
} }
break; break;
}
case FMT_AC3: case FMT_AC3:
mEncAudioCodecCtx->bit_rate = gPrefs->Read(wxT("/FileFormats/AC3BitRate"), 192000); mEncAudioCodecCtx->bit_rate = gPrefs->Read(wxT("/FileFormats/AC3BitRate"), 192000);
if (!CheckSampleRate(mSampleRate,ExportFFmpegAC3Options::iAC3SampleRates[0], ExportFFmpegAC3Options::iAC3SampleRates[2], &ExportFFmpegAC3Options::iAC3SampleRates[0])) if (!CheckSampleRate(mSampleRate,ExportFFmpegAC3Options::iAC3SampleRates[0], ExportFFmpegAC3Options::iAC3SampleRates[2], &ExportFFmpegAC3Options::iAC3SampleRates[0]))