1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add setting to prioritise what audio codec to transcode to (#5434)

* Add setting to prioritise what audio codec to transcode to

* Add comment

* rename selectPreferredTranscodeAudio to preferredTranscodeAudio

* Add review changes

* Add review changes

* Add reviewed fixes

* Add help text.

* Fix elint

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Change *AudioCodecInVideo  to *VideoAudioCodec  and move option to video advanced

* Update src/components/playbackSettings/playbackSettings.template.html

Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com>
This commit is contained in:
scampower3 2024-05-18 13:19:56 +08:00 committed by GitHub
parent 291d3099bb
commit 32fc33894d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 44 additions and 0 deletions

View file

@ -70,6 +70,21 @@ function getDeviceProfile(item) {
}); });
} }
const preferredTranscodeVideoAudioCodec = appSettings.preferredTranscodeVideoAudioCodec();
if (preferredTranscodeVideoAudioCodec) {
profile.TranscodingProfiles.forEach((transcodingProfile) => {
if (transcodingProfile.Type === 'Video') {
const audioCodecs = transcodingProfile.AudioCodec.split(',');
const index = audioCodecs.indexOf(preferredTranscodeVideoAudioCodec);
if (index !== -1) {
audioCodecs.splice(index, 1);
audioCodecs.unshift(preferredTranscodeVideoAudioCodec);
transcodingProfile.AudioCodec = audioCodecs.join(',');
}
}
});
}
resolve(profile); resolve(profile);
}); });
} }

View file

@ -182,6 +182,7 @@ function loadForm(context, user, userSettings, systemInfo, apiClient) {
context.querySelector('.chkRememberSubtitleSelections').checked = user.Configuration.RememberSubtitleSelections || false; context.querySelector('.chkRememberSubtitleSelections').checked = user.Configuration.RememberSubtitleSelections || false;
context.querySelector('.chkExternalVideoPlayer').checked = appSettings.enableSystemExternalPlayers(); context.querySelector('.chkExternalVideoPlayer').checked = appSettings.enableSystemExternalPlayers();
context.querySelector('.chkLimitSupportedVideoResolution').checked = appSettings.limitSupportedVideoResolution(); context.querySelector('.chkLimitSupportedVideoResolution').checked = appSettings.limitSupportedVideoResolution();
context.querySelector('#selectPreferredTranscodeVideoAudioCodec').value = appSettings.preferredTranscodeVideoAudioCodec();
setMaxBitrateIntoField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video'); setMaxBitrateIntoField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video');
setMaxBitrateIntoField(context.querySelector('.selectVideoInternetQuality'), false, 'Video'); setMaxBitrateIntoField(context.querySelector('.selectVideoInternetQuality'), false, 'Video');
@ -217,6 +218,7 @@ function saveUser(context, user, userSettingsInstance, apiClient) {
appSettings.maxChromecastBitrate(context.querySelector('.selectChromecastVideoQuality').value); appSettings.maxChromecastBitrate(context.querySelector('.selectChromecastVideoQuality').value);
appSettings.maxVideoWidth(context.querySelector('.selectMaxVideoWidth').value); appSettings.maxVideoWidth(context.querySelector('.selectMaxVideoWidth').value);
appSettings.limitSupportedVideoResolution(context.querySelector('.chkLimitSupportedVideoResolution').checked); appSettings.limitSupportedVideoResolution(context.querySelector('.chkLimitSupportedVideoResolution').checked);
appSettings.preferredTranscodeVideoAudioCodec(context.querySelector('#selectPreferredTranscodeVideoAudioCodec').value);
appSettings.enableDts(context.querySelector('.chkEnableDts').checked); appSettings.enableDts(context.querySelector('.chkEnableDts').checked);
appSettings.enableTrueHd(context.querySelector('.chkEnableTrueHd').checked); appSettings.enableTrueHd(context.querySelector('.chkEnableTrueHd').checked);

View file

@ -179,6 +179,19 @@
</label> </label>
<div class="fieldDescription checkboxFieldDescription">${EnableTrueHdHelp}</div> <div class="fieldDescription checkboxFieldDescription">${EnableTrueHdHelp}</div>
</div> </div>
<div class="selectContainer">
<select is="emby-select" id="selectPreferredTranscodeVideoAudioCodec" label="${LabelSelectPreferredTranscodeVideoAudioCodec}">
<option value="">${Auto}</option>
<option value="aac">AAC</option>
<option value="ac3">AC3</option>
<option value="alac">ALAC</option>
<option value="dts">DTS</option>
<option value="flac">FLAC</option>
<option value="opus">Opus</option>
</select>
<div class="fieldDescription">${SelectPreferredTranscodeVideoAudioCodecHelp}</div>
</div>
</div> </div>
<button is="emby-button" type="submit" class="raised button-submit block btnSave hide"> <button is="emby-button" type="submit" class="raised button-submit block btnSave hide">

View file

@ -132,6 +132,18 @@ class AppSettings {
return toBoolean(this.get('limitSupportedVideoResolution'), false); return toBoolean(this.get('limitSupportedVideoResolution'), false);
} }
/**
* Get or set preferred transcode audio codec in video playback.
* @param {string|undefined} val - Preferred transcode audio codec or undefined.
* @return {string} Preferred transcode audio codec.
*/
preferredTranscodeVideoAudioCodec(val) {
if (val !== undefined) {
return this.set('preferredTranscodeVideoAudioCodec', val);
}
return this.get('preferredTranscodeVideoAudioCodec') || '';
}
/** /**
* Get or set 'Enable DTS' state. * Get or set 'Enable DTS' state.
* @param {boolean|undefined} val - Flag to enable 'Enable DTS' or undefined. * @param {boolean|undefined} val - Flag to enable 'Enable DTS' or undefined.

View file

@ -566,6 +566,7 @@
"LabelAudioCodec": "Audio codec", "LabelAudioCodec": "Audio codec",
"LabelAudioLanguagePreference": "Preferred audio language", "LabelAudioLanguagePreference": "Preferred audio language",
"LabelSelectAudioNormalization": "Audio Normalization", "LabelSelectAudioNormalization": "Audio Normalization",
"LabelSelectPreferredTranscodeVideoAudioCodec": "Preferred transcode audio codec in video playback",
"LabelAudioSampleRate": "Audio sample rate", "LabelAudioSampleRate": "Audio sample rate",
"LabelAuthProvider": "Authentication Provider", "LabelAuthProvider": "Authentication Provider",
"LabelAutomaticallyAddToCollection": "Automatically add to collection", "LabelAutomaticallyAddToCollection": "Automatically add to collection",
@ -1390,6 +1391,7 @@
"Season": "Season", "Season": "Season",
"SecondarySubtitles": "Secondary Subtitles", "SecondarySubtitles": "Secondary Subtitles",
"SelectAdminUsername": "Please select a username for the admin account.", "SelectAdminUsername": "Please select a username for the admin account.",
"SelectPreferredTranscodeVideoAudioCodecHelp": "Select the preferred audio codec to transcode to for video content. If the preferred codec is not supported, the server will use the next best available codec.",
"SelectServer": "Select Server", "SelectServer": "Select Server",
"SendMessage": "Send message", "SendMessage": "Send message",
"Series": "Series", "Series": "Series",