NorskInput.fileImage() method

Read an image from a file. Various image formats are supported, see the documentation for FileImageInputSettings for more details.

Signature:

fileImage(settings: FileImageInputSettings): Promise<FileImageInputNode>;

Parameters

Parameter Type Description

settings

FileImageInputSettings

Configuration for the file input

The image will then be provided into Norsk as a video at 25fps for use in other operations

Returns:

Example [15_compose.ts]

Compose multiple sources into a single output and vary how they are arranged

const fileName = await fs.realpath("./data/Norsk.png");
const fileSettings: LocalFileInputSettings = {
  fileName,
  sourceName: "logoInput",
  id: "logoInput"
};

const norsk = await Norsk.connect();
let input1 = await norsk.input.srt(srtSettings);
let input2 = await norsk.input.rtmpServer(rtmpSettings);
let input3 = await norsk.input.fileImage(fileSettings);

Run the following commands together to generate example inputs at urls srt://127.0.0.1:5001, rtmp://127.0.0.1:5002/acme/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 mpegts -flush_packets 0 'srt://127.0.0.1:5001'
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:5002/acme/high'

Find Examples