From f624326eb45b54098a4d7d72687fcc07edd6ffc7 Mon Sep 17 00:00:00 2001 From: Chris Tam Date: Fri, 20 Aug 2021 17:48:14 -0400 Subject: [PATCH 1/2] Send vp8 and vp9 over vpx as transcode profiles --- CONTRIBUTORS.md | 1 + src/scripts/browserDeviceProfile.js | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9898aa9ab..f540f19cd 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -47,6 +47,7 @@ - [Stephane Senart](https://github.com/ssenart) - [Ömer Erdinç Yağmurlu](https://github.com/omeryagmurlu) - [Keegan Dahm](https://github.com/keegandahm) + - [GodTamIt](https://github.com/GodTamIt) # Emby Contributors diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index d40bee1fe..7260cec04 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -668,10 +668,11 @@ import browser from './browser'; } if (canPlayVp8) { + // TODO: Remove vpx entry once servers are migrated profile.TranscodingProfiles.push({ Container: 'webm', Type: 'Video', - AudioCodec: 'vorbis', + AudioCodec: webmAudioCodecs.includes('opus') ? 'opus' : 'vorbis', VideoCodec: 'vpx', Context: 'Streaming', Protocol: 'http', @@ -679,6 +680,31 @@ import browser from './browser'; // Trying to transcode to 5 channels when there are only 2 speakers generally does not sound good MaxAudioChannels: physicalAudioChannels.toString() }); + profile.TranscodingProfiles.push({ + Container: 'webm', + Type: 'Video', + AudioCodec: webmAudioCodecs.includes('opus') ? 'opus' : 'vorbis', + VideoCodec: 'vp8', + Context: 'Streaming', + Protocol: 'http', + // If audio transcoding is needed, limit channels to number of physical audio channels + // Trying to transcode to 5 channels when there are only 2 speakers generally does not sound good + MaxAudioChannels: physicalAudioChannels.toString() + }); + } + + if (canPlayVp9) { + profile.TranscodingProfiles.push({ + Container: 'webm', + Type: 'Video', + AudioCodec: webmAudioCodecs.includes('opus') ? 'opus' : 'vorbis', + VideoCodec: 'vp9', + Context: 'Streaming', + Protocol: 'http', + // If audio transcoding is needed, limit channels to number of physical audio channels + // Trying to transcode to 5 channels when there are only 2 speakers generally does not sound good + MaxAudioChannels: physicalAudioChannels.toString() + }); } profile.TranscodingProfiles.push({ From 78cf00971350546525e5f7124ea510b3f7aa8a70 Mon Sep 17 00:00:00 2001 From: Chris Tam Date: Tue, 24 Aug 2021 18:36:31 -0400 Subject: [PATCH 2/2] Include all WebM codecs in transcode profile (squash me on submit) --- src/scripts/browserDeviceProfile.js | 33 ++++------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index 7260cec04..cc6ef6333 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -667,38 +667,13 @@ import browser from './browser'; } } - if (canPlayVp8) { - // TODO: Remove vpx entry once servers are migrated + if (webmAudioCodecs.length && webmVideoCodecs.length) { profile.TranscodingProfiles.push({ Container: 'webm', Type: 'Video', - AudioCodec: webmAudioCodecs.includes('opus') ? 'opus' : 'vorbis', - VideoCodec: 'vpx', - Context: 'Streaming', - Protocol: 'http', - // If audio transcoding is needed, limit channels to number of physical audio channels - // Trying to transcode to 5 channels when there are only 2 speakers generally does not sound good - MaxAudioChannels: physicalAudioChannels.toString() - }); - profile.TranscodingProfiles.push({ - Container: 'webm', - Type: 'Video', - AudioCodec: webmAudioCodecs.includes('opus') ? 'opus' : 'vorbis', - VideoCodec: 'vp8', - Context: 'Streaming', - Protocol: 'http', - // If audio transcoding is needed, limit channels to number of physical audio channels - // Trying to transcode to 5 channels when there are only 2 speakers generally does not sound good - MaxAudioChannels: physicalAudioChannels.toString() - }); - } - - if (canPlayVp9) { - profile.TranscodingProfiles.push({ - Container: 'webm', - Type: 'Video', - AudioCodec: webmAudioCodecs.includes('opus') ? 'opus' : 'vorbis', - VideoCodec: 'vp9', + AudioCodec: webmAudioCodecs.join(','), + // TODO: Remove workaround when servers migrate away from 'vpx' for transcoding profiles. + VideoCodec: (canPlayVp8 ? webmVideoCodecs.concat('vpx') : webmVideoCodecs).join(','), Context: 'Streaming', Protocol: 'http', // If audio transcoding is needed, limit channels to number of physical audio channels