Options
All
  • Public
  • Public/Protected
  • All
Menu

@eyevinn/autovmaf

Index

Type aliases

AWSPipelineConfiguration: { ecsCluster: string; ecsContainerName: string; ecsSecurityGroup: string; ecsSubnet: string; ecsTaskDefinition: string; inputBucket: string; mediaConvertEndpoint: string; mediaConvertRole: string; mediaConvertSettings: any; outputBucket: string }

Type declaration

  • ecsCluster: string
  • ecsContainerName: string
  • ecsSecurityGroup: string
  • ecsSubnet: string
  • ecsTaskDefinition: string
  • inputBucket: string
  • mediaConvertEndpoint: string
  • mediaConvertRole: string
  • mediaConvertSettings: any
  • outputBucket: string
BitrateRange: { max?: number; min?: number }

Type declaration

  • Optional max?: number
  • Optional min?: number
BitrateResolutionVMAF: { bitrate: number; resolution: Resolution; vmaf: number }

Type declaration

JobDescription: { bitrates?: number[]; encodingProfile: string | Record<string, string>; method?: "bruteForce" | "walkTheHull"; models?: ("HD" | "PhoneHD" | "UHD")[]; name: string; pipeline: string | LocalPipelineConfiguration; pipelineVariables?: {}; reference: string; resolutions?: Resolution[]; skipExisting?: boolean; skipTranscode?: boolean }

Describes a ABR-analysis job and can be used to create jobs using the createJob()-function.

Type declaration

  • Optional bitrates?: number[]

    A list of bitrates to test. By default a list of bitrates between 150 kbit/s to 9000 kbit/s.

  • encodingProfile: string | Record<string, string>

    Path to a JSON-file that defines how the reference should be encoded. When using AWS, this is a MediaConvert configuration. For local pipelines, this is key-value pairs that will be passed as command line arguments to FFmpeg. For inline pipeline definition, this should be key-value pairs See an example for AWS at examples/encoding-profile.json.

  • Optional method?: "bruteForce" | "walkTheHull"

    The method to use when analyzing the videos. Either bruteForce or walkTheHull. By default bruteForce. NOTE: walkTheHull is not implemented at the moment.

  • Optional models?: ("HD" | "PhoneHD" | "UHD")[]

    A list of VMAF-models to use in evaluation. This can be HD, MobileHD and UHD. HD by default.

  • name: string

    This will name the folder in which to put the files.

  • pipeline: string | LocalPipelineConfiguration

    Path to a YAML-file that defines the pipeline, or an inline local pipeline configuration. See examples/pipeline.yml for an example AWS-pipeline.

  • Optional pipelineVariables?: {}

    Values that will be substituted into the encoding options. Currently only supported for local pipeline

    • [key: string]: string[]
  • reference: string

    Path to the reference video to analyze. Normally a local path, but when using AWS, this can also be an S3-URI.

  • Optional resolutions?: Resolution[]

    A list of resolutions to test. By default it will test all resolutions in the example ABR-ladder provided by Apple in the HLS Authoring Spec.

  • Optional skipExisting?: boolean

    Skip transcode if outfile allready exists

  • Optional skipTranscode?: boolean

    Skip transcode and run analysis only, files are assumed to be allready present

LocalPipelineConfiguration: { easyVmafExtraArgs?: {}; easyVmafPath: string; ffmpegEncoder: "libx264" | "h264_videotoolbox"; ffmpegOptions: {}; ffmpegPath: string; pythonPath: string; singlePass?: boolean; skipDefaultOptions?: boolean }

Type declaration

  • Optional easyVmafExtraArgs?: {}
    • [key: string]: string
  • easyVmafPath: string
  • ffmpegEncoder: "libx264" | "h264_videotoolbox"
  • ffmpegOptions: {}
    • [key: string]: string
  • ffmpegPath: string
  • pythonPath: string
  • Optional singlePass?: boolean
  • Optional skipDefaultOptions?: boolean
Resolution: { height: number; range?: BitrateRange; width: number }

Type declaration

Variables

logger: Logger

Functions

  • createJob(description: JobDescription, pipelineData?: any, encodingProfileData?: any, concurrency?: boolean): Promise<void>
  • Creates a analysis job according to a job description.

    example

    Example of creating a job from a job description.

    const { createJob, qualityAnalysisModelToString } = require('@eyevinn/autovmaf');

    const abrLadder = await = createJob({
    name: "hello",
    pipeline: "pipeline.yml",
    encodingProfile: "profile.json",
    reference: "reference.mp4",
    models: ["HD", "PhoneHD"],
    resolutions: [{ width: 1280, height: 720, range: undefined }],
    bitrates: [600000],
    method: "bruteForce"
    });
    example

    Example of creating a job from a job description with range set.

    const { createJob, qualityAnalysisModelToString } = require('@eyevinn/autovmaf');

    const abrLadder = await = createJob({
    name: "hello",
    pipeline: "pipeline.yml",
    encodingProfile: "profile.json",
    reference: "reference.mp4",
    models: ["HD", "PhoneHD"],
    resolutions: [{ width: 1280, height: 720, range: { min: 400000, max: 600000} }],
    bitrates: [400000, 600000, 800000],
    method: "bruteForce"
    });
    example

    Example of creating a job from a YAML-file.

    const { createJob, JobDescription } = require('@eyevinn/autovmaf');
    const YAML = require('yaml');
    const fs = require('fs');

    const parseResolutions = resolutions => {
    resolutions.map(resolutionStr => ({
    width: parseInt(resolutionStr.split('x')[0]),
    height: parseInt(resolutionStr.split('x')[1]),
    }));
    };

    const jobFile = fs.readFileSync('job.yml', 'utf-8');
    const jobData = YAML.parse(jobFile);
    const job = {
    ...jobData,
    resolutions: jobData['resolutions'] !== undefined ? parseResolutions(jobData['resolutions']) : undefined,
    };

    createJob(job);

    Parameters

    • description: JobDescription

      An object that describes the job to create.

    • Optional pipelineData: any
    • Optional encodingProfileData: any
    • concurrency: boolean = true

    Returns Promise<void>

  • getVmaf(filename: string, onProgress?: (index: number, filename: string, total: number) => void): Promise<{ filename: string; vmaf: number }[]>
  • Returns the VMAF-values from a JSON-file or a directory of JSON-files. Can be used on both local paths as well as S3-URIs.

    example

    Example of retrieving a list of VMAF-scores from S3.

    const vmafFiles = await getVmaf('s3://path/to/vmaf/');
    vmafFiles.forEach(file => {
    console.log(file.filename + ': ' + file.vmaf);
    });

    Parameters

    • filename: string

      The path to the file or directory. Can be a local path or a S3-URI.

    • onProgress: (index: number, filename: string, total: number) => void = ...
        • (index: number, filename: string, total: number): void
        • Parameters

          • index: number
          • filename: string
          • total: number

          Returns void

    Returns Promise<{ filename: string; vmaf: number }[]>

    A list of objects with filename and VMAF-scores.

  • loadPipeline(pipelineFilename: string, encodingProfile?: string): Promise<Pipeline>
  • Loads a pipeline from a YAML file and an encoding profile from a JSON file.

    Parameters

    • pipelineFilename: string

      The local path to the pipeline YAML.

    • Optional encodingProfile: string

      The local path to the encoding profile JSON. If left undefined, the encoding profile will be set to an empty object.

    Returns Promise<Pipeline>

    A pipeline that can be used to transcode or analyze videos with.

  • loadPipelineFromObjects(pipelineData: any, encodingProfileData?: any): Promise<Pipeline>
  • Loads a pipeline and an encoding profile from a JSON object.

    Parameters

    • pipelineData: any

      The object containing the pipeline data.

    • Optional encodingProfileData: any

    Returns Promise<Pipeline>

    A pipeline that can be used to transcode or analyze videos with.

  • Converts from a string to a QualityAnalysisModel-enum.

    Parameters

    • model: "HD" | "PhoneHD" | "UHD"

      The string to convert. Can be either "HD", "PhoneHD", or "UHD".

    Returns QualityAnalysisModel

    A QualityAnalysisModel-enum depending on the input string.

  • suggestLadder(directoryWithVmafFiles: string, filterFunction?: (bitrate: number, resolution: Resolution, vmaf: number) => boolean, includeAllBitrates?: boolean, onProgress?: (index: number, filename: string, total: number) => void): Promise<LadderAndVmafPairs>
  • Suggests an optimal ABR-ladder from a directory of VMAF-files. Only supports loading from S3 at the moment.

    Parameters

    • directoryWithVmafFiles: string

      URI to the directory with VMAF-files.

    • filterFunction: (bitrate: number, resolution: Resolution, vmaf: number) => boolean = ...

      Optional function to filter values from the analysis.

        • (bitrate: number, resolution: Resolution, vmaf: number): boolean
        • Parameters

          Returns boolean

    • includeAllBitrates: boolean = false

      If true, return optimal resolutions for all bitrates.

    • onProgress: (index: number, filename: string, total: number) => void = ...
        • (index: number, filename: string, total: number): void
        • Parameters

          • index: number
          • filename: string
          • total: number

          Returns void

    Returns Promise<LadderAndVmafPairs>

    Returns the optimal ladder.

Generated using TypeDoc