brothom 177 Posted July 18, 2025 Posted July 18, 2025 I've added an extension for the web app to add a setting to force internal subs, external subs. This option could be very useful for users who aren't tech-savvy, don't know the different between internal and external subs and prevent them from selecting "the wrong" subtitles, causing servers to transcode when that shouldn't be necessary. This thread is more or less a proof of concept. This addition will ONLY work on your LOCAL installation. Visiting your server via app.emby.media won't show this addition. Using any app won't either. To add this you'll need these modified files in the attachments: Emby-Server\system\dashboard-ui\item\item.js Emby-Server\system\dashboard-ui\settings\subtitles.html Replace these files in your local server with the files in the attachments and you should see a new dropdown under subtitles called "ForceSubtitleTracks". Picking internal will cause Emby to only show internal subs for media items. Picking external wil cause Emby to only show external subs for media items. Picking none will change nothing The specific modifications per file are: Emby-Server\system\dashboard-ui\item\item.js function renderSubtitleSelections(page, mediaSources) { var selected, mediaSourceId = page.querySelector(".selectSource").value, mediaSources = mediaSources.filter(function (m) { return m.Id === mediaSourceId; })[0], ForceSubtitleTracks=_usersettings.default.getSubtitleAppearanceSettings().ForceSubtitleTracks, tracks = mediaSources.MediaStreams.filter(function (m) { return "Subtitle" === m.Type && ( ( ForceSubtitleTracks === 'external' && m.IsExternal === true ) || ( ForceSubtitleTracks === 'internal' && m.IsExternal === false ) ) }), select = page.querySelector(".selectSubtitles"), selectedId = null == mediaSources.DefaultSubtitleStreamIndex ? -1 : mediaSources.DefaultSubtitleStreamIndex; tracks.length ? ((selected = -1 === selectedId ? " selected" : ""), (select.innerHTML = '<option value="-1">' + _globalize.default.translate("Off") + "</option>" + tracks .map(function (v) { selected = v.Index === selectedId ? " selected" : ""; var embeddedTitle = v.Title && !(v.DisplayTitle || "").includes(v.Title) ? v.Title : null; return "<option" + (embeddedTitle ? ' title="' + embeddedTitle + '"' : "") + ' value="' + v.Index + '" ' + selected + ">" + _textencoding.default.htmlEncode(v.DisplayTitle) + "</option>"; }) .join("")), page.querySelector(".selectSubtitlesContainer").classList.remove("hide")) : ((select.innerHTML = ""), page.querySelector(".selectSubtitlesContainer").classList.add("hide")); } Emby-Server\system\dashboard-ui\settings\subtitles.html <form class="auto-center fieldsets"> <fieldset> <legend class="hide">${Subtitles}</legend> <div class="fieldset-fields"> <div class="selectContainer fieldset-field"> <select is="emby-select" class="selectSubtitleLanguage autoSetting autoSave" data-refreshitemsonchange="true" data-reordering="true" data-joindelimiter="," multiple label="${LabelPreferredSubtitleLanguage}" data-settingfield="SubtitleLanguagePreference" data-settingowner="userconfiguration"></select> </div> <div class="selectContainer fieldset-field"> <select is="emby-select" class="selectSubtitlePlaybackMode autoSetting autoSave emby-select-dynamicfielddescription" data-menu="custom" label="${LabelSubtitlePlaybackMode}" data-settingfield="SubtitleMode" data-settingowner="userconfiguration" data-triggerchange="true"> </select> <div class="fieldDescription dynamicFieldDescription hide"></div> </div> <div class="toggleContainer fieldset-field"> <label> <input type="checkbox" is="emby-toggle" class="chkRememberSubtitles autoSetting autoSave" data-settingfield="RememberSubtitleSelections" data-settingowner="userconfiguration" /> <span>${RememberSelectedSubtitleTracks}</span> </label> <div class="fieldDescription toggleFieldDescription">${RememberSelectedSubtitleTracksHelp}</div> <div class="fieldDescription toggleFieldDescription fldClearTrackSelections"> <button is="emby-button" type="button" class="button-link btnClearTrackSelections" data-mode="subtitles"> <i class="md-icon button-icon button-icon-left"></i> <span>${ClearSavedTrackSelections}</span> </button> </div> </div> <div class="selectContainer fieldset-field"> <select is="emby-select" class="selectForceSubtitleTracks autoSetting autoSave" label="${ForceSubtitleTracks}" data-settingfield="ForceSubtitleTracks" data-settingowner="subtitleappearancesettings" data-triggerchange="true"> <option value="none">${None}</option> <option value="external">${ForceExternal}</option> <option value="internal">${ForceInternal}</option> </select> </div> </div> </fieldset> item.js subtitles.js 1
brothom 177 Posted July 23, 2025 Author Posted July 23, 2025 I'm suprised nobody responded to this yet. I thought this was a pretty sought-after request. My disappointment is immeasurable and my day is ruined 1 1
TeijiIshida 2 Posted January 26 Posted January 26 What happen if you force external but there is no external sub? Does it fallback to internal sub and use all the sub settings in the server?
brothom 177 Posted January 26 Author Posted January 26 1 hour ago, TeijiIshida said: What happen if you force external but there is no external sub? Does it fallback to internal sub and use all the sub settings in the server? It doesn't show the "other" options, at least for web devices, so it wouldn't fallback to anything. That'd require some serverside logic I suppose.
visproduction 315 Posted January 26 Posted January 26 It looks interesting. I always thought you would have to edit code inside the media of a .mkv container to turn off default subtitles and then remx (copy) the edited media as the new master. Does it also remove embedded subs from the media page pull down menu? Are you telling Emby how to play the media but the .mkv container video media may still have the embedded subtitle set to play as default? How does it handle internal embedded subtitles .srt, vtt, ass or graphic .sub when one is set to open as default? What happens when there are no other subtitles files in the media directory? Does this somehow tag the media to have subtitles handled like this for all users both local and remote? Does it update the media for just the admin or a user who has this option set? Can it remember for another session, or do you have to reset it every time? If it can do all this great. I think it may have some limits. Is the code creating a new copy. It seems that it is instructing Emby is some situations how to handle the subtitles. I am guessing to get it to work for every situation you want is maybe not the best approach. Every media file can be changed easily to copy out and remove subtitles and create a media file without any embedded subs. Then you can name the subtitles files, to match the naming convention and control which plays by default or not. Once this is done, the media works that way for everyone without any extra code processing from Emby. If the only solution that can do everything you want requires a copy of the media file to be created, that's sort goes against the base rules of how Emby works, in my opinion. Read only is he approach and creating any plug in that changes media files should probably not be allowed. This policy, I think, would make it impossible to create a plugin that works all the time. The correct way is for the admin to chose how to prep their meda file copies for their libraries and fix subtitle issues that way only.
brothom 177 Posted January 27 Author Posted January 27 15 hours ago, visproduction said: Does it also remove embedded subs from the media page pull down menu? Are you telling Emby how to play the media but the .mkv container video media may still have the embedded subtitle set to play as default? How does it handle internal embedded subtitles .srt, vtt, ass or graphic .sub when one is set to open as default? What happens when there are no other subtitles files in the media directory? It's not a complex feature in the slightest and yes, it only "filters" the options from the dropdown menu. No clue what would happen if you'd start play when there are "no" options. Maybe the Emby Server will decide upon a default / random subtitle. That'd be up to the backend devs. 15 hours ago, visproduction said: Does this somehow tag the media to have subtitles handled like this for all users both local and remote? Does it update the media for just the admin or a user who has this option set? Can it remember for another session, or do you have to reset it every time? There're no additional features going on here. Emby by default remembers the subs you last picked when resuming an item, so I suppose that's that "remembering" part. I'd added this as a global setting (mostly because I couldn't be bothered checking out the client-settings) but I'd (personally) much rather see this a server-wide settins because the purpose of this feature is to prevent obnoxious, graphic fonts from forcing unnecessary transcoding just because a client picked "PGSUB" instead of "SubRip". 1
visproduction 315 Posted January 27 Posted January 27 (edited) I would like to try it out, but I am sort of in transit and have no server access. It would be nice if you can add a default option for the subs you want to show automatically and somehow make it stick for users. Of course, you may have users who speak different languages. Hmmm, is there a preferred language setting that can help customize the subtitles settings, per user? Wow, that gets complicated... Ha! Being able to set a default subtitle, helps users enjoy the content, without having to flip the sub on. For separate sub files, I think you already know, just add .default before the file name extension. This would be a nice feature, especially for TV episodes, because the pull down is hidden in the single episode page. Also, setting default would be nice when there is a forced subtitle, which only covers foreign language, in otherwise single language content. If the film is in English and a waiter in Paris speaks French, the forced subs might give only the French translation in English. Quite often, a few lines of foreign dialog are already burned into the media. Getting all the options for subtitles is way more complex than most people imagine. It's nice that you have done this code. Edited January 27 by visproduction 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now