NorskOutput.fileTs() method
Stream to a Transport Stream file.
Signature:
fileTs(settings: FileTsOutputSettings): Promise<FileTsOutputNode>;
Parameters
Parameter | Type | Description |
---|---|---|
settings |
Configuration for the Transport Stream output |
Returns:
Promise<FileTsOutputNode>
Example [08_pid_normalization.ts]
Receive an RTMP stream and package it in a transport stream with explicit PID mappings
let input = await norsk.input.rtmpServer({ id: "rtmpInput", port: 5001 });
let videoPidNormalizer = await norsk.processor.transform.streamKeyOverride(videoStreamKeyConfig);
let audioPidNormalizer = await norsk.processor.transform.streamKeyOverride(audioStreamKeyConfig);
let output1 = await norsk.duplex.webRtcBrowser({ id: "webrtc" });
let output2 = await norsk.output.fileTs(tsFileOutputSettings);
videoPidNormalizer.subscribe([{ source: input, sourceSelector: selectVideo }]);
audioPidNormalizer.subscribe([{ source: input, sourceSelector: selectAudio }]);
let normalizedSources = [{ source: videoPidNormalizer, sourceSelector: selectVideo }, { source: audioPidNormalizer, sourceSelector: selectAudio }];
output1.subscribe(normalizedSources);
output2.subscribe(normalizedSources);
console.log(`Local player: ${output1.playerUrl}`);
Run the following command to generate example input at url rtmp://127.0.0.1:5001/norsk/high
:
ffmpeg -v error -re -f lavfi -i "sine=frequency=220:sample_rate=48000" -loop 1 -i data/test-src-still.png -vf drawtext=fontfile=Arial.ttf:text="%{frame_num}":start_number=1:x=980:y=330:fontcolor=black:fontsize=40:box=1:boxcolor=white:boxborderw=5,scale=1280:720 -vcodec h264 -b:v 150000 -b:a 20000 -aspect 1280:720 -x264opts "keyint=25:min-keyint=25:no-scenecut:bframes=0" -bluray-compat true -tune stillimage -preset fast -pix_fmt yuv420p -acodec aac -metadata language=en -f flv 'rtmp://127.0.0.1:5001/norsk/high'
Find Examples
Search for examples using fileTs in our examples repo.