Skip to content

Commit

Permalink
feat: hevc channel profile
Browse files Browse the repository at this point in the history
  • Loading branch information
birme committed Mar 8, 2023
1 parent 71bdb3b commit 6d9128d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions engine/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ export interface ChannelProfile {
bw: number;
codecs: string;
resolution: number[];
videoRange?: string;
frameRate?: number;
}

export interface Channel {
Expand Down
13 changes: 12 additions & 1 deletion engine/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,18 @@ class Session {
const audioCodec = profile.codecs.split(",")[1];
return id.match(audioCodec);
});
m3u8 += '#EXT-X-STREAM-INF:BANDWIDTH=' + profile.bw + ',RESOLUTION=' + profile.resolution[0] + 'x' + profile.resolution[1] + ',CODECS="' + profile.codecs + '"' + (audioGroupId ? `,AUDIO="${audioGroupId}"` : '') + (hasClosedCaptions ? ',CLOSED-CAPTIONS="cc"' : '') + '\n';
let videoRange = "SDR";
if (profile.videoRange) {
videoRange = profile.videoRange;
}

m3u8 += '#EXT-X-STREAM-INF:BANDWIDTH=' + profile.bw +
',RESOLUTION=' + profile.resolution[0] + 'x' + profile.resolution[1] +
',CODECS="' + profile.codecs + '"' +
',VIDEO-RANGE="' + videoRange + '"' +
(profile.frameRate ? `,FRAME-RATE=${profile.frameRate.toFixed(3)}` : '') +
(audioGroupId ? `,AUDIO="${audioGroupId}"` : '') +
(hasClosedCaptions ? ',CLOSED-CAPTIONS="cc"' : '') + '\n';
m3u8 += "master" + profile.bw + ".m3u8;session=" + this._sessionId + "\n";
});
} else {
Expand Down
3 changes: 2 additions & 1 deletion server-uhd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ class RefChannelManager implements IChannelManager {
_getProfile(): ChannelProfile[] {
return [
{ resolution: [1280, 720], bw: 3725519, codecs: "avc1.64001F,mp4a.40.2" },
{ resolution: [1280, 720], bw: 5903428, codecs: "avc1.64001F,ac-3" }
{ resolution: [1280, 720], bw: 5903428, codecs: "avc1.64001F,ac-3" },
{ resolution: [1280, 720], bw: 6676458, videoRange: "PQ", frameRate: 24.000, codecs: "hvc1.2.4.L93.90,mp4a.40.2" },
];
}

Expand Down

0 comments on commit 6d9128d

Please sign in to comment.