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

Add audio options to workaround compatability problems

This commit is contained in:
gnattu 2024-08-29 09:49:00 +08:00
parent d4467424a0
commit e810ec3cd9
6 changed files with 99 additions and 6 deletions

View file

@ -309,7 +309,8 @@ function getAudioStreamUrl(item, transcodingProfile, directPlayContainers, apiCl
PlaySessionId: startingPlaySession, PlaySessionId: startingPlaySession,
StartTimeTicks: startPosition || 0, StartTimeTicks: startPosition || 0,
EnableRedirection: true, EnableRedirection: true,
EnableRemoteMedia: appHost.supports('remoteaudio') EnableRemoteMedia: appHost.supports('remoteaudio'),
EnableAudioVbrEncoding: transcodingProfile.EnableAudioVbrEncoding
}); });
} }

View file

@ -190,6 +190,9 @@ function loadForm(context, user, userSettings, systemInfo, apiClient) {
context.querySelector('.chkLimitSupportedVideoResolution').checked = appSettings.limitSupportedVideoResolution(); context.querySelector('.chkLimitSupportedVideoResolution').checked = appSettings.limitSupportedVideoResolution();
context.querySelector('#selectPreferredTranscodeVideoCodec').value = appSettings.preferredTranscodeVideoCodec(); context.querySelector('#selectPreferredTranscodeVideoCodec').value = appSettings.preferredTranscodeVideoCodec();
context.querySelector('#selectPreferredTranscodeVideoAudioCodec').value = appSettings.preferredTranscodeVideoAudioCodec(); context.querySelector('#selectPreferredTranscodeVideoAudioCodec').value = appSettings.preferredTranscodeVideoAudioCodec();
context.querySelector('.chkDisableVbrAudioEncoding').checked = appSettings.disableVbrAudio();
context.querySelector('.chkAlwaysRemuxFlac').checked = appSettings.alwaysRemuxFlac();
context.querySelector('.chkAlwaysRemuxMp3').checked = appSettings.alwaysRemuxMp3();
setMaxBitrateIntoField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video'); setMaxBitrateIntoField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video');
setMaxBitrateIntoField(context.querySelector('.selectVideoInternetQuality'), false, 'Video'); setMaxBitrateIntoField(context.querySelector('.selectVideoInternetQuality'), false, 'Video');
@ -232,6 +235,9 @@ function saveUser(context, user, userSettingsInstance, apiClient) {
appSettings.enableTrueHd(context.querySelector('.chkEnableTrueHd').checked); appSettings.enableTrueHd(context.querySelector('.chkEnableTrueHd').checked);
appSettings.enableHi10p(context.querySelector('.chkEnableHi10p').checked); appSettings.enableHi10p(context.querySelector('.chkEnableHi10p').checked);
appSettings.disableVbrAudio(context.querySelector('.chkDisableVbrAudioEncoding').checked);
appSettings.alwaysRemuxFlac(context.querySelector('.chkAlwaysRemuxFlac').checked);
appSettings.alwaysRemuxMp3(context.querySelector('.chkAlwaysRemuxMp3').checked);
setMaxBitrateFromField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video'); setMaxBitrateFromField(context.querySelector('.selectVideoInNetworkQuality'), true, 'Video');
setMaxBitrateFromField(context.querySelector('.selectVideoInternetQuality'), false, 'Video'); setMaxBitrateFromField(context.querySelector('.selectVideoInternetQuality'), false, 'Video');

View file

@ -22,6 +22,14 @@
<input type="checkbox" is="emby-checkbox" class="chkPlayDefaultAudioTrack" /> <input type="checkbox" is="emby-checkbox" class="chkPlayDefaultAudioTrack" />
<span>${LabelPlayDefaultAudioTrack}</span> <span>${LabelPlayDefaultAudioTrack}</span>
</label> </label>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input type="checkbox" is="emby-checkbox" class="chkDisableVbrAudioEncoding" />
<span>${LabelDisableVbrAudioEncoding}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${DisableVbrAudioEncodingHelp}</div>
</div>
</div> </div>
<div class="qualitySections hide"> <div class="qualitySections hide">
@ -212,6 +220,28 @@
</div> </div>
</div> </div>
<div class="verticalSection verticalSection-extrabottompadding">
<h2 class="sectionTitle">
${HeaderAudioAdvanced}
</h2>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input type="checkbox" is="emby-checkbox" class="chkAlwaysRemuxFlac" />
<span>${LabelAlwaysRemuxFlacAudioFiles}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${AlwaysRemuxFlacAudioFilesHelp}</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label>
<input type="checkbox" is="emby-checkbox" class="chkAlwaysRemuxMp3" />
<span>${LabelAlwaysRemuxMp3AudioFiles}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${AlwaysRemuxMp3AudioFilesHelp}</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">
<span>${Save}</span> <span>${Save}</span>
</button> </button>

View file

@ -738,10 +738,19 @@ export default function (options) {
}); });
} }
profile.DirectPlayProfiles.push({ if (audioFormat === 'flac' && appSettings.alwaysRemuxFlac()) {
Container: audioFormat, // force remux flac in fmp4. Clients not supporting this configuration should disable this option
Type: 'Audio' profile.DirectPlayProfiles.push({
}); Container: 'mp4',
AudioCodec: 'flac',
Type: 'Audio'
});
} else if (audioFormat !== 'mp3' || !appSettings.alwaysRemuxMp3()) { // mp3 remux profile is already injected
profile.DirectPlayProfiles.push({
Container: audioFormat,
Type: 'Audio'
});
}
// https://www.webmproject.org/about/faq/ // https://www.webmproject.org/about/faq/
if (audioFormat === 'opus' || audioFormat === 'webma') { if (audioFormat === 'opus' || audioFormat === 'webma') {
@ -794,7 +803,8 @@ export default function (options) {
Protocol: 'hls', Protocol: 'hls',
MaxAudioChannels: physicalAudioChannels.toString(), MaxAudioChannels: physicalAudioChannels.toString(),
MinSegments: browser.iOS || browser.osx ? '2' : '1', MinSegments: browser.iOS || browser.osx ? '2' : '1',
BreakOnNonKeyFrames: hlsBreakOnNonKeyFrames BreakOnNonKeyFrames: hlsBreakOnNonKeyFrames,
EnableAudioVbrEncoding: !appSettings.disableVbrAudio()
}); });
} }

View file

@ -195,6 +195,45 @@ class AppSettings {
return toBoolean(this.get('enableHi10p'), false); return toBoolean(this.get('enableHi10p'), false);
} }
/**
* Get or set 'Disable VBR audio encoding' state.
* @param {boolean|undefined} val - Flag to enable 'Disable VBR audio encoding' or undefined.
* @return {boolean} 'Disable VBR audio encoding' state.
*/
disableVbrAudio(val) {
if (val !== undefined) {
return this.set('disableVbrAudio', val.toString());
}
return toBoolean(this.get('disableVbrAudio'), false);
}
/**
* Get or set 'Always remux FLAC audio files' state.
* @param {boolean|undefined} val - Flag to enable 'Always remux FLAC audio files' or undefined.
* @return {boolean} 'Always remux FLAC audio files' state.
*/
alwaysRemuxFlac(val) {
if (val !== undefined) {
return this.set('alwaysRemuxFlac', val.toString());
}
return toBoolean(this.get('alwaysRemuxFlac'), false);
}
/**
* Get or set 'Always remux MP3 audio files' state.
* @param {boolean|undefined} val - Flag to enable 'Always remux MP3 audio files' or undefined.
* @return {boolean} 'Always remux MP3 audio files' state.
*/
alwaysRemuxMp3(val) {
if (val !== undefined) {
return this.set('alwaysRemuxMp3', val.toString());
}
return toBoolean(this.get('alwaysRemuxMp3'), false);
}
set(name, value, userId) { set(name, value, userId) {
const currentValue = this.get(name, userId); const currentValue = this.get(name, userId);
localStorage.setItem(this.#getKey(name, userId), value); localStorage.setItem(this.#getKey(name, userId), value);

View file

@ -47,6 +47,8 @@
"AllowTonemappingSoftwareHelp": "Tone-mapping can transform the dynamic range of a video from HDR to SDR while maintaining image details and colors, which are very important information for representing the original scene. Currently works only with 10bit HDR10, HLG and DoVi videos.", "AllowTonemappingSoftwareHelp": "Tone-mapping can transform the dynamic range of a video from HDR to SDR while maintaining image details and colors, which are very important information for representing the original scene. Currently works only with 10bit HDR10, HLG and DoVi videos.",
"AlwaysPlaySubtitles": "Always Play", "AlwaysPlaySubtitles": "Always Play",
"AlwaysPlaySubtitlesHelp": "Subtitles matching the language preference will be loaded regardless of the audio language.", "AlwaysPlaySubtitlesHelp": "Subtitles matching the language preference will be loaded regardless of the audio language.",
"AlwaysRemuxFlacAudioFilesHelp": "If you have files that your browser rejects to play or where it inaccurately calculates timestamps, enable this as a workaround.",
"AlwaysRemuxMp3AudioFilesHelp": "If you have files that your browser inaccurately calculates timestamps, enable this as a workaround.",
"AndOtherArtists": "{0} and {1} other artists.", "AndOtherArtists": "{0} and {1} other artists.",
"AnyLanguage": "Any Language", "AnyLanguage": "Any Language",
"Anytime": "Anytime", "Anytime": "Anytime",
@ -223,6 +225,7 @@
"EnablePlugin": "Enable", "EnablePlugin": "Enable",
"DisableCustomCss": "Disable server-provided custom CSS code", "DisableCustomCss": "Disable server-provided custom CSS code",
"DisablePlugin": "Disable", "DisablePlugin": "Disable",
"DisableVbrAudioEncodingHelp": "Prevent the server from encoding audio with VBR for this client.",
"Disc": "Disc", "Disc": "Disc",
"Disconnect": "Disconnect", "Disconnect": "Disconnect",
"Display": "Display", "Display": "Display",
@ -365,6 +368,7 @@
"HeaderApp": "App", "HeaderApp": "App",
"HeaderAppearsOn": "Appears On", "HeaderAppearsOn": "Appears On",
"HeaderAudioBooks": "Audio Books", "HeaderAudioBooks": "Audio Books",
"HeaderAudioAdvanced": "Audio Advanced",
"HeaderAudioSettings": "Audio Settings", "HeaderAudioSettings": "Audio Settings",
"HeaderAutoDiscovery": "Network Discovery", "HeaderAutoDiscovery": "Network Discovery",
"HeaderBlockItemsWithNoRating": "Block items with no or unrecognized rating information", "HeaderBlockItemsWithNoRating": "Block items with no or unrecognized rating information",
@ -564,6 +568,8 @@
"LabelAllowedRemoteAddresses": "Remote IP address filter", "LabelAllowedRemoteAddresses": "Remote IP address filter",
"LabelAllowedRemoteAddressesMode": "Remote IP address filter mode", "LabelAllowedRemoteAddressesMode": "Remote IP address filter mode",
"LabelAllowHWTranscoding": "Allow hardware transcoding", "LabelAllowHWTranscoding": "Allow hardware transcoding",
"LabelAlwaysRemuxFlacAudioFiles": "Always remux FLAC audio files",
"LabelAlwaysRemuxMp3AudioFiles": "Always remux MP3 audio files",
"LabelAppName": "App name", "LabelAppName": "App name",
"LabelAppNameExample": "A human readable name for identifying API keys. This setting will not affect functionality.", "LabelAppNameExample": "A human readable name for identifying API keys. This setting will not affect functionality.",
"LabelArtists": "Artists", "LabelArtists": "Artists",
@ -635,6 +641,7 @@
"LabelDeinterlaceMethod": "Deinterlacing method", "LabelDeinterlaceMethod": "Deinterlacing method",
"LabelDeveloper": "Developer", "LabelDeveloper": "Developer",
"LabelDisableCustomCss": "Disable custom CSS code for theming/branding provided from the server.", "LabelDisableCustomCss": "Disable custom CSS code for theming/branding provided from the server.",
"LabelDisableVbrAudioEncoding": "Disable VBR audio encoding",
"LabelDiscNumber": "Disc number", "LabelDiscNumber": "Disc number",
"LabelDisplayLanguage": "Display language", "LabelDisplayLanguage": "Display language",
"LabelDisplayLanguageHelp": "Translating Jellyfin is an ongoing project.", "LabelDisplayLanguageHelp": "Translating Jellyfin is an ongoing project.",