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

Prevent opus more than 2 channels being remuxed on Safari #6373

Open
wants to merge 2 commits into
base: release-10.10.z
Choose a base branch
from
Open
Changes from 1 commit
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
43 changes: 43 additions & 0 deletions src/scripts/browserDeviceProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,49 @@ export default function (options) {
profile.TranscodingProfiles.push(...flacTranscodingProfiles);
}

if (safariSupportsOpus) {
const opusConditions = [
// Safari doesn't support opus with more than 2 channels
{
Condition: 'LessThanEqual',
Property: 'AudioChannels',
Value: '2',
IsRequired: false
}
];

profile.CodecProfiles.push({
Type: 'VideoAudio',
Codec: 'opus',
Conditions: opusConditions
});

const opusTranscodingProfiles = [];

// Split each video transcoding profile with opus so that the containing opus is only applied to 2 channels audio
profile.TranscodingProfiles.forEach(transcodingProfile => {
if (transcodingProfile.Type !== 'Video') return;

const audioCodecs = transcodingProfile.AudioCodec.split(',');

if (!audioCodecs.includes('opus')) return;

const opusTranscodingProfile = { ...transcodingProfile };
opusTranscodingProfile.AudioCodec = 'opus';
opusTranscodingProfile.MaxAudioChannels = '2';
dmitrylyzo marked this conversation as resolved.
Show resolved Hide resolved
opusTranscodingProfile.ApplyConditions = [
...opusTranscodingProfile.ApplyConditions || [],
...opusConditions
];

opusTranscodingProfiles.push(opusTranscodingProfile);

transcodingProfile.AudioCodec = audioCodecs.filter(codec => codec != 'opus').join(',');
});

profile.TranscodingProfiles.push(...opusTranscodingProfiles);
}

let maxH264Level = 42;
let h264Profiles = 'high|main|baseline|constrained baseline';

Expand Down
Loading