NorskTransform.streamKeyOverride() method
Provide a new stream key for a single stream. Cannot be subscribed to multiple streams at once.
The stream key is used for identifying streams within multiplexed sources and also is translated into URIs for HLS playlists and other resources.
This can be useful if changing sources and wanting to maintain a consistent streamkey going into an output
Signature:
streamKeyOverride(settings: StreamKeyOverrideSettings): Promise<StreamKeyOverrideNode>;
Parameters
Parameter | Type | Description |
---|---|---|
settings |
New stream key plus general node settings. |
Returns:
Promise<StreamKeyOverrideNode>
Example [08_pid_normalization.ts]
Receive an RTMP stream and package it in a transport stream with explicit PID mappings
export async function main() {
const norsk = await Norsk.connect();
const input = await norsk.input.rtmpServer({ id: "rtmpInput" });
const videoPidNormalizer = await norsk.processor.transform.streamKeyOverride(videoStreamKeyConfig);
const audioPidNormalizer = await norsk.processor.transform.streamKeyOverride(audioStreamKeyConfig);
const output1 = await norsk.output.whep({ id: "webrtc", ...webRtcServerConfig });
const output2 = await norsk.output.fileTs(tsFileOutputSettings);
videoPidNormalizer.subscribe([{ source: input, sourceSelector: selectVideo }]);
audioPidNormalizer.subscribe([{ source: input, sourceSelector: selectAudio }]);
const normalizedSources = [{ source: videoPidNormalizer, sourceSelector: selectVideo }, { source: audioPidNormalizer, sourceSelector: selectAudio }];
output1.subscribe(normalizedSources);
output2.subscribe(normalizedSources);
console.log(`WebRTC Player URL: ${output1.playerUrl}`);
}
const videoStreamKeyConfig: StreamKeyOverrideSettings = {
id: "video_stream_key",
streamKey: {
programNumber: 1,
renditionName: "video",
streamId: 256,
sourceName: "input",
},
};
const audioStreamKeyConfig: StreamKeyOverrideSettings = {
id: "audio_stream_key",
streamKey: {
programNumber: 1,
renditionName: "audio",
streamId: 258,
sourceName: "input",
},
};
const tsFileOutputSettings: FileTsOutputSettings = {
id: "localTsOutput",
fileName: "/mnt/output/normalized.ts",
};
Run the following command to generate example input at url rtmp://127.0.0.1:1935/norsk/high
:
ffmpeg -v error -re -stream_loop -1 -i data/InkDrop.ts -vcodec copy -codec copy -f flv 'rtmp://127.0.0.1:1935/norsk/high'
Find Examples
Search for examples using streamKeyOverride in our examples repo.