Skip to content

anttiai/ivs-asc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automatic Stream Configuration for AWS IVS.

Use createClientConfiguration to generate a ClientConfiguration object by combining the user's hardware and software setup analysis with the desired streaming options. Use fetchStreamConfiguration to query the AWS IVS REST API for the optimal streaming configuration.

Automatic stream configuration helps users get started quickly and automatically improves the quality of streams over time. Instead of users manually choosing settings (e.g., bitrate, resolution, framerate) that are set once and rarely tweaked, automatic stream configuration considers current software settings, hardware configuration, and platform support every time the user starts a new stream. For example, when a user upgrades the setup (e.g., with a new GPU), installs a new GPU driver, or the destination starts to support a new codec (e.g., H.265/HEVC), automatic stream configuration reacts and improves the quality of the user's next stream.

AWS documentation at docs.aws.amazon.com.

Supported GPUs

  • Nvidia: Requires nvidia-smi
  • Apple silicon: No additional software required
  • AMD: PRs welcome for device_id and vendor_id heuristics

Installation

npm install ivs-asc

Usage

Create and print out the client configuration

import { createClientConfiguration, FetchOptions } from 'ivs-asc';

const options: FetchOptions = {
    authKey: 'authkey',
    video: {},
    canvases: [
        {
            canvas_height: 1080,
            canvas_width: 1920,
            framerate: {
                denominator: 1,
                numerator: 60
            },
            height: 1080,
            width: 1920
        }
    ]
}
createClientConfiguration(options).then(console.log);

Fetch optimal streaming configuration from IVS

import { createClientConfiguration, fetchStreamConfiguration, FetchOptions, IVSResponse } from 'ivs-asc';

async function automaticStreamConfiguration() {
    const options: FetchOptions = {
        authKey: 'authkey',
        video: {
            maxBitrateKbps: 4000,
            maxTracks: 3,
            supportedCodecs: ["h264", "h265", "av1"]
        },
        canvases: [
            {
                canvas_height: 1080,
                canvas_width: 1920,
                framerate: {
                    denominator: 1,
                    numerator: 60
                },
                height: 1080,
                width: 1920
            }
        ]
    }

    const clientConfiguration = await createClientConfiguration(options);
    const response: IVSResponse = await fetchStreamConfiguration(clientConfiguration);
    if (response.status?.result === 'error') {
        console.log(response.status.html_en_us);
    }
    else {
        console.log(response);
    }
}
automaticStreamConfiguration();

Special thanks to Streamrun, a cloud-based streaming server that offers features beyond what can be run on a single streaming device.

About

Automatic Stream Configuration for AWS IVS

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •