@vpalmisano/webrtcperf 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +296 -0
  3. package/app.min.js +2 -0
  4. package/build/src/app.d.ts +6 -0
  5. package/build/src/app.js +207 -0
  6. package/build/src/app.js.map +1 -0
  7. package/build/src/config.d.ts +104 -0
  8. package/build/src/config.js +880 -0
  9. package/build/src/config.js.map +1 -0
  10. package/build/src/generate-config-docs.d.ts +1 -0
  11. package/build/src/generate-config-docs.js +41 -0
  12. package/build/src/generate-config-docs.js.map +1 -0
  13. package/build/src/index.d.ts +9 -0
  14. package/build/src/index.js +26 -0
  15. package/build/src/index.js.map +1 -0
  16. package/build/src/media.d.ts +33 -0
  17. package/build/src/media.js +113 -0
  18. package/build/src/media.js.map +1 -0
  19. package/build/src/rtcstats.d.ts +302 -0
  20. package/build/src/rtcstats.js +418 -0
  21. package/build/src/rtcstats.js.map +1 -0
  22. package/build/src/server.d.ts +173 -0
  23. package/build/src/server.js +639 -0
  24. package/build/src/server.js.map +1 -0
  25. package/build/src/session.d.ts +277 -0
  26. package/build/src/session.js +1552 -0
  27. package/build/src/session.js.map +1 -0
  28. package/build/src/stats.d.ts +243 -0
  29. package/build/src/stats.js +1383 -0
  30. package/build/src/stats.js.map +1 -0
  31. package/build/src/utils.d.ts +249 -0
  32. package/build/src/utils.js +1220 -0
  33. package/build/src/utils.js.map +1 -0
  34. package/build/src/visqol.d.ts +6 -0
  35. package/build/src/visqol.js +61 -0
  36. package/build/src/visqol.js.map +1 -0
  37. package/build/src/vmaf.d.ts +83 -0
  38. package/build/src/vmaf.js +624 -0
  39. package/build/src/vmaf.js.map +1 -0
  40. package/build/tsconfig.tsbuildinfo +1 -0
  41. package/package.json +129 -0
  42. package/src/app.ts +241 -0
  43. package/src/config.ts +852 -0
  44. package/src/generate-config-docs.ts +47 -0
  45. package/src/index.ts +9 -0
  46. package/src/media.ts +151 -0
  47. package/src/rtcstats.ts +507 -0
  48. package/src/server.ts +645 -0
  49. package/src/session.ts +1908 -0
  50. package/src/stats.ts +1668 -0
  51. package/src/utils.ts +1295 -0
  52. package/src/visqol.ts +62 -0
  53. package/src/vmaf.ts +771 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqzBA,sCAEC;AAWD,gCAiBC;AAn1BD,mDAA6C;AAC7C,iFAA8D;AAC9D,2BAA+B;AAC/B,4CAAmB;AACnB,+BAA2B;AAE3B,iEAAiE;AACjE,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE3C,mCAAgC;AAChC,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,mBAAmB,CAAC,CAAA;AAEvC,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAS,EAAE,EAAE;QACtB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;IACjE,CAAC;CACF,CAAA;AAED,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC;IACzB,QAAQ,EAAE,CAAC,CAA4B,EAAE,EAAE;QACzC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,EAAE;gBAAE,OAAM;YACrD,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpB,CAAC,CAA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,OAAO,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,SAAS,EAAE,CAAC,CAAA;AACvD,CAAC;AAED,MAAM,iBAAiB,GAAG,YAAY,CAAC,aAAa,EAAE,CAAA;AAKtD;;GAEG;AACH,8DAA8D;AAC9D,SAAgB,UAAU,CAAC,QAAiB,EAAE,MAAY;IACxD,IAAI,QAAQ,IAAI,IAAA,eAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,KAAK,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAA;QAC5C,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;SAAM,IAAI,MAAM,EAAE,CAAC;QAClB,GAAG,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;QACxC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;QAClC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACvB,CAAC;IAED,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC5C,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,EAAE,CAAA;IAE3C,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;IAClC,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import convict, { addFormats } from 'convict'\nimport { ipaddress, url } from 'convict-format-with-validator'\nimport { existsSync } from 'fs'\nimport os from 'os'\nimport { join } from 'path'\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports\nconst puppeteer = require('puppeteer-core')\n\nimport { logger } from './utils'\nconst log = logger('webrtcperf:config')\n\nconst float = {\n name: 'float',\n coerce: (v: string) => parseFloat(v),\n validate: (v: number) => {\n if (!Number.isFinite(v)) throw new Error(`Invalid float: ${v}`)\n },\n}\n\nconst index = {\n name: 'index',\n coerce: (v: unknown) => v,\n validate: (v: boolean | string | number) => {\n if (typeof v === 'string') {\n if (v === 'true' || v === 'false' || v === '') return\n if (v.includes('-')) {\n v.split('-').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (v.includes(',')) {\n v.split(',').forEach(n => {\n if (isNaN(parseInt(n)) || !isFinite(parseInt(n))) throw new Error(`Invalid string index: ${n}`)\n })\n return\n }\n if (isNaN(parseInt(v)) || !isFinite(parseInt(v))) throw new Error(`Invalid string index: ${v}`)\n return\n } else if (typeof v === 'number' || typeof v === 'boolean') {\n return\n }\n throw new Error(`Invalid index: \"${v}\" (type: ${typeof v})`)\n },\n}\n\naddFormats({ ipaddress, url, float, index })\n\n// config schema\nconst configSchema = convict({\n url: {\n doc: `The page url to load.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL',\n arg: 'url',\n },\n urlQuery: {\n doc: `The query string to append to the page url; the following template \\\nvariables are replaced: \\`$p\\` the process pid, \\`$s\\` the session index, \\\n\\`$S\\` the total sessions, \\`$t\\` the tab index, \\`$T\\` the total tabs per \\\nsession, \\`$i\\` the tab absolute index.`,\n format: String,\n default: '',\n nullable: true,\n env: 'URL_QUERY',\n arg: 'url-query',\n },\n customUrlHandler: {\n doc: `This argument specifies the file path for the custom page URL handler that will be exported by default. \\\nThe custom page URL handler allows you to define custom URLs that can be used to open your application, \\\nand provides the following variables for customization: \\`$p\\`: the process pid, \\`$s\\`: the session index, \\\n\\`$S\\`: the total sessions, \\`$t\\`: the tab index, \\`$T\\`: the total tabs per session, \\`$i\\`: the tab absolute index.\nYou can use these variables to create custom URL schemes that suit your application's needs.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CUSTOM_URL_HANDLER',\n arg: 'custom-url-handler',\n },\n // fake video/audio\n videoPath: {\n doc: `The fake video path; if set, the video will be used as fake \\\nmedia source. It accepts a single path or a comma-separated list of videos \\\npaths that will be used in round-robin by the started sessions. \\\nThe docker pre-built image contains a 2 minutes video sequence stored at \\\n\\`/app/video.mp4\\`. \\\nIt accepts a local file, an http endpoint or a string starting with\n\\`generate:\\` (example: \\`generate:null\\` will generate a black video with \\\nsilent audio). \\\nThe temporary files containing the raw video and audio will be stored at \\\n\\`\\${VIDEO_CACHE_PATH}/video.\\${VIDEO_FORMAT}\\` and \\\n\\`\\${VIDEO_CACHE_PATH}/audio.wav\\`.`,\n format: String,\n default: 'https://github.com/vpalmisano/webrtcperf/releases/download/v2.0.4/video.mp4',\n env: 'VIDEO_PATH',\n arg: 'video-path',\n },\n videoWidth: {\n doc: `The fake video resize width.`,\n format: 'nat',\n default: 1280,\n env: 'VIDEO_WIDTH',\n arg: 'video-width',\n },\n videoHeight: {\n doc: `The fake video resize height.`,\n format: 'nat',\n default: 720,\n env: 'VIDEO_HEIGHT',\n arg: 'video-height',\n },\n videoFramerate: {\n doc: `The fake video framerate.`,\n format: 'nat',\n default: 25,\n env: 'VIDEO_FRAMERATE',\n arg: 'video-framerate',\n },\n videoSeek: {\n doc: `The fake audio/video seek position in seconds.`,\n format: 'nat',\n default: 0,\n env: 'VIDEO_SEEK',\n arg: 'video-seek',\n },\n videoDuration: {\n doc: `The fake audio/video duration in seconds.`,\n format: 'nat',\n default: 120,\n env: 'VIDEO_DURATION',\n arg: 'video-duration',\n },\n videoCacheRaw: {\n doc: `If the temporary video and audio raw files can be reused across \\\nmultiple runs.`,\n format: 'Boolean',\n default: true,\n env: 'VIDEO_CACHE_RAW',\n arg: 'video-cache-raw',\n },\n videoCachePath: {\n doc: `The path where the video and audio raw files are stored.`,\n format: String,\n default: join(os.homedir(), '.webrtcperf/cache'),\n env: 'VIDEO_CACHE_PATH',\n arg: 'video-cache-path',\n },\n videoFormat: {\n doc: `The fake video file format presented to the browser.`,\n format: ['y4m', 'mjpeg'],\n default: 'y4m',\n env: 'VIDEO_FORMAT',\n arg: 'video-format',\n },\n useFakeMedia: {\n doc: `If true, the audio/video/screenshare will be generated using the browser fake device.\nOtherwise, the audio and video streams will be captured from a video element attached to the page, \nwhile the screenshare will be captured from a new browser tab.`,\n format: 'Boolean',\n default: true,\n env: 'USE_FAKE_MEDIA',\n arg: 'use-fake-media',\n },\n //\n runDuration: {\n doc: `If greater than 0, the test will stop after the provided number of \\\nseconds.`,\n format: 'nat',\n default: 0,\n env: 'RUN_DURATION',\n arg: 'run-duration',\n },\n throttleConfig: {\n doc: `A JSON5 string with a valid throtter configuration (https://github.com/vpalmisano/throttler).`,\n format: String,\n nullable: true,\n default: '',\n env: 'THROTTLE_CONFIG',\n arg: 'throttle-config',\n },\n randomAudioPeriod: {\n doc: `If not zero, it specifies the maximum period in seconds after which \\\na new random active tab is selected, enabling the getUserMedia audio tracks in \\\nthat tab and disabling all of the other tabs.`,\n format: 'nat',\n default: 0,\n env: 'RANDOM_AUDIO_PERIOD',\n arg: 'random-audio-period',\n },\n randomAudioProbability: {\n doc: `When using random audio period, it defines the probability % that \\\nthe selected audio will be activated (value: 0-100).`,\n format: 'nat',\n default: 100,\n env: 'RANDOM_AUDIO_PROBABILITY',\n arg: 'random-audio-probability',\n },\n randomAudioRange: {\n doc: `When using random audio period, it defines the number of pages \\\nto be included into the random selection.`,\n format: 'nat',\n default: 0,\n env: 'RANDOM_AUDIO_RANGE',\n arg: 'random-audio-range',\n },\n // Session config\n chromiumPath: {\n doc: `The Chromium executable path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_PATH',\n arg: 'chromium-path',\n },\n chromiumVersion: {\n doc: `The Chromium version. It will be downloaded if the chromium \\\npath is not provided.`,\n format: String,\n nullable: false,\n default: puppeteer.PUPPETEER_REVISIONS.chrome,\n env: 'CHROMIUM_VERSION',\n arg: 'chromium-version',\n },\n chromiumUrl: {\n doc: `The remote Chromium URL (\\`http://HOST:PORT\\`).\nIf provided, the remote instance will be used instead of running a local\nchromium process.`,\n format: String,\n default: '',\n nullable: true,\n env: 'CHROMIUM_URL',\n arg: 'chromium-url',\n },\n chromiumFieldTrials: {\n doc: `Chromium additional field trials.`,\n format: String,\n nullable: true,\n default: '',\n env: 'CHROMIUM_FIELD_TRIALS',\n arg: 'chromium-field-trials',\n },\n windowWidth: {\n doc: `The browser window width.`,\n format: 'nat',\n default: 1920,\n env: 'WINDOW_WIDTH',\n arg: 'window-width',\n },\n windowHeight: {\n doc: `The browser window height.`,\n format: 'nat',\n default: 1080,\n env: 'WINDOW_HEIGHT',\n arg: 'window-height',\n },\n deviceScaleFactor: {\n doc: `The browser device scale factor.`,\n format: 'float',\n default: 1,\n env: 'DEVICE_SCALE_FACTOR',\n arg: 'device-scale-factor',\n },\n maxVideoDecoders: {\n doc: `Specifies the maximum number of concurrent WebRTC video decoder \\\ninstances that can be created on the same host.\nIf set it will disable the received video resolution and jitter buffer stats. \\\nThis option is supported only when using the custom chromium build. \\\nThe total decoders count is stored into the virtual file \\`/dev/shm/chromium-video-decoders\\``,\n format: Number,\n default: -1,\n env: 'MAX_VIDEO_DECODERS',\n arg: 'max-video-decoders',\n },\n maxVideoDecodersAt: {\n doc: `Applies the maxVideoDecoders option starting from this session \\`ID\\`.`,\n format: Number,\n default: -1,\n env: 'MAX_VIDEO_DECODERS_AT',\n arg: 'max-video-decoders-at',\n },\n incognito: {\n doc: `Runs the browser in incognito mode.`,\n format: 'Boolean',\n default: false,\n env: 'INCOGNITO',\n arg: 'incognito',\n },\n display: {\n doc: `If unset, the browser will run in headless mode.\nWhen running on MacOS or Windows, set it to any not-empty string.\nOn Linux, set it to a valid X server \\`DISPLAY\\` string (e.g. \\`:0\\`).`,\n format: String,\n default: '',\n nullable: true,\n env: 'DISPLAY',\n arg: 'display',\n },\n /* audioRedForOpus: {\n doc: `Enables RED for OPUS codec (experimental).`,\n format: 'Boolean',\n default: false,\n env: 'AUDIO_RED_FOR_OPUS',\n arg: 'audio-red-for-opus',\n }, */\n sessions: {\n doc: `The number of browser sessions to start.`,\n format: 'nat',\n default: 1,\n env: 'SESSIONS',\n arg: 'sessions',\n },\n tabsPerSession: {\n doc: `The number of tabs to open in each browser session.`,\n format: 'nat',\n default: 1,\n env: 'TABS_PER_SESSION',\n arg: 'tabs-per-session',\n },\n startSessionId: {\n doc: `The starting ID assigned to sessions.`,\n format: 'nat',\n default: 0,\n env: 'START_SESSION_ID',\n arg: 'start-session-id',\n },\n startTimestamp: {\n doc: `The start timestamp (in milliseconds). If 0, the value will be \\\ncalculated using \\`Date.now()\\``,\n format: 'nat',\n default: 0,\n env: 'START_TIMESTAMP',\n arg: 'start-timestamp',\n },\n enableDetailedStats: {\n doc: `If detailed participant metrics values should be collected.`,\n format: 'index',\n default: '',\n nullable: true,\n env: 'ENABLE_DETAILED_STATS',\n arg: 'enable-detailed-stats',\n },\n spawnRate: {\n doc: `The pages spawn rate (pages/s).`,\n format: 'float',\n default: 1,\n env: 'SPAWN_RATE',\n arg: 'spawn-rate',\n },\n showPageLog: {\n doc: `If \\`true\\`, the pages console logs will be shown on console.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_PAGE_LOG',\n arg: 'show-page-log',\n },\n pageLogFilter: {\n doc: `If set, only the logs with the matching text will be printed \\\non console. Regexp string allowed.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_FILTER',\n arg: 'page-log-filter',\n },\n pageLogPath: {\n doc: `If set, page console logs will be saved on the selected file path.`,\n format: String,\n default: '',\n nullable: true,\n env: 'PAGE_LOG_PATH',\n arg: 'page-log-path',\n },\n userAgent: {\n doc: `The user agent override.`,\n format: String,\n default: '',\n nullable: true,\n env: 'USER_AGENT',\n arg: 'user-agent',\n },\n scriptPath: {\n doc: `One or more JavaScript file paths (comma-separated). \\\nIf set, the files contents will be executed inside each opened tab page; \\\nthe following global variables will be attached to the \\`webrtcperf\\` global object: \\\n\\`WEBRTC_PERF_SESSION\\` the session number (0-indexed); \\\n\\`WEBRTC_PERF_TAB\\` the tab number inside the same session (0-indexed); \\\n\\`WEBRTC_PERF_INDEX\\` the page absolute index (0-indexed). \\\n`,\n format: String,\n default: '',\n env: 'SCRIPT_PATH',\n arg: 'script-path',\n },\n scriptParams: {\n doc: `Additional parameters (in JSON format) that will be exposed into\nthe page context as \\`webrtcperf.params\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SCRIPT_PARAMS',\n arg: 'script-params',\n },\n disabledVideoCodecs: {\n doc: `A string with the video codecs to disable (comma-separated); e.g. \\`vp9,av1\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'DISABLED_VIDEO_CODECS',\n arg: 'disabled-video-codecs',\n },\n localStorage: {\n doc: `A JSON string with the \\`localStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'LOCAL_STORAGE',\n arg: 'local-storage',\n },\n sessionStorage: {\n doc: `A JSON string with the \\`sessionStorage\\` object to be set on page \\\nload.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SESSION_STORAGE',\n arg: 'session-storage',\n },\n clearCookies: {\n doc: `If true, all the page cookies are cleared.`,\n format: 'Boolean',\n default: false,\n env: 'CLEAR_COOKIES',\n arg: 'clear-cookies',\n },\n enableGpu: {\n doc: `It enables the GPU acceleration (experimental). Set to \"desktop\" to \\\nuse the host X server instance.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ENABLE_GPU',\n arg: 'enable-gpu',\n },\n enableBrowserLogging: {\n doc: `It enables the Chromium browser logging for the specified session indexes.`,\n format: 'index',\n nullable: true,\n default: '',\n env: 'ENABLE_BROWSER_LOGGING',\n arg: 'enable-browser-logging',\n },\n blockedUrls: {\n doc: `A comma-separated list of request URLs that will be automatically \\\nblocked.`,\n format: String,\n nullable: true,\n default: '',\n env: 'BLOCKED_URLS',\n arg: 'blocked-urls',\n },\n extraHeaders: {\n doc: `A dictionary of headers keyed by the url in JSON5 format (e.g. \\\n\\`{ \"https://url.com/*\": { \"header-name\": \"value\" } }\\`).`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_HEADERS',\n arg: 'extra-headers',\n },\n responseModifiers: {\n doc: `A dictionary of content replacements keyed by the url in JSON5 format.\nExamples:\n- replace strings using a regular expression:\n \\`{ \"https://url.com/*\": [{ search: \"searchString\": replace: \"anotherString\" }] }\\`\n- completely replace the content:\n \\`{ \"https://url.com/file.js\": [{ file: \"path/to/newFile.js\" }] }\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'RESPONSE_MODIFIERS',\n arg: 'response-modifiers',\n },\n downloadResponses: {\n doc: `An array of url responses that will be saved to the disk, keyed by the url in JSON5 format.\nExample: \\`[{ urlPattern: \"https://url.com/*\", output: \"save/directory\" }]\\`\n`,\n format: String,\n nullable: true,\n default: '',\n env: 'DOWNLOAD_RESPONSES',\n arg: 'download-responses',\n },\n extraCSS: {\n doc: `A string with a CSS styles to inject into each page. \\\nRules containing \"important\" will be replaced with \"!important\".`,\n format: String,\n nullable: true,\n default: '',\n env: 'EXTRA_CSS',\n arg: 'extra-css',\n },\n cookies: {\n doc: `A string with an array of [CookieParam](https://pptr.dev/api/puppeteer.cookieparam) to set into each page in JSON5 format.`,\n format: String,\n nullable: true,\n default: '',\n env: 'COOKIES',\n arg: 'cookies',\n },\n overridePermissions: {\n doc: `A comma-separated list of permissions to grant to the opened url.`,\n format: String,\n nullable: true,\n default: '',\n env: 'OVERRIDE_PERMISSIONS',\n arg: 'override-permissions',\n },\n hardwareConcurrency: {\n doc: `When set, it overrides the navigator.hardwareConcurrency property.`,\n format: 'nat',\n default: 0,\n env: 'HARDWARE_CONCURRENCY',\n arg: 'hardware-concurrency',\n },\n debuggingPort: {\n doc: `The chrome debugging port. If this value != 0, the chrome instance \\\nwill listen on the provided port + the start-session-id value.`,\n format: 'nat',\n default: 0,\n env: 'DEBUGGING_PORT',\n arg: 'debugging-port',\n },\n debuggingAddress: {\n doc: `The chrome debugging listening address. If unset, the network default interface address will be used.`,\n format: String,\n nullable: true,\n default: '127.0.0.1',\n env: 'DEBUGGING_ADDRESS',\n arg: 'debugging-address',\n },\n // stats config\n showStats: {\n doc: `If the statistics should be displayed on the console output.`,\n format: 'Boolean',\n default: true,\n env: 'SHOW_STATS',\n arg: 'show-stats',\n },\n statsPath: {\n doc: `The log file path; if set, the stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'STATS_PATH',\n arg: 'stats-path',\n },\n detailedStatsPath: {\n doc: `The log file path; if set, the detailed stats will be written in \\\na .csv file inside that file.`,\n format: String,\n default: '',\n env: 'DETAILED_STATS_PATH',\n arg: 'detailed-stats-path',\n },\n statsInterval: {\n doc: `The stats collect interval in seconds. It should be lower than the \\\nPrometheus scraping interval.`,\n format: 'nat',\n default: 15,\n env: 'STATS_INTERVAL',\n arg: 'stats-interval',\n },\n rtcStatsTimeout: {\n doc: `The timeout in seconds after which the RTC stats coming from inactive\\\n hosts are removed. It should be higher than the \\`statsInterval\\` value.`,\n format: 'nat',\n default: 60,\n env: 'RTC_STATS_TIMEOUT',\n arg: 'rtc-stats-timeout',\n },\n customMetrics: {\n doc: `A dictionary of custom metrics keys in JSON5 format (e.g. \\\n'{ statName1: { labels: [\"label1\"] } }').`,\n format: String,\n nullable: true,\n default: '',\n env: 'CUSTOM_METRICS',\n arg: 'custom-metrics',\n },\n //\n prometheusPushgateway: {\n doc: `If set, logs are sent to the specified Prometheus Pushgateway \\\nservice (example: \"http://127.0.0.1:9091\").`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY',\n arg: 'prometheus-pushgateway',\n },\n prometheusPushgatewayJobName: {\n doc: `The Prometheus Pushgateway job name.`,\n format: 'String',\n default: 'default',\n env: 'PROMETHEUS_PUSHGATEWAY_JOB_NAME',\n arg: 'prometheus-pushgateway-job-name',\n },\n prometheusPushgatewayAuth: {\n doc: `The Prometheus Pushgateway basic auth (username:password).`,\n format: 'String',\n default: '',\n nullable: true,\n env: 'PROMETHEUS_PUSHGATEWAY_AUTH',\n arg: 'prometheus-pushgateway-auth',\n },\n prometheusPushgatewayGzip: {\n doc: `Allows to use gzip encoded pushgateway requests.`,\n format: 'Boolean',\n default: true,\n env: 'PROMETHEUS_PUSHGATEWAY_GZIP',\n arg: 'prometheus-pushgateway-gzip',\n },\n //\n alertRules: {\n doc: `Alert rules definition (in JSON format).`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES',\n arg: 'alert-rules',\n },\n alertRulesFilename: {\n doc: `The alert rules report output filename.`,\n format: String,\n nullable: true,\n default: '',\n env: 'ALERT_RULES_FILENAME',\n arg: 'alert-rules-filename',\n },\n alertRulesFailPercentile: {\n doc: `The alert rules report fails percentile (0-100). With the default value the \\\nalert will be successful only when at least 95% of the checks pass.`,\n format: 'nat',\n nullable: false,\n default: 95,\n env: 'ALERT_RULES_FAIL_PERCENTILE',\n arg: 'alert-rules-fail-percentile',\n },\n pushStatsUrl: {\n doc: `The URL to push the collected stats.`,\n format: String,\n nullable: true,\n default: '',\n env: 'PUSH_STATS_URL',\n arg: 'push-stats-url',\n },\n pushStatsId: {\n doc: `The ID of the collected stats to push.`,\n format: String,\n nullable: true,\n default: 'default',\n env: 'PUSH_STATS_ID',\n arg: 'push-stats-id',\n },\n // server config\n serverPort: {\n doc: `The HTTP server listening port.`,\n format: 'nat',\n nullable: true,\n default: 0,\n env: 'SERVER_PORT',\n arg: 'server-port',\n },\n serverSecret: {\n doc: `The HTTP server basic auth secret. The auth user name is set to \\`admin\\` by default.`,\n format: String,\n default: 'secret',\n env: 'SERVER_SECRET',\n arg: 'server-secret',\n },\n serverUseHttps: {\n doc: `If true, the server will use the HTTPS protocol.`,\n format: 'Boolean',\n default: false,\n env: 'SERVER_USE_HTTPS',\n arg: 'server-use-https',\n },\n serverData: {\n doc: `An optional path that the HTTP server will expose with the /data endpoint.`,\n format: String,\n nullable: true,\n default: '',\n env: 'SERVER_DATA',\n arg: 'server-data',\n },\n // VMAF config\n vmafPath: {\n doc: `When set, it runs the VMAF calculator for the video files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PATH',\n arg: 'vmaf-path',\n },\n vmafPreview: {\n doc: `If true, for each VMAF comparison it creates a side-by-side video with \\\nthe reference and degraded versions.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_PREVIEW',\n arg: 'vmaf-preview',\n },\n vmafKeepIntermediateFiles: {\n doc: `If true, the VMAF intermediate files will not be deleted.`,\n format: 'Boolean',\n default: false,\n env: 'VMAF_KEEP_INTERMEDIATE_FILES',\n arg: 'vmaf-keep-intermediate-files',\n },\n vmafKeepSourceFiles: {\n doc: `If true, the VMAF source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VMAF_KEEP_SOURCE_FILES',\n arg: 'vmaf-keep-source-files',\n },\n vmafCrop: {\n doc: `If set, the reference and degraded videos will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ \"Participant-000001_recv-by_Participant-000000': { ref: { w: \"iw-10\", h: \"ih-5\" }, deg: { w: \"200\", h: \"200\" } } }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_CROP',\n arg: 'vmaf-crop',\n },\n vmafPrepareVideo: {\n doc: `When set, it prepares the selected video applying a timestamp overlay on top of it. \\\nThe filename must be provided in the format \\`<video path>,<ID>\\`, where the selected ID will be used unique video identifier in the overlay.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PREPARE_VIDEO',\n arg: 'vmaf-prepare-video',\n },\n vmafProcessVideo: {\n doc: `When set, it runs the VMAF video preprocessor, that converts a video file into the IVF format with timestamps matching the overlay recognition. \\\nThe filename must contain a \\`recv\\` or \\`send\\` string to identify if the video was a reference (send) or a degraded version (recv), e.g. \\`Participant1_recv.mp4\\`.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_PROCESS_VIDEO',\n arg: 'vmaf-process-video',\n },\n vmafVideoCrop: {\n doc: `If set, the vmaf prepared/processed video will be cropped using the specified configuration in JSON5 format. \\\nCrop configuration should be expressed using the ffmpeg crop filter syntax (https://ffmpeg.org/ffmpeg-filters.html#crop). \\\nE.g. \\`{ w: \"iw-10\", h: \"ih-5\", x: \"10\", y: '5' }\\``,\n format: String,\n nullable: true,\n default: '',\n env: 'VMAF_VIDEO_CROP',\n arg: 'vmaf-video-crop',\n },\n // VISQOL config\n visqolPath: {\n doc: `When set, it runs the visqol calculator for the audio files saved under the provided directory path.`,\n format: String,\n nullable: true,\n default: '',\n env: 'VISQOL_PATH',\n arg: 'visqol-path',\n },\n visqolKeepSourceFiles: {\n doc: `If true, the visqol source files will not be deleted.`,\n format: 'Boolean',\n default: true,\n env: 'VISQOL_KEEP_SOURCE_FILES',\n arg: 'visqol-keep-source-files',\n },\n})\n\ntype ConfigDocs = Record<string, { doc: string; format: string; default: string }>\n\n/**\n * Formats the schema documentation, calling the same function recursively.\n * @param docs the documentation object to extend\n * @param property the root property\n * @param schema the config schema fragment\n * @return the documentation object\n */\nfunction formatDocs(\n docs: ConfigDocs,\n property: string | null,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: any,\n): ConfigDocs {\n if (schema._cvtProperties) {\n Object.entries(schema._cvtProperties).forEach(([name, value]) => {\n formatDocs(docs, `${property ? `${property}.` : ''}${name}`, value)\n })\n return docs\n }\n\n if (property) {\n docs[property] = {\n doc: schema.doc,\n format: JSON.stringify(schema.format, null, 2),\n default: JSON.stringify(schema.default, null, 2),\n }\n }\n return docs\n}\n\n/**\n * It returns the formatted configuration docs.\n */\nexport function getConfigDocs(): ConfigDocs {\n return formatDocs({}, null, configSchema.getSchema())\n}\n\nconst _schemaProperties = configSchema.getProperties()\n\n/** [[include:config.md]] */\nexport type Config = typeof _schemaProperties\n\n/**\n * Loads the config object.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function loadConfig(filePath?: string, values?: any): Config {\n if (filePath && existsSync(filePath)) {\n log.debug(`Loading config from ${filePath}`)\n configSchema.loadFile(filePath)\n } else if (values) {\n log.debug('Loading config from values.')\n configSchema.load(values)\n } else {\n log.debug('Using default values.')\n configSchema.load({})\n }\n\n configSchema.validate({ allowed: 'strict' })\n const config = configSchema.getProperties()\n\n log.debug('Using config:', config)\n return config\n}\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const promises_1 = require("fs/promises");
4
+ const config_1 = require("./config");
5
+ function formatJson(data) {
6
+ return `\`${data.replace(/\n/g, '')}\``;
7
+ }
8
+ let data = `
9
+ The configuration properties are applied in the following order (from higher to
10
+ lower precedence):
11
+
12
+ - arguments passed to the executable in kebab case (e.g. \`--url-query\`);
13
+ - environment variables in uppercase snake format (e.g. \`URL_QUERY\`);
14
+ - \`config.json\` configuration file;
15
+ - default values.
16
+
17
+ `;
18
+ const configDocs = (0, config_1.getConfigDocs)();
19
+ Object.entries(configDocs).forEach(entry => {
20
+ const [name, value] = entry;
21
+ data += `\
22
+ ## ${name}
23
+ ${value.doc}
24
+
25
+ *Type*: \`${value.format === '"nat"' ? 'positive int' : value.format.replace(/^"(.+)"$/, '$1')}\`
26
+
27
+ *Default*: ${formatJson(value.default)}
28
+
29
+ `;
30
+ });
31
+ data += `
32
+
33
+ ---
34
+
35
+ `;
36
+ (0, promises_1.writeFile)('docs/config.md', data).then(() => {
37
+ console.log('done');
38
+ }, err => {
39
+ console.error(`Error writing file: ${err.message}`);
40
+ });
41
+ //# sourceMappingURL=generate-config-docs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-config-docs.js","sourceRoot":"","sources":["../../src/generate-config-docs.ts"],"names":[],"mappings":";;AAAA,0CAAuC;AAEvC,qCAAwC;AAExC,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;AACzC,CAAC;AAED,IAAI,IAAI,GAAG;;;;;;;;;CASV,CAAA;AAED,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAA;AAClC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;IACzC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;IAC3B,IAAI,IAAI;KACL,IAAI;EACP,KAAK,CAAC,GAAG;;YAEC,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC;;aAEjF,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC;;CAErC,CAAA;AACD,CAAC,CAAC,CAAA;AAEF,IAAI,IAAI;;;;CAIP,CAAA;AAED,IAAA,oBAAS,EAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,IAAI,CACpC,GAAG,EAAE;IACH,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACrB,CAAC,EACD,GAAG,CAAC,EAAE;IACJ,OAAO,CAAC,KAAK,CAAC,uBAAuB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;AACrD,CAAC,CACF,CAAA","sourcesContent":["import { writeFile } from 'fs/promises'\n\nimport { getConfigDocs } from './config'\n\nfunction formatJson(data: string): string {\n return `\\`${data.replace(/\\n/g, '')}\\``\n}\n\nlet data = `\nThe configuration properties are applied in the following order (from higher to\nlower precedence):\n\n- arguments passed to the executable in kebab case (e.g. \\`--url-query\\`);\n- environment variables in uppercase snake format (e.g. \\`URL_QUERY\\`);\n- \\`config.json\\` configuration file;\n- default values.\n\n`\n\nconst configDocs = getConfigDocs()\nObject.entries(configDocs).forEach(entry => {\n const [name, value] = entry\n data += `\\\n## ${name}\n${value.doc}\n\n*Type*: \\`${value.format === '\"nat\"' ? 'positive int' : value.format.replace(/^\"(.+)\"$/, '$1')}\\`\n\n*Default*: ${formatJson(value.default)}\n\n`\n})\n\ndata += `\n\n---\n\n`\n\nwriteFile('docs/config.md', data).then(\n () => {\n console.log('done')\n },\n err => {\n console.error(`Error writing file: ${err.message}`)\n },\n)\n"]}
@@ -0,0 +1,9 @@
1
+ export * from './app';
2
+ export * from './config';
3
+ export * from './media';
4
+ export * from './rtcstats';
5
+ export * from './server';
6
+ export * from './session';
7
+ export * from './stats';
8
+ export * from './utils';
9
+ export * from './vmaf';
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./app"), exports);
18
+ __exportStar(require("./config"), exports);
19
+ __exportStar(require("./media"), exports);
20
+ __exportStar(require("./rtcstats"), exports);
21
+ __exportStar(require("./server"), exports);
22
+ __exportStar(require("./session"), exports);
23
+ __exportStar(require("./stats"), exports);
24
+ __exportStar(require("./utils"), exports);
25
+ __exportStar(require("./vmaf"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,2CAAwB;AACxB,0CAAuB;AACvB,6CAA0B;AAC1B,2CAAwB;AACxB,4CAAyB;AACzB,0CAAuB;AACvB,0CAAuB;AACvB,yCAAsB","sourcesContent":["export * from './app'\nexport * from './config'\nexport * from './media'\nexport * from './rtcstats'\nexport * from './server'\nexport * from './session'\nexport * from './stats'\nexport * from './utils'\nexport * from './vmaf'\n"]}
@@ -0,0 +1,33 @@
1
+ export type MediaPath = {
2
+ video: string;
3
+ audio: string;
4
+ mp4: string;
5
+ m4a: string;
6
+ };
7
+ /**
8
+ * Converts the video file into raw audio and video files.
9
+ * @param {*} config
10
+ * @param {string} config.videoPath the video to convert
11
+ * @param {string} config.videoWidth the output video width
12
+ * @param {string} config.videoHeight the output video height
13
+ * @param {string} config.videoFramerate the output video framerate
14
+ * @param {string} config.videoSeek the seek position in seconds
15
+ * @param {string} config.videoDuration the output video duration in seconds
16
+ * @param {boolean} config.videoCacheRaw if true and the destinations raw files
17
+ * exist on file system, the conversion step is skipped
18
+ * @param {string} config.videoCachePath the destination directory path; if not
19
+ * existing, it will be created
20
+ * @param {string} config.videoFormat the raw video format (y4m or mjpeg)
21
+ */
22
+ export declare function prepareFakeMedia({ videoPath, videoWidth, videoHeight, videoFramerate, videoSeek, videoDuration, videoCacheRaw, videoCachePath, videoFormat, useFakeMedia, }: {
23
+ videoPath: string;
24
+ videoWidth: number;
25
+ videoHeight: number;
26
+ videoFramerate: number;
27
+ videoSeek: number;
28
+ videoDuration: number;
29
+ videoCacheRaw: boolean;
30
+ videoCachePath: string;
31
+ videoFormat: string;
32
+ useFakeMedia: boolean;
33
+ }): Promise<MediaPath>;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareFakeMedia = prepareFakeMedia;
4
+ const fs_1 = require("fs");
5
+ const utils_1 = require("./utils");
6
+ const log = (0, utils_1.logger)('webrtcperf:media');
7
+ const DEFAULT_VIDEO_PATH = 'https://github.com/vpalmisano/webrtcperf/releases/download/v2.0.4/video.mp4';
8
+ /**
9
+ * Converts the video file into raw audio and video files.
10
+ * @param {*} config
11
+ * @param {string} config.videoPath the video to convert
12
+ * @param {string} config.videoWidth the output video width
13
+ * @param {string} config.videoHeight the output video height
14
+ * @param {string} config.videoFramerate the output video framerate
15
+ * @param {string} config.videoSeek the seek position in seconds
16
+ * @param {string} config.videoDuration the output video duration in seconds
17
+ * @param {boolean} config.videoCacheRaw if true and the destinations raw files
18
+ * exist on file system, the conversion step is skipped
19
+ * @param {string} config.videoCachePath the destination directory path; if not
20
+ * existing, it will be created
21
+ * @param {string} config.videoFormat the raw video format (y4m or mjpeg)
22
+ */
23
+ async function prepareFakeMedia({ videoPath, videoWidth, videoHeight, videoFramerate, videoSeek, videoDuration, videoCacheRaw, videoCachePath, videoFormat, useFakeMedia, }) {
24
+ log.debug('prepareFakeMedia', {
25
+ videoPath,
26
+ videoWidth,
27
+ videoHeight,
28
+ videoFramerate,
29
+ videoSeek,
30
+ videoDuration,
31
+ videoCacheRaw,
32
+ videoCachePath,
33
+ videoFormat,
34
+ useFakeMedia,
35
+ });
36
+ if (!videoPath) {
37
+ throw new Error('empty video path');
38
+ }
39
+ if (!videoPath.startsWith('http') && !videoPath.startsWith('generate:') && !(0, fs_1.existsSync)(videoPath)) {
40
+ log.warn(`video not found: ${videoPath}, using default test video`);
41
+ videoPath = DEFAULT_VIDEO_PATH;
42
+ }
43
+ await fs_1.promises.mkdir(videoCachePath, { recursive: true });
44
+ const name = (0, utils_1.sha256)(videoPath);
45
+ const destVideoPath = `${videoCachePath}/${name}_${videoWidth}x${videoHeight}_${videoFramerate}fps.${videoFormat}`;
46
+ const destAudioPath = `${videoCachePath}/${name}.wav`;
47
+ const destMp4Path = useFakeMedia
48
+ ? ''
49
+ : `${videoCachePath}/${name}_${videoWidth}x${videoHeight}_${videoFramerate}fps.mp4`;
50
+ const destM4aPath = useFakeMedia ? '' : `${videoCachePath}/${name}.m4a`;
51
+ if (!(0, fs_1.existsSync)(destVideoPath) ||
52
+ !(0, fs_1.existsSync)(destAudioPath) ||
53
+ (destMp4Path && !(0, fs_1.existsSync)(destMp4Path)) ||
54
+ (destM4aPath && !(0, fs_1.existsSync)(destM4aPath)) ||
55
+ !videoCacheRaw) {
56
+ log.info(`Converting ${videoPath} to ${destVideoPath}, ${destAudioPath}${destMp4Path ? `, ${destMp4Path}` : ''}${destM4aPath ? `, ${destM4aPath}` : ''}`);
57
+ const destVideoPathTmp = `${videoCachePath}/${name}_${videoWidth}x${videoHeight}_${videoFramerate}fps.tmp.${videoFormat}`;
58
+ const destAudioPathTmp = `${videoCachePath}/${name}.tmp.wav`;
59
+ const destMp4PathTmp = useFakeMedia
60
+ ? ''
61
+ : `${videoCachePath}/${name}_${videoWidth}x${videoHeight}_${videoFramerate}fps.tmp.mp4`;
62
+ const destM4aPathTmp = useFakeMedia ? '' : `${videoCachePath}/${name}.tmp.m4a`;
63
+ try {
64
+ let source = `-i "${videoPath}"`;
65
+ const videoMap = `-map 0:v`;
66
+ const audioMap = videoPath.startsWith('generate:') ? '-map 1:a' : '-map 0:a';
67
+ if (videoPath === 'generate:null') {
68
+ source =
69
+ `-f lavfi -i color=size=${videoWidth}x${videoHeight}:rate=${videoFramerate}:color=black` +
70
+ ` -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000`;
71
+ }
72
+ else if (videoPath === 'generate:test') {
73
+ source =
74
+ `-f lavfi -i testsrc=size=${videoWidth}x${videoHeight}:rate=${videoFramerate} -pix_fmt yuv420p` +
75
+ ` -f lavfi -i sine=frequency=220:beep_factor=4:sample_rate=48000`;
76
+ }
77
+ await (0, utils_1.runShellCommand)(`ffmpeg -loglevel warning -y -threads 0 ${source}` +
78
+ ` -s ${videoWidth}:${videoHeight}` +
79
+ ` -r ${videoFramerate}` +
80
+ ` -ss ${videoSeek} -t ${videoDuration} -shortest -af apad` +
81
+ ` ${videoMap} ${destVideoPathTmp}` +
82
+ ` ${audioMap} -ar 48000 ${destAudioPathTmp}` +
83
+ (destMp4PathTmp
84
+ ? ` ${videoMap} -c:v libx264 -crf 10 -f mp4 -movflags faststart ${destMp4PathTmp}` +
85
+ ` ${audioMap} -c:a aac -b:a 192k ${destM4aPathTmp}`
86
+ : ''));
87
+ await fs_1.promises.rename(destVideoPathTmp, destVideoPath);
88
+ await fs_1.promises.rename(destAudioPathTmp, destAudioPath);
89
+ if (destMp4PathTmp) {
90
+ await fs_1.promises.rename(destMp4PathTmp, destMp4Path);
91
+ }
92
+ if (destM4aPathTmp) {
93
+ await fs_1.promises.rename(destM4aPathTmp, destM4aPath);
94
+ }
95
+ }
96
+ catch (err) {
97
+ log.error(`Error converting video: ${err.stack}`);
98
+ fs_1.promises.unlink(destVideoPathTmp).catch(e => log.debug(e.message));
99
+ fs_1.promises.unlink(destAudioPathTmp).catch(e => log.debug(e.message));
100
+ if (destMp4PathTmp) {
101
+ fs_1.promises.unlink(destMp4PathTmp).catch(e => log.debug(e.message));
102
+ }
103
+ throw err;
104
+ }
105
+ }
106
+ return {
107
+ video: destVideoPath,
108
+ audio: destAudioPath,
109
+ mp4: destMp4Path,
110
+ m4a: destM4aPath,
111
+ };
112
+ }
113
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/media.ts"],"names":[],"mappings":";;AA8BA,4CAwHC;AAtJD,2BAA+C;AAE/C,mCAAyD;AAEzD,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,kBAAkB,CAAC,CAAA;AAEtC,MAAM,kBAAkB,GAAG,6EAA6E,CAAA;AASxG;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,gBAAgB,CAAC,EACrC,SAAS,EACT,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,GAYb;IACC,GAAG,CAAC,KAAK,CAAC,kBAAkB,EAAE;QAC5B,SAAS;QACT,UAAU;QACV,WAAW;QACX,cAAc;QACd,SAAS;QACT,aAAa;QACb,aAAa;QACb,cAAc;QACd,WAAW;QACX,YAAY;KACb,CAAC,CAAA;IACF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;I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KAAK,EAAE,aAAa;QACpB,GAAG,EAAE,WAAW;QAChB,GAAG,EAAE,WAAW;KACjB,CAAA;AACH,CAAC","sourcesContent":["import { existsSync, promises as fs } from 'fs'\n\nimport { logger, runShellCommand, sha256 } from './utils'\n\nconst log = logger('webrtcperf:media')\n\nconst DEFAULT_VIDEO_PATH = 'https://github.com/vpalmisano/webrtcperf/releases/download/v2.0.4/video.mp4'\n\nexport type MediaPath = {\n video: string\n audio: string\n mp4: string\n m4a: string\n}\n\n/**\n * Converts the video file into raw audio and video files.\n * @param {*} config\n * @param {string} config.videoPath the video to convert\n * @param {string} config.videoWidth the output video width\n * @param {string} config.videoHeight the output video height\n * @param {string} config.videoFramerate the output video framerate\n * @param {string} config.videoSeek the seek position in seconds\n * @param {string} config.videoDuration the output video duration in seconds\n * @param {boolean} config.videoCacheRaw if true and the destinations raw files\n * exist on file system, the conversion step is skipped\n * @param {string} config.videoCachePath the destination directory path; if not\n * existing, it will be created\n * @param {string} config.videoFormat the raw video format (y4m or mjpeg)\n */\nexport async function prepareFakeMedia({\n videoPath,\n videoWidth,\n videoHeight,\n videoFramerate,\n videoSeek,\n videoDuration,\n videoCacheRaw,\n videoCachePath,\n videoFormat,\n useFakeMedia,\n}: {\n videoPath: string\n videoWidth: number\n videoHeight: number\n videoFramerate: number\n videoSeek: number\n videoDuration: number\n videoCacheRaw: boolean\n videoCachePath: string\n videoFormat: string\n useFakeMedia: boolean\n}): Promise<MediaPath> {\n log.debug('prepareFakeMedia', {\n videoPath,\n videoWidth,\n videoHeight,\n videoFramerate,\n videoSeek,\n videoDuration,\n videoCacheRaw,\n videoCachePath,\n videoFormat,\n useFakeMedia,\n })\n if (!videoPath) {\n throw new Error('empty video path')\n }\n if (!videoPath.startsWith('http') && !videoPath.startsWith('generate:') && !existsSync(videoPath)) {\n log.warn(`video not found: ${videoPath}, using default test video`)\n videoPath = DEFAULT_VIDEO_PATH\n }\n\n await fs.mkdir(videoCachePath, { recursive: true })\n const name = sha256(videoPath)\n\n const destVideoPath = `${videoCachePath}/${name}_${videoWidth}x${videoHeight}_${videoFramerate}fps.${videoFormat}`\n const destAudioPath = `${videoCachePath}/${name}.wav`\n const destMp4Path = useFakeMedia\n ? ''\n : `${videoCachePath}/${name}_${videoWidth}x${videoHeight}_${videoFramerate}fps.mp4`\n const destM4aPath = useFakeMedia ? '' : `${videoCachePath}/${name}.m4a`\n\n if (\n !existsSync(destVideoPath) ||\n !existsSync(destAudioPath) ||\n (destMp4Path && !existsSync(destMp4Path)) ||\n (destM4aPath && !existsSync(destM4aPath)) ||\n !videoCacheRaw\n ) {\n log.info(\n `Converting ${videoPath} to ${destVideoPath}, ${destAudioPath}${destMp4Path ? `, ${destMp4Path}` : ''}${destM4aPath ? `, ${destM4aPath}` : ''}`,\n )\n const destVideoPathTmp = `${videoCachePath}/${name}_${videoWidth}x${videoHeight}_${videoFramerate}fps.tmp.${videoFormat}`\n const destAudioPathTmp = `${videoCachePath}/${name}.tmp.wav`\n const destMp4PathTmp = useFakeMedia\n ? ''\n : `${videoCachePath}/${name}_${videoWidth}x${videoHeight}_${videoFramerate}fps.tmp.mp4`\n const destM4aPathTmp = useFakeMedia ? '' : `${videoCachePath}/${name}.tmp.m4a`\n\n try {\n let source = `-i \"${videoPath}\"`\n const videoMap = `-map 0:v`\n const audioMap = videoPath.startsWith('generate:') ? '-map 1:a' : '-map 0:a'\n if (videoPath === 'generate:null') {\n source =\n `-f lavfi -i color=size=${videoWidth}x${videoHeight}:rate=${videoFramerate}:color=black` +\n ` -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000`\n } else if (videoPath === 'generate:test') {\n source =\n `-f lavfi -i testsrc=size=${videoWidth}x${videoHeight}:rate=${videoFramerate} -pix_fmt yuv420p` +\n ` -f lavfi -i sine=frequency=220:beep_factor=4:sample_rate=48000`\n }\n await runShellCommand(\n `ffmpeg -loglevel warning -y -threads 0 ${source}` +\n ` -s ${videoWidth}:${videoHeight}` +\n ` -r ${videoFramerate}` +\n ` -ss ${videoSeek} -t ${videoDuration} -shortest -af apad` +\n ` ${videoMap} ${destVideoPathTmp}` +\n ` ${audioMap} -ar 48000 ${destAudioPathTmp}` +\n (destMp4PathTmp\n ? ` ${videoMap} -c:v libx264 -crf 10 -f mp4 -movflags faststart ${destMp4PathTmp}` +\n ` ${audioMap} -c:a aac -b:a 192k ${destM4aPathTmp}`\n : ''),\n )\n await fs.rename(destVideoPathTmp, destVideoPath)\n await fs.rename(destAudioPathTmp, destAudioPath)\n if (destMp4PathTmp) {\n await fs.rename(destMp4PathTmp, destMp4Path)\n }\n if (destM4aPathTmp) {\n await fs.rename(destM4aPathTmp, destM4aPath)\n }\n } catch (err) {\n log.error(`Error converting video: ${(err as Error).stack}`)\n fs.unlink(destVideoPathTmp).catch(e => log.debug(e.message))\n fs.unlink(destAudioPathTmp).catch(e => log.debug(e.message))\n if (destMp4PathTmp) {\n fs.unlink(destMp4PathTmp).catch(e => log.debug(e.message))\n }\n throw err\n }\n }\n\n return {\n video: destVideoPath,\n audio: destAudioPath,\n mp4: destMp4Path,\n m4a: destM4aPath,\n }\n}\n"]}