Skip to content

Commit

Permalink
Added support for aac format audio (import/export)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Nov 10, 2024
1 parent b144c90 commit 928db8c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ <h6 class="fs-6">Audio Export:</h6>
<option value="wav">WAV</option>
<option value="flac">FLAC</option>
<option value="mp3">MP3</option>
<!-- <option value="m4a">M4A</option> -->
<option value="aac">AAC</option>
<option value="opus">Opus</option>
</select>
</div>
Expand All @@ -828,8 +828,9 @@ <h6 class="fs-6">Audio Export:</h6>
<option value="320">320 kbps</option>
<option value="192">192 kbps</option>
<option value="160">160 kbps</option>
<option value="128">128 kbps</option>
<option value="128">128 kbps (recommended)</option>
<option value="96">96 kbps</option>
<option value="64">64 kbps</option>
</select>
</div>
<div id="quality-container" class="pe-3 input-group rounded p-2 mb-1">
Expand Down
2 changes: 1 addition & 1 deletion js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4385,7 +4385,7 @@ function playRegion(){
// Audio preferences:

const showRelevantAudioQuality = () => {
if (['mp3', 'opus'].includes(config.audio.format)) {
if (['mp3', 'opus', 'aac'].includes(config.audio.format)) {
DOM.audioBitrateContainer.classList.remove('d-none');
DOM.audioQualityContainer.classList.add('d-none');
} else if (config.audio.format === 'flac') {
Expand Down
3 changes: 2 additions & 1 deletion js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,7 @@ const bufferToAudio = async ({
format ??= STATE.audio.format;
const formatMap = {
mp3: { audioCodec: 'libmp3lame', soundFormat: 'mp3' },
aac: { audioCodec: 'aac', soundFormat: 'mp4' },
wav: { audioCodec: 'pcm_s16le', soundFormat: 'wav' },
flac: { audioCodec: 'flac', soundFormat: 'flac' },
opus: { audioCodec: 'libopus', soundFormat: 'opus' }
Expand All @@ -1798,7 +1799,7 @@ const bufferToAudio = async ({
// .audioFrequency(METADATA[file].sampleRate)
.audioCodec(audioCodec)
.seekInput(start).duration(end - start)
if (['mp3', 'm4a', 'opus'].includes(format)) {
if (['mp3', 'aac', 'opus'].includes(format)) {
//if (format === 'opus') bitrate *= 1000;
command = command.audioBitrate(bitrate)
} else if (['flac'].includes(format)) {
Expand Down

0 comments on commit 928db8c

Please sign in to comment.