Skip to content

vvideo/decoding-info

Repository files navigation

Decoding Info

NPM version NPM Downloads install size

This npm package allows you to determine the resolution of a supported video codec using the MediaCapabilities API.

Finding video codec resolution:

  • Minimum and maximum resolutions for a video codec.
  • Minimum and maximum resolutions for a video codec with smooth playback.
  • Minimum and maximum resolutions for a video codec in power-efficiency mode (similar to hardware acceleration).

Installation

npm install --save-dev decoding-info

Usage

import { getVideoCodecSupportedResolution } from 'decoding-info';

const configuration = {
    video: {
        codec: 'video/mp4; codecs="hvc1.1.6.L123.B0"',
        framerate: 25,
        bitrate: 1000000,
    },
};

getVideoCodecSupportedResolution(configuration).then((result) => {
    console.log(result);
    // {
    //     "error": null,
    //     "supported": {
    //         "value": true,
    //         "minHeight": 16,
    //         "minWidth": 16,
    //         "maxWidth": 8192,
    //         "maxHeight": 8192
    //     },
    //     "smooth": {
    //         "value": true,
    //         "minHeight": 16,
    //         "minWidth": 16,
    //         "maxWidth": 8192,
    //         "maxHeight": 8192
    //     },
    //     "powerEfficient": {
    //         "value": true,
    //         "minHeight": 16,
    //         "minWidth": 16,
    //         "maxWidth": 8192,
    //         "maxHeight": 8192
    //     }
    // }
});

Links

MIT