Added support for bitrate management to LAME and OggEnc2 encoders.
This commit is contained in:
parent
41d040e7aa
commit
3f0796d288
@ -413,6 +413,22 @@
|
|||||||
<source>Better quality</source>
|
<source>Better quality</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source> Bitrate Management (LAME and OggEnc2) </source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Enable Bitrate Management</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Minimum (kbps):</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Maximum (kbps):</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source> Encode Now!</source>
|
<source> Encode Now!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
|
@ -157,7 +157,7 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>The True Audio - Lossless Audio Codec</source>
|
<source>The True Audio - Lossless Audio Codec</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@ -896,35 +896,51 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source> LAME Algorithm Quality </source>
|
<source> LAME Algorithm Quality </source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>LAME Algorithmus Qualität</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Faster Processing</source>
|
<source>Faster Processing</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Schnellere Verarbeitung</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Better quality</source>
|
<source>Better quality</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Bessere Qualität</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Best Quality (Very Slow)</source>
|
<source>Best Quality (Very Slow)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Beste Qualität (Sehr Langsam)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>High Quality (Recommended)</source>
|
<source>High Quality (Recommended)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Höhere Qualität (Empfohlen)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Average Quality (Default)</source>
|
<source>Average Quality (Default)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Mittlere Qualität (Standard)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Low Quality (Fast)</source>
|
<source>Low Quality (Fast)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Niedrige Qualität (Schnell)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Poor Quality (Very Fast)</source>
|
<source>Poor Quality (Very Fast)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Miese Qualität (Sehr Schnell)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source> Bitrate Management (LAME and OggEnc2) </source>
|
||||||
|
<translation>Bitraten Verwaltung (LAME und OggEnc2)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Enable Bitrate Management</source>
|
||||||
|
<translation>Bitraten Verwaltung Aktivieren</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Minimum (kbps):</source>
|
||||||
|
<translation>Minimum (kbps):</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Maximum (kbps):</source>
|
||||||
|
<translation>Maximum (kbps):</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -926,6 +926,22 @@
|
|||||||
<source>Poor Quality (Very Fast)</source>
|
<source>Poor Quality (Very Fast)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source> Bitrate Management (LAME and OggEnc2) </source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Enable Bitrate Management</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Minimum (kbps):</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Maximum (kbps):</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MetaInfo</name>
|
<name>MetaInfo</name>
|
||||||
|
@ -930,6 +930,22 @@ Votre dossier TEMP est situé ici:</translation>
|
|||||||
<source>Poor Quality (Very Fast)</source>
|
<source>Poor Quality (Very Fast)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source> Bitrate Management (LAME and OggEnc2) </source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Enable Bitrate Management</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Minimum (kbps):</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Maximum (kbps):</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MetaInfo</name>
|
<name>MetaInfo</name>
|
||||||
|
@ -926,6 +926,22 @@
|
|||||||
<source>Poor Quality (Very Fast)</source>
|
<source>Poor Quality (Very Fast)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source> Bitrate Management (LAME and OggEnc2) </source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Enable Bitrate Management</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Minimum (kbps):</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Maximum (kbps):</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>MetaInfo</name>
|
<name>MetaInfo</name>
|
||||||
|
@ -1120,7 +1120,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string> Bitrate Management </string>
|
<string> Bitrate Management (LAME and OggEnc2) </string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_19">
|
<layout class="QGridLayout" name="gridLayout_19">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
@ -1700,6 +1700,7 @@
|
|||||||
<include location="../res/Icons.qrc"/>
|
<include location="../res/Icons.qrc"/>
|
||||||
<include location="../res/Icons.qrc"/>
|
<include location="../res/Icons.qrc"/>
|
||||||
<include location="../res/Icons.qrc"/>
|
<include location="../res/Icons.qrc"/>
|
||||||
|
<include location="../res/Icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
Binary file not shown.
@ -25,7 +25,7 @@
|
|||||||
#define VER_LAMEXP_MAJOR 4
|
#define VER_LAMEXP_MAJOR 4
|
||||||
#define VER_LAMEXP_MINOR_HI 0
|
#define VER_LAMEXP_MINOR_HI 0
|
||||||
#define VER_LAMEXP_MINOR_LO 0
|
#define VER_LAMEXP_MINOR_LO 0
|
||||||
#define VER_LAMEXP_BUILD 245
|
#define VER_LAMEXP_BUILD 246
|
||||||
#define VER_LAMEXP_SUFFIX Beta-1
|
#define VER_LAMEXP_SUFFIX Beta-1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -436,6 +436,10 @@ void ProcessingDialog::startNextJob(void)
|
|||||||
mp3Encoder->setBitrate(m_settings->compressionBitrate());
|
mp3Encoder->setBitrate(m_settings->compressionBitrate());
|
||||||
mp3Encoder->setRCMode(m_settings->compressionRCMode());
|
mp3Encoder->setRCMode(m_settings->compressionRCMode());
|
||||||
mp3Encoder->setAlgoQuality(m_settings->lameAlgoQuality());
|
mp3Encoder->setAlgoQuality(m_settings->lameAlgoQuality());
|
||||||
|
if(m_settings->bitrateManagementEnabled())
|
||||||
|
{
|
||||||
|
mp3Encoder->setBitrateLimits(m_settings->bitrateManagementMinRate(), m_settings->bitrateManagementMaxRate());
|
||||||
|
}
|
||||||
encoder = mp3Encoder;
|
encoder = mp3Encoder;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -444,6 +448,10 @@ void ProcessingDialog::startNextJob(void)
|
|||||||
VorbisEncoder *vorbisEncoder = new VorbisEncoder();
|
VorbisEncoder *vorbisEncoder = new VorbisEncoder();
|
||||||
vorbisEncoder->setBitrate(m_settings->compressionBitrate());
|
vorbisEncoder->setBitrate(m_settings->compressionBitrate());
|
||||||
vorbisEncoder->setRCMode(m_settings->compressionRCMode());
|
vorbisEncoder->setRCMode(m_settings->compressionRCMode());
|
||||||
|
if(m_settings->bitrateManagementEnabled())
|
||||||
|
{
|
||||||
|
vorbisEncoder->setBitrateLimits(m_settings->bitrateManagementMinRate(), m_settings->bitrateManagementMaxRate());
|
||||||
|
}
|
||||||
encoder = vorbisEncoder;
|
encoder = vorbisEncoder;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -42,6 +42,8 @@ MP3Encoder::MP3Encoder(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_algorithmQuality = 3;
|
m_algorithmQuality = 3;
|
||||||
|
m_configBitrateMaximum = 0;
|
||||||
|
m_configBitrateMinimum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MP3Encoder::~MP3Encoder(void)
|
MP3Encoder::~MP3Encoder(void)
|
||||||
@ -73,6 +75,15 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((m_configBitrateMaximum > 0) && (m_configBitrateMinimum > 0) && (m_configBitrateMinimum <= m_configBitrateMaximum))
|
||||||
|
{
|
||||||
|
if(m_configRCMode != SettingsModel::CBRMode)
|
||||||
|
{
|
||||||
|
args << "-b" << QString::number(clipBitrate(m_configBitrateMinimum));
|
||||||
|
args << "-B" << QString::number(clipBitrate(m_configBitrateMaximum));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!metaInfo.fileName().isEmpty()) args << (IS_UNICODE(metaInfo.fileName()) ? "--uTitle" : "--lTitle") << metaInfo.fileName();
|
if(!metaInfo.fileName().isEmpty()) args << (IS_UNICODE(metaInfo.fileName()) ? "--uTitle" : "--lTitle") << metaInfo.fileName();
|
||||||
if(!metaInfo.fileArtist().isEmpty()) args << (IS_UNICODE(metaInfo.fileArtist()) ? "--uArtist" : "--lArtist") << metaInfo.fileArtist();
|
if(!metaInfo.fileArtist().isEmpty()) args << (IS_UNICODE(metaInfo.fileArtist()) ? "--uArtist" : "--lArtist") << metaInfo.fileArtist();
|
||||||
if(!metaInfo.fileAlbum().isEmpty()) args << (IS_UNICODE(metaInfo.fileAlbum()) ? "--uAlbum" : "--lAlbum") << metaInfo.fileAlbum();
|
if(!metaInfo.fileAlbum().isEmpty()) args << (IS_UNICODE(metaInfo.fileAlbum()) ? "--uAlbum" : "--lAlbum") << metaInfo.fileAlbum();
|
||||||
@ -188,3 +199,35 @@ void MP3Encoder::setAlgoQuality(int value)
|
|||||||
{
|
{
|
||||||
m_algorithmQuality = value;
|
m_algorithmQuality = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MP3Encoder::setBitrateLimits(int minimumBitrate, int maximumBitrate)
|
||||||
|
{
|
||||||
|
m_configBitrateMinimum = minimumBitrate;
|
||||||
|
m_configBitrateMaximum = maximumBitrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MP3Encoder::clipBitrate(int bitrate)
|
||||||
|
{
|
||||||
|
int targetBitrate = min(max(bitrate, 32), 320);
|
||||||
|
|
||||||
|
int minDiff = INT_MAX;
|
||||||
|
int minIndx = -1;
|
||||||
|
|
||||||
|
for(int i = 0; SettingsModel::mp3Bitrates[i] > 0; i++)
|
||||||
|
{
|
||||||
|
int currentDiff = abs(targetBitrate - SettingsModel::mp3Bitrates[i]);
|
||||||
|
if(currentDiff < minDiff)
|
||||||
|
{
|
||||||
|
minDiff = currentDiff;
|
||||||
|
minIndx = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(minIndx >= 0)
|
||||||
|
{
|
||||||
|
return SettingsModel::mp3Bitrates[minIndx];
|
||||||
|
}
|
||||||
|
|
||||||
|
return targetBitrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,14 @@ public:
|
|||||||
|
|
||||||
//Advanced options
|
//Advanced options
|
||||||
virtual void setAlgoQuality(int value);
|
virtual void setAlgoQuality(int value);
|
||||||
|
virtual void setBitrateLimits(int minimumBitrate, int maximumBitrate);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_binary;
|
const QString m_binary;
|
||||||
int m_algorithmQuality;
|
int m_algorithmQuality;
|
||||||
|
int m_configBitrateMaximum;
|
||||||
|
int m_configBitrateMinimum;
|
||||||
|
|
||||||
|
int clipBitrate(int bitrate);
|
||||||
};
|
};
|
||||||
|
@ -41,6 +41,9 @@ VorbisEncoder::VorbisEncoder(void)
|
|||||||
{
|
{
|
||||||
throw "Error initializing Vorbis encoder. Tool 'oggenc2.exe' is not registred!";
|
throw "Error initializing Vorbis encoder. Tool 'oggenc2.exe' is not registred!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_configBitrateMaximum = 0;
|
||||||
|
m_configBitrateMinimum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VorbisEncoder::~VorbisEncoder(void)
|
VorbisEncoder::~VorbisEncoder(void)
|
||||||
@ -68,6 +71,12 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((m_configBitrateMaximum > 0) && (m_configBitrateMinimum > 0) && (m_configBitrateMinimum <= m_configBitrateMaximum))
|
||||||
|
{
|
||||||
|
args << "--min-bitrate" << QString::number(min(max(m_configBitrateMinimum, 32), 500));
|
||||||
|
args << "--max-bitrate" << QString::number(min(max(m_configBitrateMaximum, 32), 500));
|
||||||
|
}
|
||||||
|
|
||||||
if(!metaInfo.fileName().isEmpty()) args << "-t" << metaInfo.fileName();
|
if(!metaInfo.fileName().isEmpty()) args << "-t" << metaInfo.fileName();
|
||||||
if(!metaInfo.fileArtist().isEmpty()) args << "-a" << metaInfo.fileArtist();
|
if(!metaInfo.fileArtist().isEmpty()) args << "-a" << metaInfo.fileArtist();
|
||||||
if(!metaInfo.fileAlbum().isEmpty()) args << "-l" << metaInfo.fileAlbum();
|
if(!metaInfo.fileAlbum().isEmpty()) args << "-l" << metaInfo.fileAlbum();
|
||||||
@ -167,3 +176,9 @@ bool VorbisEncoder::isFormatSupported(const QString &containerType, const QStrin
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VorbisEncoder::setBitrateLimits(int minimumBitrate, int maximumBitrate)
|
||||||
|
{
|
||||||
|
m_configBitrateMinimum = minimumBitrate;
|
||||||
|
m_configBitrateMaximum = maximumBitrate;
|
||||||
|
}
|
||||||
|
@ -36,9 +36,13 @@ public:
|
|||||||
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
|
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
|
||||||
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
|
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
|
||||||
virtual QString extension(void);
|
virtual QString extension(void);
|
||||||
|
virtual void setBitrateLimits(int minimumBitrate, int maximumBitrate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_binary_i386;
|
const QString m_binary_i386;
|
||||||
const QString m_binary_sse2;
|
const QString m_binary_sse2;
|
||||||
const QString m_binary_x64;
|
const QString m_binary_x64;
|
||||||
|
int m_configBitrateMaximum;
|
||||||
|
int m_configBitrateMinimum;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user