Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use reference framerate as sampling rate (target FPS) for SubtitlesOctopus #6462

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/plugins/htmlVideoPlayer/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ function requireHlsPlayer(callback) {
});
}

function getMediaStreamVideoTracks(mediaSource) {
return mediaSource.MediaStreams.filter(function (s) {
return s.Type === 'Video';
});
}

function getMediaStreamAudioTracks(mediaSource) {
return mediaSource.MediaStreams.filter(function (s) {
return s.Type === 'Audio';
Expand Down Expand Up @@ -1274,6 +1280,9 @@ export class HtmlVideoPlayer {
});
const htmlVideoPlayer = this;
import('@jellyfin/libass-wasm').then(({ default: SubtitlesOctopus }) => {
const mediaSource = this._currentPlayOptions.mediaSource;
const videoStream = getMediaStreamVideoTracks(mediaSource)[0];

const options = {
video: videoElement,
subUrl: getTextTrackUrl(track, item),
Expand All @@ -1296,7 +1305,7 @@ export class HtmlVideoPlayer {
dropAllAnimations: false,
libassMemoryLimit: 40,
libassGlyphLimit: 40,
targetFps: 24,
targetFps: videoStream?.ReferenceFrameRate || videoStream?.RealFrameRate || 24,
prescaleFactor: 0.8,
prescaleHeightLimit: 1080,
maxRenderHeight: 2160,
Expand Down
Loading