2590 lines
91 KiB
JavaScript
2590 lines
91 KiB
JavaScript
var __bare_os_bundle_exports__ = (() => {
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
}) : x)(function(x) {
|
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
});
|
|
var __commonJS = (cb, mod) => function __require2() {
|
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
};
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
|
|
// ../../node_modules/bare-ffmpeg/binding.js
|
|
var require_binding = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/binding.js"(exports, module) {
|
|
module.exports = __require.addon();
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/errors.js
|
|
var require_errors = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/errors.js"(exports, module) {
|
|
module.exports = class FFmpegError extends Error {
|
|
constructor(msg, code, fn = FFmpegError) {
|
|
super(`${code}: ${msg}`);
|
|
this.code = code;
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, fn);
|
|
}
|
|
}
|
|
get name() {
|
|
return "FFmpegError";
|
|
}
|
|
static UNKNOWN_PIXEL_FORMAT(msg) {
|
|
return new FFmpegError(msg, "UNKNOWN_PIXEL_FORMAT", FFmpegError.UNKNOWN_PIXEL_FORMAT);
|
|
}
|
|
static UNKNOWN_SAMPLE_FORMAT(msg) {
|
|
return new FFmpegError(msg, "UNKNOWN_SAMPLE_FORMAT", FFmpegError.UNKNOWN_SAMPLE_FORMAT);
|
|
}
|
|
static UNKNOWN_CHANNEL_LAYOUT(msg) {
|
|
return new FFmpegError(msg, "UNKNOWN_CHANNEL_LAYOUT", FFmpegError.UNKNOWN_CHANNEL_LAYOUT);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/constants.js
|
|
var require_constants = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/constants.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var errors = require_errors();
|
|
function makeTag(a, b, c, d) {
|
|
return a.charCodeAt(0) | b.charCodeAt(0) << 8 | c.charCodeAt(0) << 16 | d.charCodeAt(0) << 24;
|
|
}
|
|
module.exports = exports = {
|
|
codecs: {
|
|
MJPEG: binding.AV_CODEC_ID_MJPEG,
|
|
H264: binding.AV_CODEC_ID_H264,
|
|
AVC: binding.AV_CODEC_ID_H264,
|
|
// Alias for H264
|
|
AAC: binding.AV_CODEC_ID_AAC,
|
|
OPUS: binding.AV_CODEC_ID_OPUS,
|
|
AV1: binding.AV_CODEC_ID_AV1,
|
|
FLAC: binding.AV_CODEC_ID_FLAC,
|
|
MP3: binding.AV_CODEC_ID_MP3,
|
|
H265: binding.AV_CODEC_ID_HEVC,
|
|
HEVC: binding.AV_CODEC_ID_HEVC,
|
|
VP8: binding.AV_CODEC_ID_VP8,
|
|
VP9: binding.AV_CODEC_ID_VP9,
|
|
VORBIS: binding.AV_CODEC_ID_VORBIS,
|
|
PCM_S16LE: binding.AV_CODEC_ID_PCM_S16LE,
|
|
PCM_S16BE: binding.AV_CODEC_ID_PCM_S16BE,
|
|
PCM_U8: binding.AV_CODEC_ID_PCM_U8,
|
|
PCM_ALAW: binding.AV_CODEC_ID_PCM_ALAW,
|
|
PCM_MULAW: binding.AV_CODEC_ID_PCM_MULAW
|
|
},
|
|
tags: {
|
|
MJPEG: makeTag("M", "J", "P", "G"),
|
|
AV1: makeTag("A", "V", "0", "1"),
|
|
H264: makeTag("H", "2", "6", "4"),
|
|
AAC: 255,
|
|
FLAC: 61868,
|
|
MP3: 85
|
|
},
|
|
profiles: {
|
|
H264_MAIN: binding.AV_PROFILE_H264_MAIN
|
|
},
|
|
levels: {
|
|
UNKNOWN: binding.AV_LEVEL_UNKNOWN
|
|
},
|
|
pixelFormats: {
|
|
NONE: binding.AV_PIX_FMT_NONE,
|
|
RGBA: binding.AV_PIX_FMT_RGBA,
|
|
RGB24: binding.AV_PIX_FMT_RGB24,
|
|
YUVJ420P: binding.AV_PIX_FMT_YUVJ420P,
|
|
UYVY422: binding.AV_PIX_FMT_UYVY422,
|
|
YUV420P: binding.AV_PIX_FMT_YUV420P,
|
|
NV12: binding.AV_PIX_FMT_NV12,
|
|
NV21: binding.AV_PIX_FMT_NV21,
|
|
NV24: binding.AV_PIX_FMT_NV24,
|
|
VIDEOTOOLBOX: binding.AV_PIX_FMT_VIDEOTOOLBOX
|
|
},
|
|
mediaTypes: {
|
|
UNKNOWN: binding.AVMEDIA_TYPE_UNKNOWN,
|
|
VIDEO: binding.AVMEDIA_TYPE_VIDEO,
|
|
AUDIO: binding.AVMEDIA_TYPE_AUDIO,
|
|
DATA: binding.AVMEDIA_TYPE_DATA,
|
|
SUBTITLE: binding.AVMEDIA_TYPE_SUBTITLE,
|
|
ATTACHEMENT: binding.AVMEDIA_TYPE_ATTACHMENT,
|
|
NB: binding.AVMEDIA_TYPE_NB
|
|
},
|
|
sampleFormats: {
|
|
NONE: binding.AV_SAMPLE_FMT_NONE,
|
|
U8: binding.AV_SAMPLE_FMT_U8,
|
|
S16: binding.AV_SAMPLE_FMT_S16,
|
|
S32: binding.AV_SAMPLE_FMT_S32,
|
|
S64: binding.AV_SAMPLE_FMT_S64,
|
|
FLT: binding.AV_SAMPLE_FMT_FLT,
|
|
DBL: binding.AV_SAMPLE_FMT_DBL,
|
|
U8P: binding.AV_SAMPLE_FMT_U8P,
|
|
S16P: binding.AV_SAMPLE_FMT_S16P,
|
|
S32P: binding.AV_SAMPLE_FMT_S32P,
|
|
S64P: binding.AV_SAMPLE_FMT_S64P,
|
|
FLTP: binding.AV_SAMPLE_FMT_FLTP,
|
|
DBLP: binding.AV_SAMPLE_FMT_DBLP,
|
|
NB: binding.AV_SAMPLE_FMT_NB
|
|
},
|
|
channelLayouts: {
|
|
MONO: binding.AV_CH_LAYOUT_MONO,
|
|
STEREO: binding.AV_CH_LAYOUT_STEREO,
|
|
QUAD: binding.AV_CH_LAYOUT_QUAD,
|
|
SURROUND: binding.AV_CH_LAYOUT_SURROUND,
|
|
21: binding.AV_CH_LAYOUT_2POINT1,
|
|
50: binding.AV_CH_LAYOUT_5POINT0,
|
|
51: binding.AV_CH_LAYOUT_5POINT1,
|
|
71: binding.AV_CH_LAYOUT_7POINT1,
|
|
// Aliases
|
|
2.1: binding.AV_CH_LAYOUT_2POINT1,
|
|
"5.0": binding.AV_CH_LAYOUT_5POINT0,
|
|
5.1: binding.AV_CH_LAYOUT_5POINT1,
|
|
7.1: binding.AV_CH_LAYOUT_7POINT1
|
|
},
|
|
pictureTypes: {
|
|
NONE: binding.AV_PICTURE_TYPE_NONE,
|
|
I: binding.AV_PICTURE_TYPE_I,
|
|
P: binding.AV_PICTURE_TYPE_P,
|
|
B: binding.AV_PICTURE_TYPE_B,
|
|
S: binding.AV_PICTURE_TYPE_S,
|
|
SI: binding.AV_PICTURE_TYPE_SI,
|
|
SP: binding.AV_PICTURE_TYPE_SP,
|
|
BI: binding.AV_PICTURE_TYPE_BI
|
|
},
|
|
logLevels: {
|
|
QUIET: binding.AV_LOG_QUIET,
|
|
PANIC: binding.AV_LOG_PANIC,
|
|
FATAL: binding.AV_LOG_FATAL,
|
|
ERROR: binding.AV_LOG_ERROR,
|
|
WARNING: binding.AV_LOG_WARNING,
|
|
INFO: binding.AV_LOG_INFO,
|
|
VERBOSE: binding.AV_LOG_VERBOSE,
|
|
DEBUG: binding.AV_LOG_DEBUG,
|
|
TRACE: binding.AV_LOG_TRACE
|
|
},
|
|
codecFlags: {
|
|
COPY_OPAQUE: binding.AV_CODEC_FLAG_COPY_OPAQUE,
|
|
FRAME_DURATION: binding.AV_CODEC_FLAG_FRAME_DURATION,
|
|
PASS1: binding.AV_CODEC_FLAG_PASS1,
|
|
PASS2: binding.AV_CODEC_FLAG_PASS2,
|
|
LOOP_FILTER: binding.AV_CODEC_FLAG_LOOP_FILTER,
|
|
GRAY: binding.AV_CODEC_FLAG_GRAY,
|
|
PSNR: binding.AV_CODEC_FLAG_PSNR,
|
|
INTERLACED_DCT: binding.AV_CODEC_FLAG_INTERLACED_DCT,
|
|
LOW_DELAY: binding.AV_CODEC_FLAG_LOW_DELAY,
|
|
GLOBAL_HEADER: binding.AV_CODEC_FLAG_GLOBAL_HEADER,
|
|
BITEXACT: binding.AV_CODEC_FLAG_BITEXACT,
|
|
AC_PRED: binding.AV_CODEC_FLAG_AC_PRED,
|
|
INTERLACED_ME: binding.AV_CODEC_FLAG_INTERLACED_ME,
|
|
CLOSED_GOP: binding.AV_CODEC_FLAG_CLOSED_GOP
|
|
},
|
|
formatFlags: {
|
|
SHOW_IDS: binding.AVFMT_SHOW_IDS,
|
|
GENERIC_INDEX: binding.AVFMT_GENERIC_INDEX,
|
|
TS_DISCONT: binding.AVFMT_TS_DISCONT,
|
|
NOBINSEARCH: binding.AVFMT_NOBINSEARCH,
|
|
NOGENSEARCH: binding.AVFMT_NOGENSEARCH,
|
|
NO_BYTE_SEEK: binding.AVFMT_NO_BYTE_SEEK,
|
|
SEEK_TO_PTS: binding.AVFMT_SEEK_TO_PTS,
|
|
GLOBALHEADER: binding.AVFMT_GLOBALHEADER,
|
|
VARIABLE_FPS: binding.AVFMT_VARIABLE_FPS,
|
|
NODIMENSIONS: binding.AVFMT_NODIMENSIONS,
|
|
NOSTREAMS: binding.AVFMT_NOSTREAMS,
|
|
TS_NONSTRICT: binding.AVFMT_TS_NONSTRICT,
|
|
TS_NEGATIVE: binding.AVFMT_TS_NEGATIVE,
|
|
NOFILE: binding.AVFMT_NOFILE,
|
|
NEEDNUMBER: binding.AVFMT_NEEDNUMBER,
|
|
NOTIMESTAMPS: binding.AVFMT_NOTIMESTAMPS
|
|
},
|
|
seek: {
|
|
SIZE: binding.AVSEEK_SIZE,
|
|
FORCE: binding.AVSEEK_FORCE,
|
|
CUR: binding.SEEK_CUR,
|
|
SET: binding.SEEK_SET,
|
|
END: binding.SEEK_END
|
|
},
|
|
packetSideDataType: {
|
|
PALETTE: binding.AV_PKT_DATA_PALETTE,
|
|
NEW_EXTRADATA: binding.AV_PKT_DATA_NEW_EXTRADATA,
|
|
PARAM_CHANGE: binding.AV_PKT_DATA_PARAM_CHANGE,
|
|
H263_MB_INFO: binding.AV_PKT_DATA_H263_MB_INFO,
|
|
REPLAYGAIN: binding.AV_PKT_DATA_REPLAYGAIN,
|
|
DISPLAYMATRIX: binding.AV_PKT_DATA_DISPLAYMATRIX,
|
|
STEREO3D: binding.AV_PKT_DATA_STEREO3D,
|
|
AUDIO_SERVICE_TYPE: binding.AV_PKT_DATA_AUDIO_SERVICE_TYPE,
|
|
QUALITY_STATS: binding.AV_PKT_DATA_QUALITY_STATS,
|
|
FALLBACK_TRACK: binding.AV_PKT_DATA_FALLBACK_TRACK,
|
|
CPB_PROPERTIES: binding.AV_PKT_DATA_CPB_PROPERTIES,
|
|
SKIP_SAMPLES: binding.AV_PKT_DATA_SKIP_SAMPLES,
|
|
JP_DUALMONO: binding.AV_PKT_DATA_JP_DUALMONO,
|
|
STRINGS_METADATA: binding.AV_PKT_DATA_STRINGS_METADATA,
|
|
SUBTITLE_POSITION: binding.AV_PKT_DATA_SUBTITLE_POSITION,
|
|
MATROSKA_BLOCKADDITIONAL: binding.AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
|
|
WEBVTT_IDENTIFIER: binding.AV_PKT_DATA_WEBVTT_IDENTIFIER,
|
|
WEBVTT_SETTINGS: binding.AV_PKT_DATA_WEBVTT_SETTINGS,
|
|
METADATA_UPDATE: binding.AV_PKT_DATA_METADATA_UPDATE,
|
|
MPEGTS_STREAM_ID: binding.AV_PKT_DATA_MPEGTS_STREAM_ID,
|
|
MASTERING_DISPLAY_METADATA: binding.AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
|
|
SPHERICAL: binding.AV_PKT_DATA_SPHERICAL,
|
|
CONTENT_LIGHT_LEVEL: binding.AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
|
|
A53_CC: binding.AV_PKT_DATA_A53_CC,
|
|
ENCRYPTION_INIT_INFO: binding.AV_PKT_DATA_ENCRYPTION_INIT_INFO,
|
|
ENCRYPTION_INFO: binding.AV_PKT_DATA_ENCRYPTION_INFO,
|
|
AFD: binding.AV_PKT_DATA_AFD,
|
|
PRFT: binding.AV_PKT_DATA_PRFT,
|
|
ICC_PROFILE: binding.AV_PKT_DATA_ICC_PROFILE,
|
|
DOVI_CONF: binding.AV_PKT_DATA_DOVI_CONF,
|
|
S12M_TIMECODE: binding.AV_PKT_DATA_S12M_TIMECODE,
|
|
DYNAMIC_HDR10_PLUS: binding.AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
|
|
IAMF_MIX_GAIN_PARAM: binding.AV_PKT_DATA_IAMF_MIX_GAIN_PARAM,
|
|
IAMF_DEMIXING_INFO_PARAM: binding.AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM,
|
|
IAMF_RECON_GAIN_INFO_PARAM: binding.AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM,
|
|
AMBIENT_VIEWING_ENVIRONMENT: binding.AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT,
|
|
FRAME_CROPPING: binding.AV_PKT_DATA_FRAME_CROPPING,
|
|
LCEVC: binding.AV_PKT_DATA_LCEVC,
|
|
"3D_REFERENCE_DISPLAYS": binding.AV_PKT_DATA_3D_REFERENCE_DISPLAYS,
|
|
RTCP_SR: binding.AV_PKT_DATA_RTCP_SR,
|
|
NB: binding.AV_PKT_DATA_NB
|
|
},
|
|
codecConfig: {
|
|
PIX_FORMAT: binding.AV_CODEC_CONFIG_PIX_FORMAT,
|
|
FRAME_RATE: binding.AV_CODEC_CONFIG_FRAME_RATE,
|
|
SAMPLE_RATE: binding.AV_CODEC_CONFIG_SAMPLE_RATE,
|
|
SAMPLE_FORMAT: binding.AV_CODEC_CONFIG_SAMPLE_FORMAT,
|
|
CHANNEL_LAYOUT: binding.AV_CODEC_CONFIG_CHANNEL_LAYOUT,
|
|
COLOR_RANGE: binding.AV_CODEC_CONFIG_COLOR_RANGE,
|
|
COLOR_SPACE: binding.AV_CODEC_CONFIG_COLOR_SPACE
|
|
},
|
|
rounding: {
|
|
AV_ROUND_ZERO: binding.AV_ROUND_ZERO,
|
|
AV_ROUND_INF: binding.AV_ROUND_INF,
|
|
AV_ROUND_DOWN: binding.AV_ROUND_DOWN,
|
|
AV_ROUND_UP: binding.AV_ROUND_UP,
|
|
AV_ROUND_NEAR_INF: binding.AV_ROUND_NEAR_INF,
|
|
AV_ROUND_PASS_MINMAX: binding.AV_ROUND_PASS_MINMAX
|
|
},
|
|
optionFlags: {
|
|
SEARCH_CHILDREN: binding.AV_OPT_SEARCH_CHILDREN,
|
|
SEARCH_FAKE_OBJ: binding.AV_OPT_SEARCH_FAKE_OBJ,
|
|
ALLOW_NULL: binding.AV_OPT_ALLOW_NULL,
|
|
ARRAY_REPLACE: binding.AV_OPT_ARRAY_REPLACE,
|
|
MULTI_COMPONENT_RANGE: binding.AV_OPT_MULTI_COMPONENT_RANGE
|
|
},
|
|
hwDeviceTypes: {
|
|
VIDEOTOOLBOX: binding.AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
|
|
CUDA: binding.AV_HWDEVICE_TYPE_CUDA,
|
|
VAAPI: binding.AV_HWDEVICE_TYPE_VAAPI,
|
|
DXVA2: binding.AV_HWDEVICE_TYPE_DXVA2,
|
|
QSV: binding.AV_HWDEVICE_TYPE_QSV,
|
|
D3D11VA: binding.AV_HWDEVICE_TYPE_D3D11VA
|
|
},
|
|
hwFrameMapFlags: {
|
|
NONE: 0,
|
|
READ: binding.AV_HWFRAME_MAP_READ,
|
|
WRITE: binding.AV_HWFRAME_MAP_WRITE,
|
|
OVERWRITE: binding.AV_HWFRAME_MAP_OVERWRITE,
|
|
DIRECT: binding.AV_HWFRAME_MAP_DIRECT
|
|
},
|
|
colorSpace: {
|
|
RGB: binding.AVCOL_SPC_RGB,
|
|
BT709: binding.AVCOL_SPC_BT709,
|
|
UNSPECIFIED: binding.AVCOL_SPC_UNSPECIFIED,
|
|
RESERVED: binding.AVCOL_SPC_RESERVED,
|
|
FCC: binding.AVCOL_SPC_FCC,
|
|
BT470BG: binding.AVCOL_SPC_BT470BG,
|
|
SMPTE170M: binding.AVCOL_SPC_SMPTE170M,
|
|
SMPTE240M: binding.AVCOL_SPC_SMPTE240M,
|
|
YCGCO: binding.AVCOL_SPC_YCGCO,
|
|
YCOCG: binding.AVCOL_SPC_YCOCG,
|
|
BT2020_NCL: binding.AVCOL_SPC_BT2020_NCL,
|
|
BT2020_CL: binding.AVCOL_SPC_BT2020_CL,
|
|
SMPTE2085: binding.AVCOL_SPC_SMPTE2085,
|
|
CHROMA_DERIVED_NCL: binding.AVCOL_SPC_CHROMA_DERIVED_NCL,
|
|
CHROMA_DERIVED_CL: binding.AVCOL_SPC_CHROMA_DERIVED_CL,
|
|
ICTCP: binding.AVCOL_SPC_ICTCP,
|
|
IPT_C2: binding.AVCOL_SPC_IPT_C2,
|
|
YCGCO_RE: binding.AVCOL_SPC_YCGCO_RE,
|
|
YCGCO_RO: binding.AVCOL_SPC_YCGCO_RO
|
|
},
|
|
colorRange: {
|
|
UNSPECIFIED: binding.AVCOL_RANGE_UNSPECIFIED,
|
|
MPEG: binding.AVCOL_RANGE_MPEG,
|
|
JPEG: binding.AVCOL_RANGE_JPEG
|
|
},
|
|
colorPrimaries: {
|
|
BT709: binding.AVCOL_PRI_BT709,
|
|
UNSPECIFIED: binding.AVCOL_PRI_UNSPECIFIED,
|
|
RESERVED: binding.AVCOL_PRI_RESERVED,
|
|
BT470M: binding.AVCOL_PRI_BT470M,
|
|
BT470BG: binding.AVCOL_PRI_BT470BG,
|
|
SMPTE170M: binding.AVCOL_PRI_SMPTE170M,
|
|
SMPTE240M: binding.AVCOL_PRI_SMPTE240M,
|
|
FILM: binding.AVCOL_PRI_FILM,
|
|
BT2020: binding.AVCOL_PRI_BT2020,
|
|
SMPTE428: binding.AVCOL_PRI_SMPTE428,
|
|
SMPTEST428_1: binding.AVCOL_PRI_SMPTEST428_1,
|
|
SMPTE431: binding.AVCOL_PRI_SMPTE431,
|
|
SMPTE432: binding.AVCOL_PRI_SMPTE432,
|
|
EBU3213: binding.AVCOL_PRI_EBU3213,
|
|
JEDEC_P22: binding.AVCOL_PRI_JEDEC_P22
|
|
},
|
|
colorTRC: {
|
|
BT709: binding.AVCOL_TRC_BT709,
|
|
UNSPECIFIED: binding.AVCOL_TRC_UNSPECIFIED,
|
|
RESERVED: binding.AVCOL_TRC_RESERVED,
|
|
GAMMA22: binding.AVCOL_TRC_GAMMA22,
|
|
GAMMA28: binding.AVCOL_TRC_GAMMA28,
|
|
SMPTE170M: binding.AVCOL_TRC_SMPTE170M,
|
|
SMPTE240M: binding.AVCOL_TRC_SMPTE240M,
|
|
LINEAR: binding.AVCOL_TRC_LINEAR,
|
|
LOG: binding.AVCOL_TRC_LOG,
|
|
LOG_SQRT: binding.AVCOL_TRC_LOG_SQRT,
|
|
IEC61966_2_4: binding.AVCOL_TRC_IEC61966_2_4,
|
|
BT1361_ECG: binding.AVCOL_TRC_BT1361_ECG,
|
|
IEC61966_2_1: binding.AVCOL_TRC_IEC61966_2_1,
|
|
BT2020_10: binding.AVCOL_TRC_BT2020_10,
|
|
BT2020_12: binding.AVCOL_TRC_BT2020_12,
|
|
SMPTE2084: binding.AVCOL_TRC_SMPTE2084,
|
|
SMPTEST2084: binding.AVCOL_TRC_SMPTEST2084,
|
|
SMPTE428: binding.AVCOL_TRC_SMPTE428,
|
|
SMPTEST428_1: binding.AVCOL_TRC_SMPTEST428_1,
|
|
ARIB_STD_B67: binding.AVCOL_TRC_ARIB_STD_B67
|
|
}
|
|
};
|
|
exports.toPixelFormat = function toPixelFormat(format) {
|
|
if (typeof format === "number") return format;
|
|
if (typeof format === "string") {
|
|
if (format in exports.pixelFormats === false) {
|
|
throw errors.UNKNOWN_PIXEL_FORMAT(`Unknown pixel format '${format}'`);
|
|
}
|
|
return exports.pixelFormats[format];
|
|
}
|
|
throw new TypeError(
|
|
`Pixel format must be a number or string. Received ${typeof format} (${format})`
|
|
);
|
|
};
|
|
exports.toSampleFormat = function toSampleFormat(format) {
|
|
if (typeof format === "number") return format;
|
|
if (typeof format === "string") {
|
|
if (format in exports.sampleFormats === false) {
|
|
throw errors.UNKNOWN_SAMPLE_FORMAT(`Unknown sample format '${format}'`);
|
|
}
|
|
return exports.sampleFormats[format];
|
|
}
|
|
throw new TypeError(
|
|
`Sample format must be a number or string. Received ${typeof format} (${format})`
|
|
);
|
|
};
|
|
exports.toChannelLayout = function toChannelLayout(layout) {
|
|
if (typeof layout === "number") return layout;
|
|
if (typeof layout === "string") {
|
|
if (layout in exports.channelLayouts === false) {
|
|
throw errors.UNKNOWN_CHANNEL_LAYOUT(`Unknown channel layout '${layout}'`);
|
|
}
|
|
return exports.channelLayouts[layout];
|
|
}
|
|
throw new TypeError(
|
|
`Channel layout must be a number or string. Received ${typeof layout} (${layout})`
|
|
);
|
|
};
|
|
exports.getSampleFormatName = function(sampleFormat) {
|
|
return binding.getSampleFormatNameByID(sampleFormat);
|
|
};
|
|
exports.getPixelFormatName = function(pixelFormat) {
|
|
return binding.getPixelFormatNameByID(pixelFormat);
|
|
};
|
|
exports.getColorSpaceName = function(colorSpace) {
|
|
return binding.getColorSpaceNameByID(colorSpace);
|
|
};
|
|
exports.toColorSpace = function(name) {
|
|
return binding.getColorSpaceFromName(name);
|
|
};
|
|
exports.getColorPrimariesName = function(colorPrimaries) {
|
|
return binding.getColorPrimariesNameByID(colorPrimaries);
|
|
};
|
|
exports.toColorPrimaries = function(name) {
|
|
return binding.getColorPrimariesFromName(name);
|
|
};
|
|
exports.getColorTransferName = function(colorTransfer) {
|
|
return binding.getColorTransferNameByID(colorTransfer);
|
|
};
|
|
exports.toColorTransfer = function(name) {
|
|
return binding.getColorTransferFromName(name);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/audio-fifo.js
|
|
var require_audio_fifo = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/audio-fifo.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var constants = require_constants();
|
|
module.exports = class FFmpegAudioFIFO {
|
|
constructor(sampleFormat, channels, nbSamples) {
|
|
sampleFormat = constants.toSampleFormat(sampleFormat);
|
|
this._handle = binding.initAudioFifo(sampleFormat, channels, nbSamples);
|
|
}
|
|
destroy() {
|
|
binding.destroyAudioFifo(this._handle);
|
|
this._handle = null;
|
|
}
|
|
write(frame) {
|
|
return binding.writeAudioFifo(this._handle, frame._handle);
|
|
}
|
|
read(frame, nbSamples) {
|
|
return binding.readAudioFifo(this._handle, frame._handle, nbSamples);
|
|
}
|
|
peek(frame, nbSamples) {
|
|
return binding.peekAudioFifo(this._handle, frame._handle, nbSamples);
|
|
}
|
|
drain(nbSamples) {
|
|
return binding.drainAudioFifo(this._handle, nbSamples);
|
|
}
|
|
reset() {
|
|
binding.resetAudioFifo(this._handle);
|
|
}
|
|
get size() {
|
|
return binding.getAudioFifoSize(this._handle);
|
|
}
|
|
get space() {
|
|
return binding.getAudioFifoSpace(this._handle);
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/channel-layout.js
|
|
var require_channel_layout = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/channel-layout.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var constants = require_constants();
|
|
module.exports = class FFmpegChannelLayout {
|
|
constructor(handle) {
|
|
this._handle = handle;
|
|
}
|
|
get nbChannels() {
|
|
return binding.getChannelLayoutNbChannels(this._handle);
|
|
}
|
|
get mask() {
|
|
return binding.getChannelLayoutMask(this._handle);
|
|
}
|
|
static from(value) {
|
|
if (typeof value === "string") value = constants.toChannelLayout(value);
|
|
if (typeof value === "number") {
|
|
value = binding.channelLayoutFromMask(value);
|
|
} else if (typeof value === "object" && value !== null) {
|
|
value = binding.copyChannelLayout(value._handle);
|
|
}
|
|
return new this(value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: FFmpegChannelLayout },
|
|
nbChannels: this.nbChannels
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/decoder.js
|
|
var require_decoder = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/decoder.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class FFmpegDecoder {
|
|
constructor(codec) {
|
|
if (typeof codec === "string") {
|
|
this._handle = binding.findDecoderByName(codec);
|
|
} else {
|
|
this._handle = binding.findDecoderByID(codec._id);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/encoder.js
|
|
var require_encoder = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/encoder.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class FFmpegEncoder {
|
|
constructor(codec) {
|
|
if (typeof codec === "string") {
|
|
this._handle = binding.findEncoderByName(codec);
|
|
} else {
|
|
this._handle = binding.findEncoderByID(codec._id);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/codec.js
|
|
var require_codec = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/codec.js"(exports, module) {
|
|
var Decoder = require_decoder();
|
|
var Encoder = require_encoder();
|
|
var constants = require_constants();
|
|
var binding = require_binding();
|
|
var codecs = /* @__PURE__ */ new Map();
|
|
module.exports = class FFmpegCodec {
|
|
constructor(id) {
|
|
this._id = id;
|
|
this._decoder = null;
|
|
this._encoder = null;
|
|
}
|
|
get id() {
|
|
return this._id;
|
|
}
|
|
get decoder() {
|
|
if (this._decoder === null) this._decoder = new Decoder(this);
|
|
return this._decoder;
|
|
}
|
|
get encoder() {
|
|
if (this._encoder === null) this._encoder = new Encoder(this);
|
|
return this._encoder;
|
|
}
|
|
get name() {
|
|
if (Number.isInteger(this._id)) {
|
|
return binding.getCodecNameByID(this._id);
|
|
}
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: FFmpegCodec },
|
|
id: this.id,
|
|
name: this.name
|
|
};
|
|
}
|
|
/** @return {FFmpegCodec} */
|
|
static for(id) {
|
|
let codec = codecs.get(id);
|
|
if (codec === void 0) {
|
|
codec = new FFmpegCodec(id);
|
|
codecs.set(id, codec);
|
|
}
|
|
return codec;
|
|
}
|
|
static MJPEG = this.for(constants.codecs.MJPEG);
|
|
static H264 = this.for(constants.codecs.H264);
|
|
static AAC = this.for(constants.codecs.AAC);
|
|
static OPUS = this.for(constants.codecs.OPUS);
|
|
static AV1 = this.for(constants.codecs.AV1);
|
|
static VP8 = this.for(constants.codecs.VP8);
|
|
static VP9 = this.for(constants.codecs.VP9);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/rational.js
|
|
var require_rational = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/rational.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var { AV_ROUND_NEAR_INF } = require_constants().rounding;
|
|
module.exports = class FFmpegRational {
|
|
constructor(numerator = 0, denominator = 1) {
|
|
this.numerator = numerator;
|
|
this.denominator = denominator;
|
|
}
|
|
get valid() {
|
|
if (this.denominator < 0) return false;
|
|
const n = this.toNumber();
|
|
if (Number.isNaN(n) || n === 0) return false;
|
|
return true;
|
|
}
|
|
get uninitialized() {
|
|
return this.numerator === 0 && this.denominator === 1;
|
|
}
|
|
toNumber() {
|
|
return this.numerator / this.denominator;
|
|
}
|
|
equals(other) {
|
|
return this.numerator === other.numerator && this.denominator === other.denominator;
|
|
}
|
|
static from(num) {
|
|
const view = new Int32Array(binding.rationalD2Q(num));
|
|
return new FFmpegRational(view[0], view[1]);
|
|
}
|
|
static rescaleQ(n, src, dst, round = AV_ROUND_NEAR_INF) {
|
|
if (src.equals(dst)) return n;
|
|
return binding.rationalRescaleQ(
|
|
n,
|
|
src.numerator,
|
|
src.denominator,
|
|
dst.numerator,
|
|
dst.denominator,
|
|
round
|
|
);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/hw-device-context.js
|
|
var require_hw_device_context = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/hw-device-context.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class HWDeviceContext {
|
|
constructor(type, device = void 0, handle = void 0) {
|
|
if (handle) {
|
|
this._handle = handle;
|
|
} else {
|
|
this._handle = binding.initHWDeviceContext(type, device);
|
|
}
|
|
}
|
|
static from(handle) {
|
|
if (handle == null) return null;
|
|
return new HWDeviceContext(null, void 0, handle);
|
|
}
|
|
destroy() {
|
|
binding.destroyHWDeviceContext(this._handle);
|
|
this._handle = null;
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: HWDeviceContext }
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/codec-context.js
|
|
var require_codec_context = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/codec-context.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var Rational = require_rational();
|
|
var ChannelLayout = require_channel_layout();
|
|
var HWDeviceContext = require_hw_device_context();
|
|
var { codecConfig, optionFlags } = require_constants();
|
|
module.exports = class FFmpegCodecContext {
|
|
constructor(codec) {
|
|
this._codec = codec;
|
|
this._opened = false;
|
|
this._handle = binding.initCodecContext(codec._handle);
|
|
}
|
|
destroy() {
|
|
binding.destroyCodecContext(this._handle);
|
|
this._handle = null;
|
|
}
|
|
get pixelFormat() {
|
|
return binding.getCodecContextPixelFormat(this._handle);
|
|
}
|
|
set pixelFormat(value) {
|
|
binding.setCodecContextPixelFormat(this._handle, value);
|
|
}
|
|
get width() {
|
|
return binding.getCodecContextWidth(this._handle);
|
|
}
|
|
set width(value) {
|
|
binding.setCodecContextWidth(this._handle, value);
|
|
}
|
|
get height() {
|
|
return binding.getCodecContextHeight(this._handle);
|
|
}
|
|
set height(value) {
|
|
binding.setCodecContextHeight(this._handle, value);
|
|
}
|
|
get sampleFormat() {
|
|
return binding.getCodecContextSampleFormat(this._handle);
|
|
}
|
|
set sampleFormat(value) {
|
|
return binding.setCodecContextSampleFormat(this._handle, value);
|
|
}
|
|
get sampleRate() {
|
|
return binding.getCodecContextSampleRate(this._handle);
|
|
}
|
|
set sampleRate(value) {
|
|
binding.setCodecContextSampleRate(this._handle, value);
|
|
}
|
|
get timeBase() {
|
|
const view = new Int32Array(binding.getCodecContextTimeBase(this._handle));
|
|
return new Rational(view[0], view[1]);
|
|
}
|
|
set timeBase(value) {
|
|
binding.setCodecContextTimeBase(this._handle, value.numerator, value.denominator);
|
|
}
|
|
get frameRate() {
|
|
const view = new Int32Array(binding.getCodecContextFramerate(this._handle));
|
|
return new Rational(view[0], view[1]);
|
|
}
|
|
set frameRate(value) {
|
|
binding.setCodecContextFramerate(this._handle, value.numerator, value.denominator);
|
|
}
|
|
get channelLayout() {
|
|
return new ChannelLayout(binding.getCodecContextChannelLayout(this._handle));
|
|
}
|
|
set channelLayout(value) {
|
|
binding.setCodecContextChannelLayout(this._handle, ChannelLayout.from(value)._handle);
|
|
}
|
|
get gopSize() {
|
|
return binding.getCodecContextGOPSize(this._handle);
|
|
}
|
|
set gopSize(value) {
|
|
binding.setCodecContextGOPSize(this._handle, value);
|
|
}
|
|
get flags() {
|
|
return binding.getCodecContextFlags(this._handle);
|
|
}
|
|
set flags(value) {
|
|
binding.setCodecContextFlags(this._handle, value);
|
|
}
|
|
get extraData() {
|
|
return Buffer.from(binding.getCodecContextExtraData(this._handle));
|
|
}
|
|
set extraData(value) {
|
|
binding.setCodecContextExtraData(this._handle, value.buffer, value.byteOffset, value.byteLength);
|
|
}
|
|
get frameSize() {
|
|
return binding.getCodecContextFrameSize(this._handle);
|
|
}
|
|
get frameNum() {
|
|
return binding.getCodecContextFrameNum(this._handle);
|
|
}
|
|
get requestSampleFormat() {
|
|
return binding.getCodecContextRequestSampleFormat(this._handle);
|
|
}
|
|
set requestSampleFormat(sampleFormat) {
|
|
binding.setCodecContextRequestSampleFormat(this._handle, sampleFormat);
|
|
}
|
|
get hwDeviceCtx() {
|
|
return HWDeviceContext.from(binding.getCodecContextHWDeviceCtx(this._handle));
|
|
}
|
|
set hwDeviceCtx(hwDeviceContext) {
|
|
binding.setCodecContextHWDeviceCtx(this._handle, hwDeviceContext._handle);
|
|
}
|
|
set getFormat(callback) {
|
|
const wrap = (pixelFormats) => {
|
|
return callback(this, pixelFormats);
|
|
};
|
|
binding.setCodecContextGetFormat(this._handle, wrap);
|
|
}
|
|
open(options) {
|
|
if (this._opened) return;
|
|
this._opened = true;
|
|
if (options) {
|
|
binding.openCodecContextWithOptions(this._handle, options._handle);
|
|
} else {
|
|
binding.openCodecContext(this._handle);
|
|
}
|
|
}
|
|
sendPacket(packet) {
|
|
return binding.sendCodecContextPacket(this._handle, packet._handle);
|
|
}
|
|
receivePacket(packet) {
|
|
return binding.receiveCodecContextPacket(this._handle, packet._handle);
|
|
}
|
|
sendFrame(frame) {
|
|
let frameHandle = void 0;
|
|
if (frame) frameHandle = frame._handle;
|
|
return binding.sendCodecContextFrame(this._handle, frameHandle);
|
|
}
|
|
receiveFrame(frame) {
|
|
return binding.receiveCodecContextFrame(this._handle, frame._handle);
|
|
}
|
|
getSupportedConfig(config) {
|
|
if (config === codecConfig.FRAME_RATE) {
|
|
const data2 = binding.getSupportedFrameRates(this._handle, this._codec._handle);
|
|
if (!data2 || data2.length === 0) return null;
|
|
const view = new Int32Array(data2);
|
|
const rates = [];
|
|
for (let i = 0; i < view.length; i += 2) {
|
|
rates.push(new Rational(view[i], view[i + 1]));
|
|
}
|
|
return rates;
|
|
}
|
|
if (config === codecConfig.CHANNEL_LAYOUT) {
|
|
const handles = binding.getSupportedChannelLayouts(this._handle, this._codec._handle);
|
|
if (!handles || handles.length === 0) return null;
|
|
return handles.map((handle) => new ChannelLayout(handle));
|
|
}
|
|
const data = binding.getSupportedConfig(this._handle, this._codec._handle, config);
|
|
if (config === codecConfig.SAMPLE_RATE && !data) {
|
|
return null;
|
|
}
|
|
return new Int32Array(data);
|
|
}
|
|
getOption(name, flags = optionFlags.SEARCH_CHILDREN) {
|
|
return binding.getOption(this._handle, name, flags);
|
|
}
|
|
setOption(name, value, flags = optionFlags.SEARCH_CHILDREN) {
|
|
return binding.setOption(this._handle, name, value, flags);
|
|
}
|
|
setOptionDictionary(dictionary, flags = optionFlags.SEARCH_CHILDREN) {
|
|
return binding.setOptionDictionary(this._handle, dictionary._handle, flags);
|
|
}
|
|
setOptionDefaults() {
|
|
return binding.setOptionDefaults(this._handle);
|
|
}
|
|
listOptionNames(flags = optionFlags.SEARCH_CHILDREN) {
|
|
return binding.listOptionNames(this._handle, flags);
|
|
}
|
|
getOptions(flags) {
|
|
const options = {};
|
|
for (const name of this.listOptionNames(flags)) {
|
|
try {
|
|
options[name] = this.getOption(name, flags);
|
|
} catch (error) {
|
|
}
|
|
}
|
|
return options;
|
|
}
|
|
copyOptionsFrom(codecContext) {
|
|
binding.copyOptions(this._handle, codecContext._handle);
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: FFmpegCodecContext },
|
|
_codec: this._codec,
|
|
_opened: this._opened,
|
|
flags: this.flags,
|
|
pixelFormat: this.pixelFormat,
|
|
width: this.width,
|
|
height: this.height,
|
|
sampleFormat: this.sampleFormat,
|
|
sampleRate: this.sampleRate,
|
|
timeBase: this.timeBase,
|
|
channelLayout: this.channelLayout,
|
|
gopSize: this.gopSize,
|
|
extraData: this.extraData,
|
|
frameRate: this.frameRate,
|
|
frameSize: this.frameSize,
|
|
frameNum: this.frameNum
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/codec-parameters.js
|
|
var require_codec_parameters = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/codec-parameters.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var ChannelLayout = require_channel_layout();
|
|
var Rational = require_rational();
|
|
module.exports = class FFmpegCodecParameters {
|
|
constructor(handle, owned = false) {
|
|
this._handle = handle;
|
|
this._owned = owned;
|
|
}
|
|
// Getters, Setters
|
|
get bitRate() {
|
|
return binding.getCodecParametersBitRate(this._handle);
|
|
}
|
|
set bitRate(rate) {
|
|
binding.setCodecParametersBitRate(this._handle, rate);
|
|
}
|
|
get bitsPerCodedSample() {
|
|
return binding.getCodecParametersBitsPerCodedSample(this._handle);
|
|
}
|
|
set bitsPerCodedSample(bits) {
|
|
binding.setCodecParametersBitsPerCodedSample(this._handle, bits);
|
|
}
|
|
get bitsPerRawSample() {
|
|
return binding.getCodecParametersBitsPerRawSample(this._handle);
|
|
}
|
|
set bitsPerRawSample(bits) {
|
|
binding.setCodecParametersBitsPerRawSample(this._handle, bits);
|
|
}
|
|
get sampleRate() {
|
|
return binding.getCodecParametersSampleRate(this._handle);
|
|
}
|
|
set sampleRate(rate) {
|
|
binding.setCodecParametersSampleRate(this._handle, rate);
|
|
}
|
|
get sampleAspectRatio() {
|
|
const view = new Int32Array(binding.getCodecParametersSampleAspectRatio(this._handle));
|
|
return new Rational(view[0], view[1]);
|
|
}
|
|
set sampleAspectRatio(ratio) {
|
|
binding.setCodecParametersSampleAspectRatio(this._handle, ratio.numerator, ratio.denominator);
|
|
}
|
|
get frameRate() {
|
|
const view = new Int32Array(binding.getCodecParametersFramerate(this._handle));
|
|
return new Rational(view[0], view[1]);
|
|
}
|
|
set frameRate(rate) {
|
|
binding.setCodecParametersFramerate(this._handle, rate.numerator, rate.denominator);
|
|
}
|
|
get frameSize() {
|
|
return binding.getCodecParametersFrameSize(this._handle);
|
|
}
|
|
set frameSize(size) {
|
|
binding.setCodecParametersFrameSize(this._handle, size);
|
|
}
|
|
get videoDelay() {
|
|
return binding.getCodecParametersVideoDelay(this._handle);
|
|
}
|
|
set videoDelay(delay) {
|
|
binding.setCodecParametersVideoDelay(this._handle, delay);
|
|
}
|
|
get nbChannels() {
|
|
return binding.getCodecParametersNbChannels(this._handle);
|
|
}
|
|
set nbChannels(numberOfChannels) {
|
|
binding.setCodecParametersNbChannels(this._handle, numberOfChannels);
|
|
}
|
|
get type() {
|
|
return binding.getCodecParametersType(this._handle);
|
|
}
|
|
set type(type) {
|
|
binding.setCodecParametersType(this._handle, type);
|
|
}
|
|
get tag() {
|
|
return binding.getCodecParametersTag(this._handle);
|
|
}
|
|
set tag(tag) {
|
|
binding.setCodecParametersTag(this._handle, tag);
|
|
}
|
|
get id() {
|
|
return binding.getCodecParametersId(this._handle);
|
|
}
|
|
set id(id) {
|
|
binding.setCodecParametersId(this._handle, id);
|
|
}
|
|
get level() {
|
|
return binding.getCodecParametersLevel(this._handle);
|
|
}
|
|
set level(level) {
|
|
binding.setCodecParametersLevel(this._handle, level);
|
|
}
|
|
get profile() {
|
|
return binding.getCodecParametersProfile(this._handle);
|
|
}
|
|
set profile(profile) {
|
|
binding.setCodecParametersProfile(this._handle, profile);
|
|
}
|
|
get format() {
|
|
return binding.getCodecParametersFormat(this._handle);
|
|
}
|
|
set format(format) {
|
|
binding.setCodecParametersFormat(this._handle, format);
|
|
}
|
|
get channelLayout() {
|
|
return new ChannelLayout(binding.getCodecParametersChannelLayout(this._handle));
|
|
}
|
|
set channelLayout(value) {
|
|
binding.setCodecParametersChannelLayout(this._handle, ChannelLayout.from(value)._handle);
|
|
}
|
|
get width() {
|
|
return binding.getCodecParametersWidth(this._handle);
|
|
}
|
|
set width(value) {
|
|
binding.setCodecParametersWidth(this._handle, value);
|
|
}
|
|
get height() {
|
|
return binding.getCodecParametersHeight(this._handle);
|
|
}
|
|
set height(value) {
|
|
binding.setCodecParametersHeight(this._handle, value);
|
|
}
|
|
get extraData() {
|
|
return Buffer.from(binding.getCodecParametersExtraData(this._handle));
|
|
}
|
|
set extraData(value) {
|
|
binding.setCodecParametersExtraData(
|
|
this._handle,
|
|
value.buffer,
|
|
value.byteOffset,
|
|
value.byteLength
|
|
);
|
|
}
|
|
get blockAlign() {
|
|
return binding.getCodecParametersBlockAlign(this._handle);
|
|
}
|
|
set blockAlign(value) {
|
|
binding.setCodecParametersBlockAlign(this._handle, value);
|
|
}
|
|
get initialPadding() {
|
|
return binding.getCodecParametersInitialPadding(this._handle);
|
|
}
|
|
set initialPadding(value) {
|
|
binding.setCodecParametersInitialPadding(this._handle, value);
|
|
}
|
|
get trailingPadding() {
|
|
return binding.getCodecParametersTrailingPadding(this._handle);
|
|
}
|
|
set trailingPadding(value) {
|
|
binding.setCodecParametersTrailingPadding(this._handle, value);
|
|
}
|
|
get seekPreroll() {
|
|
return binding.getCodecParametersSeekPreroll(this._handle);
|
|
}
|
|
set seekPreroll(value) {
|
|
binding.setCodecParametersSeekPreroll(this._handle, value);
|
|
}
|
|
get colorSpace() {
|
|
return binding.getCodecParametersColorSpace(this._handle);
|
|
}
|
|
set colorSpace(value) {
|
|
binding.setCodecParametersColorSpace(this._handle, value);
|
|
}
|
|
get colorPrimaries() {
|
|
return binding.getCodecParametersColorPrimaries(this._handle);
|
|
}
|
|
set colorPrimaries(value) {
|
|
binding.setCodecParametersColorPrimaries(this._handle, value);
|
|
}
|
|
get colorTRC() {
|
|
return binding.getCodecParametersColorTRC(this._handle);
|
|
}
|
|
set colorTRC(value) {
|
|
binding.setCodecParametersColorTRC(this._handle, value);
|
|
}
|
|
get colorRange() {
|
|
return binding.getCodecParametersColorRange(this._handle);
|
|
}
|
|
set colorRange(value) {
|
|
binding.setCodecParametersColorRange(this._handle, value);
|
|
}
|
|
// Methods
|
|
fromContext(context) {
|
|
binding.codecParametersFromContext(this._handle, context._handle);
|
|
}
|
|
toContext(context) {
|
|
binding.codecParametersToContext(context._handle, this._handle);
|
|
}
|
|
destroy() {
|
|
if (this._owned) binding.destroyCodecParameters(this._handle);
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
// TODO: add other props
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: FFmpegCodecParameters },
|
|
type: this.type,
|
|
id: this.id,
|
|
format: this.format,
|
|
tag: this.tag,
|
|
frameRate: this.frameRate,
|
|
videoDelay: this.videoDelay,
|
|
profile: this.profile,
|
|
level: this.level,
|
|
width: this.width,
|
|
height: this.height,
|
|
sampleAsectRatio: this.sampleAspectRatio,
|
|
bitRate: this.bitRate,
|
|
bitsPerCodedSample: this.bitsPerCodedSample,
|
|
bitsPerRawSample: this.bitsPerRawSample,
|
|
sampleRate: this.sampleRate,
|
|
nbChannels: this.nbChannels,
|
|
channelLayout: this.channelLayout,
|
|
extraData: this.extraData,
|
|
blockAlign: this.blockAlign,
|
|
initialPadding: this.initialPadding,
|
|
trailingPadding: this.trailingPadding,
|
|
seekPreroll: this.seekPreroll,
|
|
frameSize: this.frameSize
|
|
};
|
|
}
|
|
static alloc() {
|
|
return new FFmpegCodecParameters(binding.allocCodecParameters(), true);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/dictionary.js
|
|
var require_dictionary = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/dictionary.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class FFmpegDictionary {
|
|
static from(obj) {
|
|
const dictionary = new FFmpegDictionary();
|
|
for (const [key, value] of Object.entries(obj)) {
|
|
dictionary.set(key, value);
|
|
}
|
|
return dictionary;
|
|
}
|
|
constructor() {
|
|
this._handle = binding.initDictionary();
|
|
}
|
|
destroy() {
|
|
binding.destroyDictionary(this._handle);
|
|
this._handle = null;
|
|
}
|
|
get(key) {
|
|
const value = binding.getDictionaryEntry(this._handle, key);
|
|
if (value === void 0) return null;
|
|
return value;
|
|
}
|
|
set(key, value) {
|
|
if (typeof value !== "string") value = String(value);
|
|
binding.setDictionaryEntry(this._handle, key, value);
|
|
}
|
|
entries() {
|
|
return binding.getDictionaryEntries(this._handle);
|
|
}
|
|
*[Symbol.iterator]() {
|
|
yield* this.entries();
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/side-data.js
|
|
var require_side_data = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/side-data.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class SideData {
|
|
constructor(handle, opts = {}) {
|
|
this._handle = handle;
|
|
this._type = opts.type || null;
|
|
this._data = opts.data || null;
|
|
}
|
|
static fromData(data, type) {
|
|
return new SideData(null, { data, type });
|
|
}
|
|
get type() {
|
|
if (this._type) return this._type;
|
|
return binding.getSideDataType(this._handle);
|
|
}
|
|
get name() {
|
|
if (!this._handle) return null;
|
|
return binding.getSideDataName(this._handle);
|
|
}
|
|
get data() {
|
|
if (this._data) return this._data;
|
|
return Buffer.from(binding.getSideDataBuffer(this._handle));
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: SideData },
|
|
type: this.type,
|
|
name: this.name,
|
|
data: this.data
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/stream.js
|
|
var require_stream = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/stream.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var Codec = require_codec();
|
|
var CodecContext = require_codec_context();
|
|
var CodecParameters = require_codec_parameters();
|
|
var Rational = require_rational();
|
|
var SideData = require_side_data();
|
|
module.exports = class FFmpegStream {
|
|
constructor(handle) {
|
|
this._handle = handle;
|
|
this._codecParameters = new CodecParameters(binding.getStreamCodecParameters(this._handle));
|
|
}
|
|
get id() {
|
|
return binding.getStreamId(this._handle);
|
|
}
|
|
set id(value) {
|
|
binding.setStreamId(this._handle, value);
|
|
}
|
|
get index() {
|
|
return binding.getStreamIndex(this._handle);
|
|
}
|
|
get codec() {
|
|
return Codec.for(this.codecParameters.id);
|
|
}
|
|
get codecParameters() {
|
|
return this._codecParameters;
|
|
}
|
|
get sideData() {
|
|
const handles = binding.getStreamSideData(this._handle);
|
|
return handles.map((handle) => new SideData(handle));
|
|
}
|
|
get timeBase() {
|
|
const view = new Int32Array(binding.getStreamTimeBase(this._handle));
|
|
return new Rational(view[0], view[1]);
|
|
}
|
|
set timeBase(value) {
|
|
binding.setStreamTimeBase(this._handle, value.numerator, value.denominator);
|
|
}
|
|
get avgFramerate() {
|
|
const view = new Int32Array(binding.getStreamAverageFramerate(this._handle));
|
|
return new Rational(view[0], view[1]);
|
|
}
|
|
set avgFramerate(value) {
|
|
binding.setStreamAverageFramerate(this._handle, value.numerator, value.denominator);
|
|
}
|
|
get duration() {
|
|
return binding.getStreamDuration(this._handle);
|
|
}
|
|
set duration(value) {
|
|
binding.setStreamDuration(this._handle, value);
|
|
}
|
|
decoder() {
|
|
const context = new CodecContext(this.codec.decoder);
|
|
this._codecParameters.toContext(context);
|
|
return context;
|
|
}
|
|
encoder() {
|
|
const context = new CodecContext(this.codec.encoder);
|
|
this._codecParameters.toContext(context);
|
|
return context;
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: FFmpegStream },
|
|
id: this.id,
|
|
index: this.index,
|
|
sideData: this.sideData,
|
|
timeBase: this.timeBase,
|
|
avgFramerate: this.avgFramerate,
|
|
codecParameters: this.codecParameters
|
|
};
|
|
}
|
|
};
|
|
module.exports.SideData = SideData;
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/output-format.js
|
|
var require_output_format = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/output-format.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class FFmpegOutputFormat {
|
|
constructor(name, handle) {
|
|
if (handle) this._handle = handle;
|
|
else this._handle = binding.initOutputFormat(name);
|
|
}
|
|
static from(handle) {
|
|
return new FFmpegOutputFormat(null, handle);
|
|
}
|
|
get flags() {
|
|
return binding.getOutputFormatFlags(this._handle);
|
|
}
|
|
get extensions() {
|
|
return binding.getOutputFormatExtensions(this._handle);
|
|
}
|
|
get mimeType() {
|
|
return binding.getOutputFormatMimeType(this._handle);
|
|
}
|
|
get name() {
|
|
return binding.getOutputFormatName(this._handle);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: FFmpegOutputFormat },
|
|
name: this.name,
|
|
flags: this.flags,
|
|
extensions: this.extensions,
|
|
mimeType: this.mimeType
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/io-context.js
|
|
var require_io_context = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/io-context.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class FFmpegIOContext {
|
|
constructor(buffer, opts = {}) {
|
|
if (buffer === null && opts === null) {
|
|
this._handle = null;
|
|
return;
|
|
}
|
|
let offset = 0;
|
|
let len = 0;
|
|
if (typeof buffer === "number") {
|
|
len = buffer;
|
|
buffer = void 0;
|
|
} else if (buffer) {
|
|
offset = buffer.byteOffset;
|
|
len = buffer.byteLength;
|
|
buffer = buffer.buffer;
|
|
} else {
|
|
buffer = Buffer.alloc(0);
|
|
}
|
|
this._handle = binding.initIOContext(
|
|
buffer,
|
|
offset,
|
|
len,
|
|
opts.onwrite && onwriteWrapper.bind(null, opts.onwrite),
|
|
opts.onread && onreadWrapper.bind(null, opts.onread),
|
|
opts.onseek
|
|
);
|
|
}
|
|
destroy() {
|
|
if (this._handle) {
|
|
binding.destroyIOContext(this._handle);
|
|
this._handle = null;
|
|
}
|
|
}
|
|
transfer() {
|
|
const to = new FFmpegIOContext(null, null);
|
|
to._handle = this._handle;
|
|
this._handle = null;
|
|
return to;
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
};
|
|
function onwriteWrapper(target, arraybuffer) {
|
|
return target(Buffer.from(arraybuffer));
|
|
}
|
|
function onreadWrapper(target, arraybuffer, requestedLen) {
|
|
return target(Buffer.from(arraybuffer), requestedLen);
|
|
}
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/input-format.js
|
|
var require_input_format = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/input-format.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var defaultName = null;
|
|
switch (Bare.platform) {
|
|
case "android":
|
|
defaultName = "android_camera";
|
|
break;
|
|
case "darwin":
|
|
case "ios":
|
|
defaultName = "avfoundation";
|
|
break;
|
|
case "linux":
|
|
defaultName = "v4l2";
|
|
break;
|
|
case "win32":
|
|
defaultName = "dshow";
|
|
break;
|
|
}
|
|
module.exports = class FFmpegInputFormat {
|
|
constructor(name = defaultName, handle) {
|
|
if (handle) this._handle = handle;
|
|
else this._handle = binding.initInputFormat(name);
|
|
}
|
|
static from(handle) {
|
|
return new FFmpegInputFormat(null, handle);
|
|
}
|
|
get flags() {
|
|
return binding.getInputFormatFlags(this._handle);
|
|
}
|
|
get extensions() {
|
|
return binding.getInputFormatExtensions(this._handle);
|
|
}
|
|
get mimeType() {
|
|
return binding.getInputFormatMimeType(this._handle);
|
|
}
|
|
get name() {
|
|
return binding.getInputFormatName(this._handle);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: FFmpegInputFormat },
|
|
name: this.name,
|
|
flags: this.flags,
|
|
extensions: this.extensions,
|
|
mimeType: this.mimeType
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/format-context.js
|
|
var require_format_context = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/format-context.js"(exports) {
|
|
var binding = require_binding();
|
|
var Stream = require_stream();
|
|
var OutputFormat = require_output_format();
|
|
var IOContext = require_io_context();
|
|
var InputFormat = require_input_format();
|
|
var Dictionary = require_dictionary();
|
|
var FFmpegFormatContext = class {
|
|
constructor(io) {
|
|
this._io = io ? io.transfer() : null;
|
|
this._streams = [];
|
|
}
|
|
destroy() {
|
|
if (this._io) {
|
|
this._io.destroy();
|
|
this._io = null;
|
|
}
|
|
}
|
|
get io() {
|
|
return this._io;
|
|
}
|
|
get streams() {
|
|
return this._streams;
|
|
}
|
|
readFrame(packet) {
|
|
return binding.readFormatContextFrame(this._handle, packet._handle);
|
|
}
|
|
getBestStreamIndex(type) {
|
|
return binding.getFormatContextBestStreamIndex(this._handle, type);
|
|
}
|
|
getStream(index) {
|
|
if (index < 0 || index >= this._streams.length) {
|
|
return null;
|
|
}
|
|
return this._streams[index];
|
|
}
|
|
/** @returns {Stream|null} */
|
|
getBestStream(type) {
|
|
if (this._streams.length === 0) {
|
|
return null;
|
|
}
|
|
const bestIndex = binding.getFormatContextBestStreamIndex(this._handle, type);
|
|
if (bestIndex < 0 || bestIndex >= this._streams.length) {
|
|
return null;
|
|
}
|
|
return this._streams[bestIndex];
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
};
|
|
var defaultURL = null;
|
|
switch (Bare.platform) {
|
|
case "darwin":
|
|
case "ios":
|
|
defaultURL = "0:0";
|
|
break;
|
|
case "linux":
|
|
defaultURL = "/dev/video0";
|
|
break;
|
|
case "win32":
|
|
defaultURL = "video=Integrated Camera";
|
|
break;
|
|
}
|
|
exports.InputFormatContext = class FFmpegInputFormatContext extends FFmpegFormatContext {
|
|
constructor(io, options, url = defaultURL) {
|
|
if (io instanceof IOContext) {
|
|
super(io);
|
|
this._handle = binding.openInputFormatContextWithIO(this._io._handle);
|
|
} else if (io instanceof InputFormat) {
|
|
super();
|
|
options = options || new Dictionary();
|
|
this._handle = binding.openInputFormatContextWithFormat(io._handle, options._handle, url);
|
|
options.destroy();
|
|
}
|
|
for (const handle of binding.getFormatContextStreams(this._handle)) {
|
|
this._streams.push(new Stream(handle));
|
|
}
|
|
}
|
|
destroy() {
|
|
super.destroy();
|
|
binding.closeInputFormatContext(this._handle);
|
|
this._handle = null;
|
|
}
|
|
dump(printIdx = 0, printUrl = "") {
|
|
binding.dumpFormatContext(this._handle, false, printIdx, printUrl);
|
|
}
|
|
get inputFormat() {
|
|
const handle = binding.getFormatContextInputFormat(this._handle);
|
|
if (handle) return InputFormat.from(handle);
|
|
}
|
|
};
|
|
exports.OutputFormatContext = class FFmpegOutputFormatContext extends FFmpegFormatContext {
|
|
constructor(format, io) {
|
|
super(io);
|
|
if (typeof format === "string") format = new OutputFormat(format);
|
|
this._handle = binding.openOutputFormatContext(format._handle, this._io._handle);
|
|
this._isOutput = true;
|
|
}
|
|
destroy() {
|
|
super.destroy();
|
|
binding.closeOutputFormatContext(this._handle);
|
|
this._handle = null;
|
|
}
|
|
createStream() {
|
|
const stream = new Stream(binding.createFormatContextStream(this._handle));
|
|
this._streams.push(stream);
|
|
return stream;
|
|
}
|
|
/** @param {Dictionary} [options] format options */
|
|
writeHeader(options) {
|
|
binding.writeFormatContextHeader(this._handle, options?._handle);
|
|
}
|
|
/** @param {Packet} packet */
|
|
writeFrame(packet) {
|
|
binding.writeFormatContextFrame(this._handle, packet._handle);
|
|
}
|
|
writeTrailer() {
|
|
binding.writeFormatContextTrailer(this._handle);
|
|
}
|
|
dump(printIdx = 0, printUrl = "") {
|
|
binding.dumpFormatContext(this._handle, true, printIdx, printUrl);
|
|
}
|
|
get outputFormat() {
|
|
const handle = binding.getFormatContextOutputFormat(this._handle);
|
|
if (handle) return OutputFormat.from(handle);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/filter.js
|
|
var require_filter = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/filter.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class Filter {
|
|
constructor(name) {
|
|
this._handle = binding.getFilterByName(name);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/filter-context.js
|
|
var require_filter_context = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/filter-context.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class FilterContext {
|
|
constructor() {
|
|
this._handle = binding.initFilterContext();
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/filter-graph.js
|
|
var require_filter_graph = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/filter-graph.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class FilterGraph {
|
|
constructor() {
|
|
this._handle = binding.initFilterGraph();
|
|
}
|
|
destroy() {
|
|
binding.destroyFilterGraph(this._handle);
|
|
this._handle = null;
|
|
}
|
|
createFilter(context, filter, name, args) {
|
|
return binding.createFilterGraphFilter(
|
|
this._handle,
|
|
context._handle,
|
|
filter._handle,
|
|
name,
|
|
args ?? void 0
|
|
);
|
|
}
|
|
parse(filterDescription, inputs, outputs) {
|
|
binding.parseFilterGraph(this._handle, inputs._handle, outputs._handle, filterDescription);
|
|
}
|
|
configure() {
|
|
binding.configureFilterGraph(this._handle);
|
|
}
|
|
pushFrame(ctx, frame) {
|
|
return binding.pushFilterGraphFrame(ctx._handle, frame._handle);
|
|
}
|
|
pullFrame(ctx, frame) {
|
|
return binding.pullFilterGraphFrame(ctx._handle, frame._handle);
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/filter-inout.js
|
|
var require_filter_inout = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/filter-inout.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class FilterInOut {
|
|
constructor(handle = binding.initFilterInout()) {
|
|
this._handle = handle;
|
|
this._next = null;
|
|
this._filterContext = null;
|
|
}
|
|
destroy() {
|
|
binding.destroyFilterInOut(this._handle);
|
|
this._handle = null;
|
|
}
|
|
get name() {
|
|
return binding.getFilterInOutName(this._handle);
|
|
}
|
|
set name(value) {
|
|
return binding.setFilterInOutName(this._handle, value);
|
|
}
|
|
get filterContext() {
|
|
return this._filterContext;
|
|
}
|
|
set filterContext(value) {
|
|
this._filterContext = value;
|
|
return binding.setFilterInOutFilterContext(this._handle, this._filterContext._handle);
|
|
}
|
|
get padIdx() {
|
|
return binding.getFilterInOutPadIdx(this._handle);
|
|
}
|
|
set padIdx(value) {
|
|
return binding.setFilterInOutPadIdx(this._handle, value);
|
|
}
|
|
get next() {
|
|
return this._next;
|
|
}
|
|
set next(value) {
|
|
this._next = value;
|
|
return binding.setFilterInOutNext(this._handle, this._next._handle);
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/hw-frames-constraints.js
|
|
var require_hw_frames_constraints = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/hw-frames-constraints.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class HWFramesConstraints {
|
|
constructor(handle) {
|
|
this._handle = handle;
|
|
}
|
|
get validSwFormats() {
|
|
return binding.getHWFramesConstraintsValidSwFormats(this._handle);
|
|
}
|
|
get validHwFormats() {
|
|
return binding.getHWFramesConstraintsValidHwFormats(this._handle);
|
|
}
|
|
get minWidth() {
|
|
return binding.getHWFramesConstraintsMinWidth(this._handle);
|
|
}
|
|
get maxWidth() {
|
|
return binding.getHWFramesConstraintsMaxWidth(this._handle);
|
|
}
|
|
get minHeight() {
|
|
return binding.getHWFramesConstraintsMinHeight(this._handle);
|
|
}
|
|
get maxHeight() {
|
|
return binding.getHWFramesConstraintsMaxHeight(this._handle);
|
|
}
|
|
// Note: HWFramesConstraints is independently allocated by FFmpeg and must be
|
|
// explicitly freed. It is not owned by HWFramesContext.
|
|
destroy() {
|
|
binding.destroyHWFramesConstraints(this._handle);
|
|
this._handle = null;
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: HWFramesConstraints },
|
|
validSwFormats: this.validSwFormats,
|
|
validHwFormats: this.validHwFormats,
|
|
minWidth: this.minWidth,
|
|
maxWidth: this.maxWidth,
|
|
minHeight: this.minHeight,
|
|
maxHeight: this.maxHeight
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/hw-frames-context.js
|
|
var require_hw_frames_context = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/hw-frames-context.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var HWFramesConstraints = require_hw_frames_constraints();
|
|
module.exports = class HWFramesContext {
|
|
constructor(hwDeviceContext, format, swFormat, width, height, handle = void 0) {
|
|
if (handle) {
|
|
this._handle = handle;
|
|
return;
|
|
}
|
|
this._handle = binding.initHWFramesContext(
|
|
hwDeviceContext._handle,
|
|
format,
|
|
swFormat,
|
|
width,
|
|
height
|
|
);
|
|
}
|
|
static from(handle) {
|
|
if (handle == null) return null;
|
|
return new HWFramesContext(null, null, null, null, null, handle);
|
|
}
|
|
get format() {
|
|
return binding.getHWFramesContextFormat(this._handle);
|
|
}
|
|
set format(value) {
|
|
binding.setHWFramesContextFormat(this._handle, value);
|
|
}
|
|
get swFormat() {
|
|
return binding.getHWFramesContextSWFormat(this._handle);
|
|
}
|
|
set swFormat(value) {
|
|
binding.setHWFramesContextSWFormat(this._handle, value);
|
|
}
|
|
get width() {
|
|
return binding.getHWFramesContextWidth(this._handle);
|
|
}
|
|
set width(value) {
|
|
binding.setHWFramesContextWidth(this._handle, value);
|
|
}
|
|
get height() {
|
|
return binding.getHWFramesContextHeight(this._handle);
|
|
}
|
|
set height(value) {
|
|
binding.setHWFramesContextHeight(this._handle, value);
|
|
}
|
|
get initialPoolSize() {
|
|
return binding.getHWFramesContextInitialPoolSize(this._handle);
|
|
}
|
|
set initialPoolSize(value) {
|
|
binding.setHWFramesContextInitialPoolSize(this._handle, value);
|
|
}
|
|
getBuffer(frame) {
|
|
binding.getHWFramesContextBuffer(this._handle, frame._handle);
|
|
}
|
|
getConstraints() {
|
|
const handle = binding.getHWFramesContextConstraints(this._handle);
|
|
return new HWFramesConstraints(handle);
|
|
}
|
|
destroy() {
|
|
binding.destroyHWFramesContext(this._handle);
|
|
this._handle = null;
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: HWFramesContext },
|
|
format: this.format,
|
|
swFormat: this.swFormat,
|
|
width: this.width,
|
|
height: this.height
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/frame.js
|
|
var require_frame = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/frame.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var ChannelLayout = require_channel_layout();
|
|
var HWFramesContext = require_hw_frames_context();
|
|
var Rational = require_rational();
|
|
var constants = require_constants();
|
|
module.exports = class FFmpegFrame {
|
|
constructor() {
|
|
this._handle = binding.initFrame();
|
|
}
|
|
destroy() {
|
|
binding.destroyFrame(this._handle);
|
|
this._handle = null;
|
|
}
|
|
unref() {
|
|
binding.unrefFrame(this._handle);
|
|
}
|
|
get width() {
|
|
return binding.getFrameWidth(this._handle);
|
|
}
|
|
set width(value) {
|
|
binding.setFrameWidth(this._handle, value);
|
|
}
|
|
get height() {
|
|
return binding.getFrameHeight(this._handle);
|
|
}
|
|
set height(value) {
|
|
binding.setFrameHeight(this._handle, value);
|
|
}
|
|
get format() {
|
|
return binding.getFrameFormat(this._handle);
|
|
}
|
|
set format(value) {
|
|
binding.setFrameFormat(this._handle, value);
|
|
}
|
|
get channelLayout() {
|
|
return new ChannelLayout(binding.getFrameChannelLayout(this._handle));
|
|
}
|
|
set channelLayout(value) {
|
|
binding.setFrameChannelLayout(this._handle, ChannelLayout.from(value)._handle);
|
|
}
|
|
get nbSamples() {
|
|
return binding.getFrameNbSamples(this._handle);
|
|
}
|
|
set nbSamples(value) {
|
|
binding.setFrameNbSamples(this._handle, value);
|
|
}
|
|
get pictType() {
|
|
return binding.getFramePictType(this._handle);
|
|
}
|
|
get pts() {
|
|
return binding.getFramePTS(this._handle);
|
|
}
|
|
set pts(value) {
|
|
return binding.setFramePTS(this._handle, value);
|
|
}
|
|
get packetDTS() {
|
|
return binding.getFramePacketDTS(this._handle);
|
|
}
|
|
set packetDTS(value) {
|
|
return binding.setFramePacketDTS(this._handle, value);
|
|
}
|
|
get timeBase() {
|
|
const view = new Int32Array(binding.getFrameTimeBase(this._handle));
|
|
return new Rational(view[0], view[1]);
|
|
}
|
|
set timeBase(value) {
|
|
binding.setFrameTimeBase(this._handle, value.numerator, value.denominator);
|
|
}
|
|
get sampleRate() {
|
|
return binding.getFrameSampleRate(this._handle);
|
|
}
|
|
set sampleRate(value) {
|
|
binding.setFrameSampleRate(this._handle, value);
|
|
}
|
|
get hwFramesCtx() {
|
|
const handle = binding.getFrameHWFramesCtx(this._handle);
|
|
return handle ? HWFramesContext.from(handle) : null;
|
|
}
|
|
set hwFramesCtx(hwFramesContext) {
|
|
binding.setFrameHWFramesCtx(this._handle, hwFramesContext._handle);
|
|
}
|
|
copyProperties(source) {
|
|
binding.copyFrameProperties(this._handle, source._handle);
|
|
}
|
|
transferData(destination) {
|
|
binding.transferFrameData(destination._handle, this._handle);
|
|
}
|
|
hwMap(destination, flags = constants.hwFrameMapFlags.NONE) {
|
|
binding.mapFrame(destination._handle, this._handle, flags);
|
|
}
|
|
alloc() {
|
|
binding.allocFrame(this._handle, 32);
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: FFmpegFrame },
|
|
width: this.width,
|
|
height: this.height,
|
|
format: this.format,
|
|
channelLayout: this.channelLayout,
|
|
nbSamples: this.nbSamples,
|
|
pictType: this.pictType,
|
|
pts: this.pts,
|
|
packetDTS: this.packetDTS,
|
|
timeBase: this.timeBase
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/image.js
|
|
var require_image = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/image.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var constants = require_constants();
|
|
module.exports = class FFmpegImage {
|
|
constructor(pixelFormat, width, height, align = 1) {
|
|
pixelFormat = constants.toPixelFormat(pixelFormat);
|
|
this._pixelFormat = pixelFormat;
|
|
this._width = width;
|
|
this._height = height;
|
|
this._align = align;
|
|
this._data = Buffer.from(binding.initImage(pixelFormat, width, height, align));
|
|
}
|
|
get pixelFormat() {
|
|
return this._pixelFormat;
|
|
}
|
|
get width() {
|
|
return this._width;
|
|
}
|
|
get height() {
|
|
return this._height;
|
|
}
|
|
get align() {
|
|
return this._align;
|
|
}
|
|
get data() {
|
|
return this._data;
|
|
}
|
|
fill(frame) {
|
|
binding.fillImage(
|
|
this._pixelFormat,
|
|
this._width,
|
|
this._height,
|
|
this._align,
|
|
this._data.buffer,
|
|
this._data.byteOffset,
|
|
frame._handle
|
|
);
|
|
}
|
|
read(frame) {
|
|
binding.readImage(
|
|
this._pixelFormat,
|
|
this._width,
|
|
this._height,
|
|
this._align,
|
|
this._data.buffer,
|
|
this._data.byteOffset,
|
|
frame._handle
|
|
);
|
|
}
|
|
lineSize(plane = 0) {
|
|
return binding.getImageLineSize(this._pixelFormat, this._width, plane);
|
|
}
|
|
static lineSize(pixelFormat, width, plane = 0) {
|
|
return binding.getImageLineSize(pixelFormat, width, plane);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/packet.js
|
|
var require_packet = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/packet.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var Rational = require_rational();
|
|
var SideData = require_side_data();
|
|
module.exports = class FFmpegPacket {
|
|
constructor(buffer) {
|
|
if (buffer) {
|
|
this._handle = binding.initPacketFromBuffer(
|
|
buffer.buffer,
|
|
buffer.byteOffset,
|
|
buffer.byteLength
|
|
);
|
|
} else {
|
|
this._handle = binding.initPacket();
|
|
}
|
|
}
|
|
destroy() {
|
|
binding.destroyPacket(this._handle);
|
|
this._handle = null;
|
|
}
|
|
unref() {
|
|
binding.unrefPacket(this._handle);
|
|
}
|
|
get streamIndex() {
|
|
return binding.getPacketStreamIndex(this._handle);
|
|
}
|
|
set streamIndex(value) {
|
|
return binding.setPacketStreamIndex(this._handle, value);
|
|
}
|
|
get data() {
|
|
return Buffer.from(binding.getPacketData(this._handle));
|
|
}
|
|
set data(value) {
|
|
binding.setPacketData(this._handle, value.buffer, value.byteOffset, value.byteLength);
|
|
}
|
|
get sideData() {
|
|
const handles = binding.getPacketSideData(this._handle);
|
|
return handles.map((handle) => new SideData(handle));
|
|
}
|
|
set sideData(values) {
|
|
binding.setPacketSideData(
|
|
this._handle,
|
|
values.map((value) => ({
|
|
buffer: value.data.buffer,
|
|
offset: value.data.byteOffset,
|
|
length: value.data.byteLength,
|
|
type: value.type
|
|
}))
|
|
);
|
|
}
|
|
get isKeyframe() {
|
|
return binding.isPacketKeyframe(this._handle);
|
|
}
|
|
set isKeyframe(value) {
|
|
binding.setPacketIsKeyFrame(this._handle, value);
|
|
}
|
|
get dts() {
|
|
return binding.getPacketDTS(this._handle);
|
|
}
|
|
set dts(value) {
|
|
return binding.setPacketDTS(this._handle, value);
|
|
}
|
|
get pts() {
|
|
return binding.getPacketPTS(this._handle);
|
|
}
|
|
set pts(value) {
|
|
return binding.setPacketPTS(this._handle, value);
|
|
}
|
|
get timeBase() {
|
|
const view = new Int32Array(binding.getPacketTimeBase(this._handle));
|
|
return new Rational(view[0], view[1]);
|
|
}
|
|
set timeBase(value) {
|
|
binding.setPacketTimeBase(this._handle, value.numerator, value.denominator);
|
|
}
|
|
rescaleTimestamps(srcTimeBase, dstTimeBase) {
|
|
return binding.rescalePacketTimestamps(
|
|
this._handle,
|
|
srcTimeBase.numerator,
|
|
srcTimeBase.denominator,
|
|
dstTimeBase.numerator,
|
|
dstTimeBase.denominator
|
|
);
|
|
}
|
|
copyPropsFrom(sourcePacket) {
|
|
binding.copyPacketProps(this._handle, sourcePacket._handle);
|
|
}
|
|
get duration() {
|
|
return binding.getPacketDuration(this._handle);
|
|
}
|
|
set duration(value) {
|
|
return binding.setPacketDuration(this._handle, value);
|
|
}
|
|
get flags() {
|
|
return binding.getPacketFlags(this._handle);
|
|
}
|
|
set flags(value) {
|
|
return binding.setPacketFlags(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: FFmpegPacket },
|
|
streamIndex: this.streamIndex,
|
|
flags: this.flags,
|
|
isKeyframe: this.isKeyframe,
|
|
timeBase: this.timeBase,
|
|
dts: this.dts,
|
|
pts: this.pts,
|
|
duration: this.duration,
|
|
data: this.data,
|
|
sideData: this.sideData
|
|
};
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
};
|
|
module.exports.SideData = SideData;
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/resampler.js
|
|
var require_resampler = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/resampler.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var ChannelLayout = require_channel_layout();
|
|
var FFmpegResampler = class {
|
|
constructor(inputSampleRate, inputChannelLayout, inputFormat, outputSampleRate, outputChannelLayout, outputFormat) {
|
|
inputChannelLayout = ChannelLayout.from(inputChannelLayout);
|
|
outputChannelLayout = ChannelLayout.from(outputChannelLayout);
|
|
this._inputSampleRate = inputSampleRate;
|
|
this._outputSampleRate = outputSampleRate;
|
|
this._handle = binding.initResampler(
|
|
inputSampleRate,
|
|
inputFormat,
|
|
inputChannelLayout._handle,
|
|
outputSampleRate,
|
|
outputFormat,
|
|
outputChannelLayout._handle
|
|
);
|
|
}
|
|
get inputSampleRate() {
|
|
return this._inputSampleRate;
|
|
}
|
|
get outputSampleRate() {
|
|
return this._outputSampleRate;
|
|
}
|
|
get delay() {
|
|
return binding.getResamplerDelay(this._handle, this._inputSampleRate);
|
|
}
|
|
convert(inputFrame, outputFrame) {
|
|
return binding.convertResampler(this._handle, inputFrame._handle, outputFrame._handle);
|
|
}
|
|
flush(outputFrame) {
|
|
return binding.flushResampler(this._handle, outputFrame._handle);
|
|
}
|
|
destroy() {
|
|
binding.destroyResampler(this._handle);
|
|
this._handle = null;
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
};
|
|
module.exports = FFmpegResampler;
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/samples.js
|
|
var require_samples = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/samples.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = class FFmpegSamples {
|
|
_data;
|
|
_frame;
|
|
constructor({ noAlignment = false } = {}) {
|
|
this._noAlignment = noAlignment;
|
|
}
|
|
get data() {
|
|
return this._data;
|
|
}
|
|
get format() {
|
|
return this._frame.format;
|
|
}
|
|
get channelLayout() {
|
|
return this._frame.channelLayout;
|
|
}
|
|
get nbSamples() {
|
|
return this._frame.nbSamples;
|
|
}
|
|
get nbChannels() {
|
|
return this.channelLayout && this.channelLayout.nbChannels;
|
|
}
|
|
get pts() {
|
|
return this._frame.pts;
|
|
}
|
|
fill(frame) {
|
|
const { format, channelLayout, nbSamples } = frame;
|
|
const len = FFmpegSamples.bufferSize(
|
|
format,
|
|
channelLayout.nbChannels,
|
|
nbSamples,
|
|
this._noAlignment
|
|
);
|
|
if (!this._data || len !== this._data.length) {
|
|
this._data = Buffer.allocUnsafe(len);
|
|
}
|
|
const res = binding.fillSamples(
|
|
frame._handle,
|
|
this._data.buffer,
|
|
this._data.byteOffset,
|
|
this._noAlignment
|
|
);
|
|
this._frame = frame;
|
|
return res;
|
|
}
|
|
read(frame) {
|
|
const { format, channelLayout, nbSamples } = frame;
|
|
const len = FFmpegSamples.bufferSize(
|
|
format,
|
|
channelLayout.nbChannels,
|
|
nbSamples,
|
|
this._noAlignment
|
|
);
|
|
if (!this._data || len !== this._data.length) {
|
|
this._data = Buffer.allocUnsafe(len);
|
|
}
|
|
binding.readSamples(frame._handle, this._data.buffer, this._data.byteOffset, this._noAlignment);
|
|
}
|
|
copy(frame, dstOffset = 0, srcOffset = 0) {
|
|
binding.copySamples(frame._handle, this._frame._handle, dstOffset, srcOffset, this.nbSamples);
|
|
}
|
|
static bufferSize(format, nbChannels, nbSamples, noAlignment = false) {
|
|
return binding.samplesBufferSize(format, nbChannels, nbSamples, noAlignment);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/scaler.js
|
|
var require_scaler = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/scaler.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var constants = require_constants();
|
|
module.exports = class FFmpegScaler {
|
|
constructor(sourcePixelFormat, sourceWidth, sourceHeight, targetPixelFormat, targetWidth, targetHeight) {
|
|
sourcePixelFormat = constants.toPixelFormat(sourcePixelFormat);
|
|
targetPixelFormat = constants.toPixelFormat(targetPixelFormat);
|
|
this._sourcePixelFormat = sourcePixelFormat;
|
|
this._sourceWidth = sourceWidth;
|
|
this._sourceHeight = sourceHeight;
|
|
this._targetPixelFormat = targetPixelFormat;
|
|
this._targetWidth = targetWidth;
|
|
this._targetHeight = targetHeight;
|
|
this._handle = binding.initScaler(
|
|
sourcePixelFormat,
|
|
sourceWidth,
|
|
sourceHeight,
|
|
targetPixelFormat,
|
|
targetWidth,
|
|
targetHeight
|
|
);
|
|
}
|
|
destroy() {
|
|
binding.destroyScaler(this._handle);
|
|
this._handle = null;
|
|
}
|
|
scale(source, y, height, target) {
|
|
if (typeof y !== "number") {
|
|
target = y;
|
|
y = 0;
|
|
height = source.height;
|
|
} else if (typeof height !== "number") {
|
|
target = height;
|
|
height = source.height;
|
|
}
|
|
return binding.scaleScaler(this._handle, source._handle, y, height, target._handle);
|
|
}
|
|
[Symbol.dispose]() {
|
|
this.destroy();
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/lib/log.js
|
|
var require_log = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/lib/log.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var constants = require_constants();
|
|
module.exports = {
|
|
...constants.logLevels
|
|
};
|
|
Object.defineProperty(module.exports, "level", {
|
|
get() {
|
|
return binding.getLogLevel();
|
|
},
|
|
set(level) {
|
|
return binding.setLogLevel(level);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg/index.js
|
|
var require_bare_ffmpeg = __commonJS({
|
|
"../../node_modules/bare-ffmpeg/index.js"(exports) {
|
|
var AudioFIFO = require_audio_fifo();
|
|
var ChannelLayout = require_channel_layout();
|
|
var Codec = require_codec();
|
|
var CodecContext = require_codec_context();
|
|
var CodecParameters = require_codec_parameters();
|
|
var Decoder = require_decoder();
|
|
var Dictionary = require_dictionary();
|
|
var Encoder = require_encoder();
|
|
var { InputFormatContext, OutputFormatContext } = require_format_context();
|
|
var Filter = require_filter();
|
|
var FilterContext = require_filter_context();
|
|
var FilterGraph = require_filter_graph();
|
|
var FilterInOut = require_filter_inout();
|
|
var Frame = require_frame();
|
|
var HWDeviceContext = require_hw_device_context();
|
|
var HWFramesContext = require_hw_frames_context();
|
|
var HWFramesConstraints = require_hw_frames_constraints();
|
|
var IOContext = require_io_context();
|
|
var Image = require_image();
|
|
var InputFormat = require_input_format();
|
|
var OutputFormat = require_output_format();
|
|
var Packet = require_packet();
|
|
var Rational = require_rational();
|
|
var Resampler = require_resampler();
|
|
var Samples = require_samples();
|
|
var Scaler = require_scaler();
|
|
var Stream = require_stream();
|
|
var log = require_log();
|
|
exports.AudioFIFO = AudioFIFO;
|
|
exports.ChannelLayout = ChannelLayout;
|
|
exports.Codec = Codec;
|
|
exports.CodecContext = CodecContext;
|
|
exports.CodecParameters = CodecParameters;
|
|
exports.Decoder = Decoder;
|
|
exports.Dictionary = Dictionary;
|
|
exports.Encoder = Encoder;
|
|
exports.Filter = Filter;
|
|
exports.FilterContext = FilterContext;
|
|
exports.FilterGraph = FilterGraph;
|
|
exports.FilterInOut = FilterInOut;
|
|
exports.Frame = Frame;
|
|
exports.HWDeviceContext = HWDeviceContext;
|
|
exports.HWFramesContext = HWFramesContext;
|
|
exports.HWFramesConstraints = HWFramesConstraints;
|
|
exports.IOContext = IOContext;
|
|
exports.Image = Image;
|
|
exports.InputFormat = InputFormat;
|
|
exports.InputFormatContext = InputFormatContext;
|
|
exports.OutputFormat = OutputFormat;
|
|
exports.OutputFormatContext = OutputFormatContext;
|
|
exports.Packet = Packet;
|
|
exports.Samples = Samples;
|
|
exports.Scaler = Scaler;
|
|
exports.Stream = Stream;
|
|
exports.Rational = Rational;
|
|
exports.Resampler = Resampler;
|
|
exports.log = log;
|
|
exports.constants = require_constants();
|
|
}
|
|
});
|
|
|
|
// ../../bare-lib-entry-bareFfmpegEncodings.js
|
|
var bare_lib_entry_bareFfmpegEncodings_exports = {};
|
|
__export(bare_lib_entry_bareFfmpegEncodings_exports, {
|
|
default: () => bare_lib_entry_bareFfmpegEncodings_default
|
|
});
|
|
|
|
// ../../node_modules/bare-ffmpeg-encodings/index.js
|
|
var bare_ffmpeg_encodings_exports = {};
|
|
__export(bare_ffmpeg_encodings_exports, {
|
|
copyStreamProperties: () => copyStreamProperties,
|
|
postdecodeCodecParameters: () => postdecodeCodecParameters,
|
|
postdecodePacket: () => postdecodePacket,
|
|
postdecodeRational: () => postdecodeRational,
|
|
postdecodeStream: () => postdecodeStream,
|
|
preencodeCodecParameters: () => preencodeCodecParameters,
|
|
preencodePacket: () => preencodePacket,
|
|
preencodeRational: () => preencodeRational,
|
|
preencodeStream: () => preencodeStream,
|
|
registerEncodings: () => registerEncodings
|
|
});
|
|
var import_bare_ffmpeg = __toESM(require_bare_ffmpeg(), 1);
|
|
|
|
// ../../node_modules/bare-ffmpeg-encodings/schema.js
|
|
function registerEncodings(schema) {
|
|
const template = schema.namespace("ffmpeg");
|
|
const compact = true;
|
|
template.register({
|
|
name: "rational",
|
|
compact,
|
|
fields: [
|
|
{ name: "numerator", type: "int", require: true },
|
|
{ name: "denominator", type: "int", require: true }
|
|
]
|
|
});
|
|
template.register({
|
|
name: "packet",
|
|
compact,
|
|
fields: [
|
|
{ name: "dts", type: "int", required: true },
|
|
{ name: "pts", type: "int", required: true },
|
|
{ name: "streamIndex", type: "int", required: true },
|
|
{ name: "flags", type: "int", require: true },
|
|
{ name: "duration", type: "int", require: true },
|
|
{ name: "sideData", type: "@ffmpeg/sidedata", array: true, require: true },
|
|
{ name: "data", type: "buffer", require: true }
|
|
]
|
|
});
|
|
template.register({
|
|
name: "sidedata",
|
|
compact,
|
|
fields: [
|
|
{ name: "type", type: "int", required: true },
|
|
{ name: "data", type: "buffer", required: true }
|
|
]
|
|
});
|
|
template.register({
|
|
name: "codecparameters",
|
|
compact,
|
|
fields: [
|
|
// Common
|
|
{ name: "id", type: "int", require: true },
|
|
{ name: "tag", type: "int", require: true },
|
|
{ name: "type", type: "int", require: true },
|
|
{ name: "format", type: "int", require: true },
|
|
{ name: "extraData", type: "buffer", require: false },
|
|
// Audio
|
|
{ name: "bitRate", type: "uint", require: false },
|
|
{ name: "bitsPerCodedSample", type: "uint", require: false },
|
|
{ name: "bitsPerRawSample", type: "uint", require: false },
|
|
{ name: "sampleRate", type: "uint", require: false },
|
|
{ name: "channelLayoutMask", type: "int", require: false },
|
|
{ name: "blockAlign", type: "int", require: false },
|
|
{ name: "nbChannels", type: "int", require: false },
|
|
{ name: "initialPadding", type: "int", require: false },
|
|
{ name: "trailingPadding", type: "int", require: false },
|
|
{ name: "seekPreroll", type: "int", require: false },
|
|
// Video
|
|
{ name: "frameRate", type: "@ffmpeg/rational", require: false },
|
|
{ name: "width", type: "uint", require: false },
|
|
{ name: "height", type: "uint", require: false },
|
|
{ name: "profile", type: "int", require: false },
|
|
{ name: "level", type: "int", require: false },
|
|
{ name: "sampleAspectRatio", type: "@ffmpeg/rational", require: false }
|
|
]
|
|
});
|
|
template.register({
|
|
name: "stream",
|
|
compact,
|
|
fields: [
|
|
{ name: "id", type: "int", require: true },
|
|
{ name: "index", type: "int", require: true },
|
|
{ name: "timeBase", type: "@ffmpeg/rational", require: true },
|
|
{ name: "avgFramerate", type: "@ffmpeg/rational", require: true },
|
|
{ name: "codecParameters", type: "@ffmpeg/codecparameters", require: true }
|
|
]
|
|
});
|
|
}
|
|
|
|
// ../../node_modules/bare-ffmpeg-encodings/index.js
|
|
var { mediaTypes } = import_bare_ffmpeg.default.constants;
|
|
function preencodePacket(packet) {
|
|
return {
|
|
streamIndex: packet.streamIndex,
|
|
dts: packet.dts,
|
|
pts: packet.pts,
|
|
duration: packet.duration,
|
|
flags: packet.flags,
|
|
sideData: packet.sideData.map((sd) => ({ type: sd.type, data: sd.data })),
|
|
data: packet.data
|
|
};
|
|
}
|
|
function postdecodePacket(obj, dst = new import_bare_ffmpeg.default.Packet()) {
|
|
dst.data = obj.data;
|
|
dst.streamIndex = obj.streamIndex;
|
|
dst.dts = obj.dts;
|
|
dst.pts = obj.pts;
|
|
dst.duration = obj.duration;
|
|
dst.flags = obj.flags;
|
|
const sideData = obj.sideData;
|
|
if (sideData && sideData.length) {
|
|
dst.sideData = sideData;
|
|
}
|
|
return dst;
|
|
}
|
|
function preencodeRational(rational) {
|
|
return {
|
|
numerator: rational.numerator,
|
|
denominator: rational.denominator
|
|
};
|
|
}
|
|
function postdecodeRational(obj, dst = new import_bare_ffmpeg.default.Rational()) {
|
|
dst.numerator = obj.numerator;
|
|
dst.denominator = obj.denominator;
|
|
return dst;
|
|
}
|
|
function preencodeCodecParameters(codecParameters) {
|
|
const { type } = codecParameters;
|
|
const out = {
|
|
id: codecParameters.id,
|
|
tag: codecParameters.tag,
|
|
type,
|
|
format: codecParameters.format,
|
|
extraData: codecParameters.extraData
|
|
};
|
|
switch (type) {
|
|
case mediaTypes.AUDIO:
|
|
Object.assign(out, {
|
|
bitRate: codecParameters.bitRate,
|
|
bitsPerCodedSample: codecParameters.bitsPerCodedSample,
|
|
bitsPerRawSample: codecParameters.bitsPerRawSample,
|
|
blockAlign: codecParameters.blockAlign,
|
|
sampleRate: codecParameters.sampleRate,
|
|
nbChannels: codecParameters.nbChannels,
|
|
channelLayoutMask: codecParameters.channelLayout.mask,
|
|
initialPadding: codecParameters.initialPadding,
|
|
trailingPadding: codecParameters.trailingPadding,
|
|
seekPreroll: codecParameters.seekPreroll
|
|
});
|
|
break;
|
|
case mediaTypes.VIDEO:
|
|
Object.assign(out, {
|
|
width: codecParameters.width,
|
|
height: codecParameters.height,
|
|
profile: codecParameters.profile,
|
|
level: codecParameters.level,
|
|
frameRate: preencodeRational(codecParameters.frameRate),
|
|
sampleAspectRatio: preencodeRational(codecParameters.sampleAspectRatio)
|
|
});
|
|
break;
|
|
case mediaTypes.UNKNOWN:
|
|
throw new Error("refusing to encode empty codec-parameters");
|
|
default:
|
|
throw new Error("unsupported codecparameters type:" + type);
|
|
}
|
|
return out;
|
|
}
|
|
function postdecodeCodecParameters(obj, dst = import_bare_ffmpeg.default.CodecParameters.alloc()) {
|
|
dst.id = obj.id;
|
|
dst.tag = obj.tag;
|
|
dst.type = obj.type;
|
|
dst.format = obj.format;
|
|
const extraData = obj.extraData;
|
|
if (extraData) dst.extraData = extraData;
|
|
switch (obj.type) {
|
|
case mediaTypes.AUDIO:
|
|
dst.blockAlign = obj.blockAlign;
|
|
dst.bitRate = obj.bitRate;
|
|
dst.bitsPerCodedSample = obj.bitsPerCodedSample;
|
|
dst.bitsPerRawSample = obj.bitsPerRawSample;
|
|
dst.sampleRate = obj.sampleRate;
|
|
dst.nbChannels = obj.nbChannels;
|
|
dst.channelLayout = obj.channelLayoutMask;
|
|
dst.initialPadding = obj.initialPadding;
|
|
dst.trailingPadding = obj.trailingPadding;
|
|
dst.seekPreroll = obj.seekPreroll;
|
|
break;
|
|
case mediaTypes.VIDEO:
|
|
dst.width = obj.width;
|
|
dst.height = obj.height;
|
|
dst.profile = obj.profile;
|
|
dst.level = obj.level;
|
|
dst.frameRate = postdecodeRational(obj.frameRate);
|
|
dst.sampleAspectRatio = postdecodeRational(obj.sampleAspectRatio);
|
|
break;
|
|
}
|
|
return dst;
|
|
}
|
|
function preencodeStream(stream) {
|
|
return {
|
|
id: stream.id,
|
|
index: stream.index,
|
|
timeBase: preencodeRational(stream.timeBase),
|
|
avgFramerate: preencodeRational(stream.avgFramerate),
|
|
codecParameters: preencodeCodecParameters(stream.codecParameters)
|
|
};
|
|
}
|
|
function postdecodeStream(obj, dst, updateStreamIndex = true) {
|
|
dst ||= {};
|
|
dst.id = obj.id;
|
|
if (updateStreamIndex) dst.index = obj.index;
|
|
dst.timeBase = postdecodeRational(obj.timeBase);
|
|
dst.avgFramerate = postdecodeRational(obj.avgFramerate);
|
|
if (dst.codecParameters) {
|
|
postdecodeCodecParameters(obj.codecParameters, dst.codecParameters);
|
|
} else {
|
|
dst.codecParameters = postdecodeCodecParameters(obj.codecParameters);
|
|
}
|
|
return dst;
|
|
}
|
|
function copyStreamProperties(src, dst, updateStreamIndex = true) {
|
|
postdecodeStream(
|
|
preencodeStream(src),
|
|
dst,
|
|
updateStreamIndex
|
|
);
|
|
}
|
|
|
|
// ../../bare-lib-entry-bareFfmpegEncodings.js
|
|
var bare_lib_entry_bareFfmpegEncodings_default = bare_ffmpeg_encodings_exports;
|
|
return __toCommonJS(bare_lib_entry_bareFfmpegEncodings_exports);
|
|
})();
|
|
;(function(){var g=globalThis;var s="__bare_os_stdlib__";g[s]=g[s]||{};g[s]["bareFfmpegEncodings"]=typeof __bare_os_bundle_exports__!=="undefined"?__bare_os_bundle_exports__:void 0;})();
|