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

Add 'how many times' is the speed of transcoding in Playback Info #5753

Merged
merged 8 commits into from
Aug 15, 2024
12 changes: 11 additions & 1 deletion src/components/playerstats/playerstats.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function getTranscodingStats(session, player, displayPlayMethod) {
if (session.TranscodingInfo.Framerate) {
sessionStats.push({
label: globalize.translate('LabelTranscodingFramerate'),
value: session.TranscodingInfo.Framerate + ' fps'
value: getDisplayTranscodeFps(session, player)
});
}
if (session.TranscodingInfo.TranscodeReasons?.length) {
Expand Down Expand Up @@ -191,6 +191,16 @@ function getDisplayBitrate(bitrate) {
}
}

function getDisplayTranscodeFps(session, player) {
const mediaSource = playbackManager.currentMediaSource(player) ?? {};
const videoStream = (mediaSource.MediaStreams ?? []).find((s) => s.Type === 'Video') ?? {};

const originalFramerate = videoStream.AverageFrameRate;
const transcodeFramerate = session.TranscodingInfo.Framerate;

return `${(transcodeFramerate / originalFramerate).toFixed(2)}x (${session.TranscodingInfo.Framerate} fps)`;
}

function getReadableSize(size) {
if (size >= 1073741824) {
return parseFloat((size / 1073741824).toFixed(1)) + ' GiB';
Expand Down
Loading