larkup 0.1.46 → 0.1.47
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/diagnostics/route-bundle-stats.json +12 -12
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +16 -16
- package/.next/server/app/_not-found.segments/_full.segment.rsc +16 -16
- package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/analytics/page_client-reference-manifest.js +1 -1
- package/.next/server/app/analytics.html +1 -1
- package/.next/server/app/analytics.rsc +17 -17
- package/.next/server/app/analytics.segments/_full.segment.rsc +17 -17
- package/.next/server/app/analytics.segments/_head.segment.rsc +4 -4
- package/.next/server/app/analytics.segments/_index.segment.rsc +11 -11
- package/.next/server/app/analytics.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/analytics.segments/analytics/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/analytics.segments/analytics.segment.rsc +3 -3
- package/.next/server/app/api/chat/route.js +9 -9
- package/.next/server/app/api/chat/route.js.nft.json +1 -1
- package/.next/server/app/api/deploy/ssh/route.js +2 -2
- package/.next/server/app/api/deploy/ssh/route.js.nft.json +1 -1
- package/.next/server/app/api/doc-editor/edit/route.js +2 -2
- package/.next/server/app/api/doc-editor/export/route.js +2 -2
- package/.next/server/app/api/doc-editor/extract-text/route.js +2 -2
- package/.next/server/app/api/doc-editor/parse/route.js +1 -1
- package/.next/server/app/api/doc-editor/restore/route.js +2 -2
- package/.next/server/app/api/document/sign/route.js +3 -3
- package/.next/server/app/api/marketplace/[toolId]/route.js.nft.json +1 -1
- package/.next/server/app/api/marketplace/route.js.nft.json +1 -1
- package/.next/server/app/api/media/process/route.js.nft.json +1 -1
- package/.next/server/app/api/media/route.js.nft.json +1 -1
- package/.next/server/app/api/parse-file/route.js +2 -2
- package/.next/server/app/api/server/download/route.js +1 -1
- package/.next/server/app/api/server/generate/route.js +2 -2
- package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/chat.html +1 -1
- package/.next/server/app/chat.rsc +17 -17
- package/.next/server/app/chat.segments/_full.segment.rsc +17 -17
- package/.next/server/app/chat.segments/_head.segment.rsc +4 -4
- package/.next/server/app/chat.segments/_index.segment.rsc +11 -11
- package/.next/server/app/chat.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/chat.segments/chat.segment.rsc +3 -3
- package/.next/server/app/data/page_client-reference-manifest.js +1 -1
- package/.next/server/app/data.html +1 -1
- package/.next/server/app/data.rsc +17 -17
- package/.next/server/app/data.segments/_full.segment.rsc +17 -17
- package/.next/server/app/data.segments/_head.segment.rsc +4 -4
- package/.next/server/app/data.segments/_index.segment.rsc +11 -11
- package/.next/server/app/data.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/data.segments/data/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/data.segments/data.segment.rsc +3 -3
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +16 -16
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +16 -16
- package/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/server/app/index.segments/_index.segment.rsc +11 -11
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +18 -18
- package/.next/server/app/settings.segments/_full.segment.rsc +18 -18
- package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/server/app/settings.segments/_index.segment.rsc +11 -11
- package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/server/chunks/[root-of-the-server]__05707i3._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0vmcld0._.js +3 -0
- package/.next/{standalone/apps/web/.next/server/chunks/[root-of-the-server]__08f60c7._.js → server/chunks/[root-of-the-server]__1e8p5bd._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1ks-3_h._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1lhfkyh._.js +1 -1
- package/.next/server/chunks/packages_marketplace_src_125_g2p._.js +1 -1
- package/.next/server/chunks/packages_scraper_src_0kkcv_v._.js +1 -1
- package/.next/server/chunks/packages_tools_video-audio_dist_ffmpeg-spawn_0by2bau.js +3 -0
- package/.next/server/chunks/ssr/_1yqlx1m._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/required-server-files.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/analytics/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/analytics.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/analytics.rsc +17 -17
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/_full.segment.rsc +17 -17
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/_index.segment.rsc +11 -11
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/analytics/__PAGE__.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/analytics.segments/analytics.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/api/chat/route.js +9 -9
- package/.next/standalone/apps/web/.next/server/app/api/chat/route.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/api/deploy/ssh/route.js +2 -2
- package/.next/standalone/apps/web/.next/server/app/api/deploy/ssh/route.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/api/doc-editor/edit/route.js +2 -2
- package/.next/standalone/apps/web/.next/server/app/api/doc-editor/export/route.js +2 -2
- package/.next/standalone/apps/web/.next/server/app/api/doc-editor/extract-text/route.js +2 -2
- package/.next/standalone/apps/web/.next/server/app/api/doc-editor/parse/route.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/api/doc-editor/restore/route.js +2 -2
- package/.next/standalone/apps/web/.next/server/app/api/document/sign/route.js +3 -3
- package/.next/standalone/apps/web/.next/server/app/api/marketplace/[toolId]/route.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/api/marketplace/route.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/api/media/process/route.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/api/media/route.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/api/parse-file/route.js +2 -2
- package/.next/standalone/apps/web/.next/server/app/api/server/download/route.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/api/server/generate/route.js +2 -2
- package/.next/standalone/apps/web/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat.rsc +17 -17
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_full.segment.rsc +17 -17
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_index.segment.rsc +11 -11
- package/.next/standalone/apps/web/.next/server/app/chat.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/chat.segments/chat.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/data/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/data.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/data.rsc +17 -17
- package/.next/standalone/apps/web/.next/server/app/data.segments/_full.segment.rsc +17 -17
- package/.next/standalone/apps/web/.next/server/app/data.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/data.segments/_index.segment.rsc +11 -11
- package/.next/standalone/apps/web/.next/server/app/data.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/data.segments/data/__PAGE__.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/data.segments/data.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +11 -11
- package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.rsc +18 -18
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +18 -18
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +11 -11
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__05707i3._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__0vmcld0._.js +3 -0
- package/.next/{server/chunks/[root-of-the-server]__08f60c7._.js → standalone/apps/web/.next/server/chunks/[root-of-the-server]__1e8p5bd._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__1ks-3_h._.js +3 -0
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__1lhfkyh._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/packages_marketplace_src_125_g2p._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/packages_scraper_src_0kkcv_v._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/packages_tools_video-audio_dist_ffmpeg-spawn_0by2bau.js +3 -0
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_1yqlx1m._.js +1 -1
- package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/{0wy4vhj2gft06.js → 2azppfcsqga3r.js} +1 -1
- package/.next/standalone/apps/web/CHANGELOG.md +9 -0
- package/.next/standalone/apps/web/components/update-banner.tsx +2 -2
- package/.next/standalone/apps/web/package.json +1 -1
- package/.next/standalone/apps/web/server.js +1 -1
- package/.next/standalone/packages/tools/video-audio/CHANGELOG.md +6 -0
- package/.next/standalone/packages/tools/video-audio/dist/audio-processor.js +30 -32
- package/.next/standalone/packages/tools/video-audio/dist/ffmpeg-spawn.js +127 -0
- package/.next/standalone/packages/tools/video-audio/dist/video-processor.js +95 -113
- package/.next/standalone/packages/tools/video-audio/package.json +2 -7
- package/.next/standalone/packages/tools/video-audio/src/audio-processor.ts +30 -31
- package/.next/standalone/packages/tools/video-audio/src/ffmpeg-spawn.ts +176 -0
- package/.next/standalone/packages/tools/video-audio/src/video-processor.ts +88 -116
- package/.next/static/chunks/{0wy4vhj2gft06.js → 2azppfcsqga3r.js} +1 -1
- package/CHANGELOG.md +9 -0
- package/LICENSE +176 -0
- package/components/update-banner.tsx +2 -2
- package/package.json +4 -4
- package/.next/server/chunks/[externals]__1_tvo45._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__010rwkn._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0xbvdcw._.js +0 -3
- package/.next/server/chunks/node_modules__pnpm_0ddqx71._.js +0 -3
- package/.next/standalone/apps/web/.next/server/chunks/[externals]__1_tvo45._.js +0 -3
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__010rwkn._.js +0 -3
- package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__0xbvdcw._.js +0 -3
- package/.next/standalone/apps/web/.next/server/chunks/node_modules__pnpm_0ddqx71._.js +0 -3
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/capabilities.js +0 -665
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/ffprobe.js +0 -261
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/fluent-ffmpeg.js +0 -226
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/options/audio.js +0 -178
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/options/custom.js +0 -212
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/options/inputs.js +0 -178
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/options/misc.js +0 -41
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/options/output.js +0 -162
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/options/video.js +0 -184
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/options/videosize.js +0 -291
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/presets/divx.js +0 -14
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/presets/flashvideo.js +0 -16
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/presets/podcast.js +0 -16
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/processor.js +0 -662
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/recipes.js +0 -456
- package/.next/standalone/node_modules/.pnpm/fluent-ffmpeg@2.1.3/node_modules/fluent-ffmpeg/lib/utils.js +0 -455
- package/.next/standalone/node_modules/.pnpm/which@1.3.1/node_modules/which/CHANGELOG.md +0 -152
- package/.next/standalone/node_modules/.pnpm/which@1.3.1/node_modules/which/LICENSE +0 -15
- package/.next/standalone/node_modules/.pnpm/which@1.3.1/node_modules/which/README.md +0 -51
- package/.next/standalone/node_modules/.pnpm/which@1.3.1/node_modules/which/bin/which +0 -52
- package/.next/standalone/node_modules/.pnpm/which@1.3.1/node_modules/which/package.json +0 -30
- package/.next/standalone/node_modules/.pnpm/which@1.3.1/node_modules/which/which.js +0 -135
- /package/.next/standalone/apps/web/.next/static/{HU74sZ8oKr0VlhdDfm98x → PM7-3u8cSkShjD80zaJ4l}/_buildManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{HU74sZ8oKr0VlhdDfm98x → PM7-3u8cSkShjD80zaJ4l}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{HU74sZ8oKr0VlhdDfm98x → PM7-3u8cSkShjD80zaJ4l}/_ssgManifest.js +0 -0
- /package/.next/static/{HU74sZ8oKr0VlhdDfm98x → PM7-3u8cSkShjD80zaJ4l}/_buildManifest.js +0 -0
- /package/.next/static/{HU74sZ8oKr0VlhdDfm98x → PM7-3u8cSkShjD80zaJ4l}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{HU74sZ8oKr0VlhdDfm98x → PM7-3u8cSkShjD80zaJ4l}/_ssgManifest.js +0 -0
|
@@ -1,665 +0,0 @@
|
|
|
1
|
-
/*jshint node:true*/
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var fs = require('fs');
|
|
5
|
-
var path = require('path');
|
|
6
|
-
var async = require('async');
|
|
7
|
-
var utils = require('./utils');
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
*! Capability helpers
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
var avCodecRegexp = /^\s*([D ])([E ])([VAS])([S ])([D ])([T ]) ([^ ]+) +(.*)$/;
|
|
14
|
-
var ffCodecRegexp = /^\s*([D\.])([E\.])([VAS])([I\.])([L\.])([S\.]) ([^ ]+) +(.*)$/;
|
|
15
|
-
var ffEncodersRegexp = /\(encoders:([^\)]+)\)/;
|
|
16
|
-
var ffDecodersRegexp = /\(decoders:([^\)]+)\)/;
|
|
17
|
-
var encodersRegexp = /^\s*([VAS\.])([F\.])([S\.])([X\.])([B\.])([D\.]) ([^ ]+) +(.*)$/;
|
|
18
|
-
var formatRegexp = /^\s*([D ])([E ])\s+([^ ]+)\s+(.*)$/;
|
|
19
|
-
var lineBreakRegexp = /\r\n|\r|\n/;
|
|
20
|
-
var filterRegexp = /^(?: [T\.][S\.][C\.] )?([^ ]+) +(AA?|VV?|\|)->(AA?|VV?|\|) +(.*)$/;
|
|
21
|
-
|
|
22
|
-
var cache = {};
|
|
23
|
-
|
|
24
|
-
module.exports = function(proto) {
|
|
25
|
-
/**
|
|
26
|
-
* Manually define the ffmpeg binary full path.
|
|
27
|
-
*
|
|
28
|
-
* @method FfmpegCommand#setFfmpegPath
|
|
29
|
-
*
|
|
30
|
-
* @param {String} ffmpegPath The full path to the ffmpeg binary.
|
|
31
|
-
* @return FfmpegCommand
|
|
32
|
-
*/
|
|
33
|
-
proto.setFfmpegPath = function(ffmpegPath) {
|
|
34
|
-
cache.ffmpegPath = ffmpegPath;
|
|
35
|
-
return this;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Manually define the ffprobe binary full path.
|
|
40
|
-
*
|
|
41
|
-
* @method FfmpegCommand#setFfprobePath
|
|
42
|
-
*
|
|
43
|
-
* @param {String} ffprobePath The full path to the ffprobe binary.
|
|
44
|
-
* @return FfmpegCommand
|
|
45
|
-
*/
|
|
46
|
-
proto.setFfprobePath = function(ffprobePath) {
|
|
47
|
-
cache.ffprobePath = ffprobePath;
|
|
48
|
-
return this;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Manually define the flvtool2/flvmeta binary full path.
|
|
53
|
-
*
|
|
54
|
-
* @method FfmpegCommand#setFlvtoolPath
|
|
55
|
-
*
|
|
56
|
-
* @param {String} flvtool The full path to the flvtool2 or flvmeta binary.
|
|
57
|
-
* @return FfmpegCommand
|
|
58
|
-
*/
|
|
59
|
-
proto.setFlvtoolPath = function(flvtool) {
|
|
60
|
-
cache.flvtoolPath = flvtool;
|
|
61
|
-
return this;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Forget executable paths
|
|
66
|
-
*
|
|
67
|
-
* (only used for testing purposes)
|
|
68
|
-
*
|
|
69
|
-
* @method FfmpegCommand#_forgetPaths
|
|
70
|
-
* @private
|
|
71
|
-
*/
|
|
72
|
-
proto._forgetPaths = function() {
|
|
73
|
-
delete cache.ffmpegPath;
|
|
74
|
-
delete cache.ffprobePath;
|
|
75
|
-
delete cache.flvtoolPath;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Check for ffmpeg availability
|
|
80
|
-
*
|
|
81
|
-
* If the FFMPEG_PATH environment variable is set, try to use it.
|
|
82
|
-
* If it is unset or incorrect, try to find ffmpeg in the PATH instead.
|
|
83
|
-
*
|
|
84
|
-
* @method FfmpegCommand#_getFfmpegPath
|
|
85
|
-
* @param {Function} callback callback with signature (err, path)
|
|
86
|
-
* @private
|
|
87
|
-
*/
|
|
88
|
-
proto._getFfmpegPath = function(callback) {
|
|
89
|
-
if ('ffmpegPath' in cache) {
|
|
90
|
-
return callback(null, cache.ffmpegPath);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
async.waterfall([
|
|
94
|
-
// Try FFMPEG_PATH
|
|
95
|
-
function(cb) {
|
|
96
|
-
if (process.env.FFMPEG_PATH) {
|
|
97
|
-
fs.exists(process.env.FFMPEG_PATH, function(exists) {
|
|
98
|
-
if (exists) {
|
|
99
|
-
cb(null, process.env.FFMPEG_PATH);
|
|
100
|
-
} else {
|
|
101
|
-
cb(null, '');
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
} else {
|
|
105
|
-
cb(null, '');
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
// Search in the PATH
|
|
110
|
-
function(ffmpeg, cb) {
|
|
111
|
-
if (ffmpeg.length) {
|
|
112
|
-
return cb(null, ffmpeg);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
utils.which('ffmpeg', function(err, ffmpeg) {
|
|
116
|
-
cb(err, ffmpeg);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
], function(err, ffmpeg) {
|
|
120
|
-
if (err) {
|
|
121
|
-
callback(err);
|
|
122
|
-
} else {
|
|
123
|
-
callback(null, cache.ffmpegPath = (ffmpeg || ''));
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Check for ffprobe availability
|
|
131
|
-
*
|
|
132
|
-
* If the FFPROBE_PATH environment variable is set, try to use it.
|
|
133
|
-
* If it is unset or incorrect, try to find ffprobe in the PATH instead.
|
|
134
|
-
* If this still fails, try to find ffprobe in the same directory as ffmpeg.
|
|
135
|
-
*
|
|
136
|
-
* @method FfmpegCommand#_getFfprobePath
|
|
137
|
-
* @param {Function} callback callback with signature (err, path)
|
|
138
|
-
* @private
|
|
139
|
-
*/
|
|
140
|
-
proto._getFfprobePath = function(callback) {
|
|
141
|
-
var self = this;
|
|
142
|
-
|
|
143
|
-
if ('ffprobePath' in cache) {
|
|
144
|
-
return callback(null, cache.ffprobePath);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async.waterfall([
|
|
148
|
-
// Try FFPROBE_PATH
|
|
149
|
-
function(cb) {
|
|
150
|
-
if (process.env.FFPROBE_PATH) {
|
|
151
|
-
fs.exists(process.env.FFPROBE_PATH, function(exists) {
|
|
152
|
-
cb(null, exists ? process.env.FFPROBE_PATH : '');
|
|
153
|
-
});
|
|
154
|
-
} else {
|
|
155
|
-
cb(null, '');
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
// Search in the PATH
|
|
160
|
-
function(ffprobe, cb) {
|
|
161
|
-
if (ffprobe.length) {
|
|
162
|
-
return cb(null, ffprobe);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
utils.which('ffprobe', function(err, ffprobe) {
|
|
166
|
-
cb(err, ffprobe);
|
|
167
|
-
});
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
// Search in the same directory as ffmpeg
|
|
171
|
-
function(ffprobe, cb) {
|
|
172
|
-
if (ffprobe.length) {
|
|
173
|
-
return cb(null, ffprobe);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
self._getFfmpegPath(function(err, ffmpeg) {
|
|
177
|
-
if (err) {
|
|
178
|
-
cb(err);
|
|
179
|
-
} else if (ffmpeg.length) {
|
|
180
|
-
var name = utils.isWindows ? 'ffprobe.exe' : 'ffprobe';
|
|
181
|
-
var ffprobe = path.join(path.dirname(ffmpeg), name);
|
|
182
|
-
fs.exists(ffprobe, function(exists) {
|
|
183
|
-
cb(null, exists ? ffprobe : '');
|
|
184
|
-
});
|
|
185
|
-
} else {
|
|
186
|
-
cb(null, '');
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
], function(err, ffprobe) {
|
|
191
|
-
if (err) {
|
|
192
|
-
callback(err);
|
|
193
|
-
} else {
|
|
194
|
-
callback(null, cache.ffprobePath = (ffprobe || ''));
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Check for flvtool2/flvmeta availability
|
|
202
|
-
*
|
|
203
|
-
* If the FLVTOOL2_PATH or FLVMETA_PATH environment variable are set, try to use them.
|
|
204
|
-
* If both are either unset or incorrect, try to find flvtool2 or flvmeta in the PATH instead.
|
|
205
|
-
*
|
|
206
|
-
* @method FfmpegCommand#_getFlvtoolPath
|
|
207
|
-
* @param {Function} callback callback with signature (err, path)
|
|
208
|
-
* @private
|
|
209
|
-
*/
|
|
210
|
-
proto._getFlvtoolPath = function(callback) {
|
|
211
|
-
if ('flvtoolPath' in cache) {
|
|
212
|
-
return callback(null, cache.flvtoolPath);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
async.waterfall([
|
|
216
|
-
// Try FLVMETA_PATH
|
|
217
|
-
function(cb) {
|
|
218
|
-
if (process.env.FLVMETA_PATH) {
|
|
219
|
-
fs.exists(process.env.FLVMETA_PATH, function(exists) {
|
|
220
|
-
cb(null, exists ? process.env.FLVMETA_PATH : '');
|
|
221
|
-
});
|
|
222
|
-
} else {
|
|
223
|
-
cb(null, '');
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
// Try FLVTOOL2_PATH
|
|
228
|
-
function(flvtool, cb) {
|
|
229
|
-
if (flvtool.length) {
|
|
230
|
-
return cb(null, flvtool);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (process.env.FLVTOOL2_PATH) {
|
|
234
|
-
fs.exists(process.env.FLVTOOL2_PATH, function(exists) {
|
|
235
|
-
cb(null, exists ? process.env.FLVTOOL2_PATH : '');
|
|
236
|
-
});
|
|
237
|
-
} else {
|
|
238
|
-
cb(null, '');
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
// Search for flvmeta in the PATH
|
|
243
|
-
function(flvtool, cb) {
|
|
244
|
-
if (flvtool.length) {
|
|
245
|
-
return cb(null, flvtool);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
utils.which('flvmeta', function(err, flvmeta) {
|
|
249
|
-
cb(err, flvmeta);
|
|
250
|
-
});
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
// Search for flvtool2 in the PATH
|
|
254
|
-
function(flvtool, cb) {
|
|
255
|
-
if (flvtool.length) {
|
|
256
|
-
return cb(null, flvtool);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
utils.which('flvtool2', function(err, flvtool2) {
|
|
260
|
-
cb(err, flvtool2);
|
|
261
|
-
});
|
|
262
|
-
},
|
|
263
|
-
], function(err, flvtool) {
|
|
264
|
-
if (err) {
|
|
265
|
-
callback(err);
|
|
266
|
-
} else {
|
|
267
|
-
callback(null, cache.flvtoolPath = (flvtool || ''));
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* A callback passed to {@link FfmpegCommand#availableFilters}.
|
|
275
|
-
*
|
|
276
|
-
* @callback FfmpegCommand~filterCallback
|
|
277
|
-
* @param {Error|null} err error object or null if no error happened
|
|
278
|
-
* @param {Object} filters filter object with filter names as keys and the following
|
|
279
|
-
* properties for each filter:
|
|
280
|
-
* @param {String} filters.description filter description
|
|
281
|
-
* @param {String} filters.input input type, one of 'audio', 'video' and 'none'
|
|
282
|
-
* @param {Boolean} filters.multipleInputs whether the filter supports multiple inputs
|
|
283
|
-
* @param {String} filters.output output type, one of 'audio', 'video' and 'none'
|
|
284
|
-
* @param {Boolean} filters.multipleOutputs whether the filter supports multiple outputs
|
|
285
|
-
*/
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Query ffmpeg for available filters
|
|
289
|
-
*
|
|
290
|
-
* @method FfmpegCommand#availableFilters
|
|
291
|
-
* @category Capabilities
|
|
292
|
-
* @aliases getAvailableFilters
|
|
293
|
-
*
|
|
294
|
-
* @param {FfmpegCommand~filterCallback} callback callback function
|
|
295
|
-
*/
|
|
296
|
-
proto.availableFilters =
|
|
297
|
-
proto.getAvailableFilters = function(callback) {
|
|
298
|
-
if ('filters' in cache) {
|
|
299
|
-
return callback(null, cache.filters);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
this._spawnFfmpeg(['-filters'], { captureStdout: true, stdoutLines: 0 }, function (err, stdoutRing) {
|
|
303
|
-
if (err) {
|
|
304
|
-
return callback(err);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
var stdout = stdoutRing.get();
|
|
308
|
-
var lines = stdout.split('\n');
|
|
309
|
-
var data = {};
|
|
310
|
-
var types = { A: 'audio', V: 'video', '|': 'none' };
|
|
311
|
-
|
|
312
|
-
lines.forEach(function(line) {
|
|
313
|
-
var match = line.match(filterRegexp);
|
|
314
|
-
if (match) {
|
|
315
|
-
data[match[1]] = {
|
|
316
|
-
description: match[4],
|
|
317
|
-
input: types[match[2].charAt(0)],
|
|
318
|
-
multipleInputs: match[2].length > 1,
|
|
319
|
-
output: types[match[3].charAt(0)],
|
|
320
|
-
multipleOutputs: match[3].length > 1
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
callback(null, cache.filters = data);
|
|
326
|
-
});
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* A callback passed to {@link FfmpegCommand#availableCodecs}.
|
|
332
|
-
*
|
|
333
|
-
* @callback FfmpegCommand~codecCallback
|
|
334
|
-
* @param {Error|null} err error object or null if no error happened
|
|
335
|
-
* @param {Object} codecs codec object with codec names as keys and the following
|
|
336
|
-
* properties for each codec (more properties may be available depending on the
|
|
337
|
-
* ffmpeg version used):
|
|
338
|
-
* @param {String} codecs.description codec description
|
|
339
|
-
* @param {Boolean} codecs.canDecode whether the codec is able to decode streams
|
|
340
|
-
* @param {Boolean} codecs.canEncode whether the codec is able to encode streams
|
|
341
|
-
*/
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Query ffmpeg for available codecs
|
|
345
|
-
*
|
|
346
|
-
* @method FfmpegCommand#availableCodecs
|
|
347
|
-
* @category Capabilities
|
|
348
|
-
* @aliases getAvailableCodecs
|
|
349
|
-
*
|
|
350
|
-
* @param {FfmpegCommand~codecCallback} callback callback function
|
|
351
|
-
*/
|
|
352
|
-
proto.availableCodecs =
|
|
353
|
-
proto.getAvailableCodecs = function(callback) {
|
|
354
|
-
if ('codecs' in cache) {
|
|
355
|
-
return callback(null, cache.codecs);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
this._spawnFfmpeg(['-codecs'], { captureStdout: true, stdoutLines: 0 }, function(err, stdoutRing) {
|
|
359
|
-
if (err) {
|
|
360
|
-
return callback(err);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
var stdout = stdoutRing.get();
|
|
364
|
-
var lines = stdout.split(lineBreakRegexp);
|
|
365
|
-
var data = {};
|
|
366
|
-
|
|
367
|
-
lines.forEach(function(line) {
|
|
368
|
-
var match = line.match(avCodecRegexp);
|
|
369
|
-
if (match && match[7] !== '=') {
|
|
370
|
-
data[match[7]] = {
|
|
371
|
-
type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[3]],
|
|
372
|
-
description: match[8],
|
|
373
|
-
canDecode: match[1] === 'D',
|
|
374
|
-
canEncode: match[2] === 'E',
|
|
375
|
-
drawHorizBand: match[4] === 'S',
|
|
376
|
-
directRendering: match[5] === 'D',
|
|
377
|
-
weirdFrameTruncation: match[6] === 'T'
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
match = line.match(ffCodecRegexp);
|
|
382
|
-
if (match && match[7] !== '=') {
|
|
383
|
-
var codecData = data[match[7]] = {
|
|
384
|
-
type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[3]],
|
|
385
|
-
description: match[8],
|
|
386
|
-
canDecode: match[1] === 'D',
|
|
387
|
-
canEncode: match[2] === 'E',
|
|
388
|
-
intraFrameOnly: match[4] === 'I',
|
|
389
|
-
isLossy: match[5] === 'L',
|
|
390
|
-
isLossless: match[6] === 'S'
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
var encoders = codecData.description.match(ffEncodersRegexp);
|
|
394
|
-
encoders = encoders ? encoders[1].trim().split(' ') : [];
|
|
395
|
-
|
|
396
|
-
var decoders = codecData.description.match(ffDecodersRegexp);
|
|
397
|
-
decoders = decoders ? decoders[1].trim().split(' ') : [];
|
|
398
|
-
|
|
399
|
-
if (encoders.length || decoders.length) {
|
|
400
|
-
var coderData = {};
|
|
401
|
-
utils.copy(codecData, coderData);
|
|
402
|
-
delete coderData.canEncode;
|
|
403
|
-
delete coderData.canDecode;
|
|
404
|
-
|
|
405
|
-
encoders.forEach(function(name) {
|
|
406
|
-
data[name] = {};
|
|
407
|
-
utils.copy(coderData, data[name]);
|
|
408
|
-
data[name].canEncode = true;
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
decoders.forEach(function(name) {
|
|
412
|
-
if (name in data) {
|
|
413
|
-
data[name].canDecode = true;
|
|
414
|
-
} else {
|
|
415
|
-
data[name] = {};
|
|
416
|
-
utils.copy(coderData, data[name]);
|
|
417
|
-
data[name].canDecode = true;
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
|
|
424
|
-
callback(null, cache.codecs = data);
|
|
425
|
-
});
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* A callback passed to {@link FfmpegCommand#availableEncoders}.
|
|
431
|
-
*
|
|
432
|
-
* @callback FfmpegCommand~encodersCallback
|
|
433
|
-
* @param {Error|null} err error object or null if no error happened
|
|
434
|
-
* @param {Object} encoders encoders object with encoder names as keys and the following
|
|
435
|
-
* properties for each encoder:
|
|
436
|
-
* @param {String} encoders.description codec description
|
|
437
|
-
* @param {Boolean} encoders.type "audio", "video" or "subtitle"
|
|
438
|
-
* @param {Boolean} encoders.frameMT whether the encoder is able to do frame-level multithreading
|
|
439
|
-
* @param {Boolean} encoders.sliceMT whether the encoder is able to do slice-level multithreading
|
|
440
|
-
* @param {Boolean} encoders.experimental whether the encoder is experimental
|
|
441
|
-
* @param {Boolean} encoders.drawHorizBand whether the encoder supports draw_horiz_band
|
|
442
|
-
* @param {Boolean} encoders.directRendering whether the encoder supports direct encoding method 1
|
|
443
|
-
*/
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Query ffmpeg for available encoders
|
|
447
|
-
*
|
|
448
|
-
* @method FfmpegCommand#availableEncoders
|
|
449
|
-
* @category Capabilities
|
|
450
|
-
* @aliases getAvailableEncoders
|
|
451
|
-
*
|
|
452
|
-
* @param {FfmpegCommand~encodersCallback} callback callback function
|
|
453
|
-
*/
|
|
454
|
-
proto.availableEncoders =
|
|
455
|
-
proto.getAvailableEncoders = function(callback) {
|
|
456
|
-
if ('encoders' in cache) {
|
|
457
|
-
return callback(null, cache.encoders);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
this._spawnFfmpeg(['-encoders'], { captureStdout: true, stdoutLines: 0 }, function(err, stdoutRing) {
|
|
461
|
-
if (err) {
|
|
462
|
-
return callback(err);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
var stdout = stdoutRing.get();
|
|
466
|
-
var lines = stdout.split(lineBreakRegexp);
|
|
467
|
-
var data = {};
|
|
468
|
-
|
|
469
|
-
lines.forEach(function(line) {
|
|
470
|
-
var match = line.match(encodersRegexp);
|
|
471
|
-
if (match && match[7] !== '=') {
|
|
472
|
-
data[match[7]] = {
|
|
473
|
-
type: { 'V': 'video', 'A': 'audio', 'S': 'subtitle' }[match[1]],
|
|
474
|
-
description: match[8],
|
|
475
|
-
frameMT: match[2] === 'F',
|
|
476
|
-
sliceMT: match[3] === 'S',
|
|
477
|
-
experimental: match[4] === 'X',
|
|
478
|
-
drawHorizBand: match[5] === 'B',
|
|
479
|
-
directRendering: match[6] === 'D'
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
callback(null, cache.encoders = data);
|
|
485
|
-
});
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* A callback passed to {@link FfmpegCommand#availableFormats}.
|
|
491
|
-
*
|
|
492
|
-
* @callback FfmpegCommand~formatCallback
|
|
493
|
-
* @param {Error|null} err error object or null if no error happened
|
|
494
|
-
* @param {Object} formats format object with format names as keys and the following
|
|
495
|
-
* properties for each format:
|
|
496
|
-
* @param {String} formats.description format description
|
|
497
|
-
* @param {Boolean} formats.canDemux whether the format is able to demux streams from an input file
|
|
498
|
-
* @param {Boolean} formats.canMux whether the format is able to mux streams into an output file
|
|
499
|
-
*/
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* Query ffmpeg for available formats
|
|
503
|
-
*
|
|
504
|
-
* @method FfmpegCommand#availableFormats
|
|
505
|
-
* @category Capabilities
|
|
506
|
-
* @aliases getAvailableFormats
|
|
507
|
-
*
|
|
508
|
-
* @param {FfmpegCommand~formatCallback} callback callback function
|
|
509
|
-
*/
|
|
510
|
-
proto.availableFormats =
|
|
511
|
-
proto.getAvailableFormats = function(callback) {
|
|
512
|
-
if ('formats' in cache) {
|
|
513
|
-
return callback(null, cache.formats);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// Run ffmpeg -formats
|
|
517
|
-
this._spawnFfmpeg(['-formats'], { captureStdout: true, stdoutLines: 0 }, function (err, stdoutRing) {
|
|
518
|
-
if (err) {
|
|
519
|
-
return callback(err);
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
// Parse output
|
|
523
|
-
var stdout = stdoutRing.get();
|
|
524
|
-
var lines = stdout.split(lineBreakRegexp);
|
|
525
|
-
var data = {};
|
|
526
|
-
|
|
527
|
-
lines.forEach(function(line) {
|
|
528
|
-
var match = line.match(formatRegexp);
|
|
529
|
-
if (match) {
|
|
530
|
-
match[3].split(',').forEach(function(format) {
|
|
531
|
-
if (!(format in data)) {
|
|
532
|
-
data[format] = {
|
|
533
|
-
description: match[4],
|
|
534
|
-
canDemux: false,
|
|
535
|
-
canMux: false
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
if (match[1] === 'D') {
|
|
540
|
-
data[format].canDemux = true;
|
|
541
|
-
}
|
|
542
|
-
if (match[2] === 'E') {
|
|
543
|
-
data[format].canMux = true;
|
|
544
|
-
}
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
callback(null, cache.formats = data);
|
|
550
|
-
});
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* Check capabilities before executing a command
|
|
556
|
-
*
|
|
557
|
-
* Checks whether all used codecs and formats are indeed available
|
|
558
|
-
*
|
|
559
|
-
* @method FfmpegCommand#_checkCapabilities
|
|
560
|
-
* @param {Function} callback callback with signature (err)
|
|
561
|
-
* @private
|
|
562
|
-
*/
|
|
563
|
-
proto._checkCapabilities = function(callback) {
|
|
564
|
-
var self = this;
|
|
565
|
-
async.waterfall([
|
|
566
|
-
// Get available formats
|
|
567
|
-
function(cb) {
|
|
568
|
-
self.availableFormats(cb);
|
|
569
|
-
},
|
|
570
|
-
|
|
571
|
-
// Check whether specified formats are available
|
|
572
|
-
function(formats, cb) {
|
|
573
|
-
var unavailable;
|
|
574
|
-
|
|
575
|
-
// Output format(s)
|
|
576
|
-
unavailable = self._outputs
|
|
577
|
-
.reduce(function(fmts, output) {
|
|
578
|
-
var format = output.options.find('-f', 1);
|
|
579
|
-
if (format) {
|
|
580
|
-
if (!(format[0] in formats) || !(formats[format[0]].canMux)) {
|
|
581
|
-
fmts.push(format);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
return fmts;
|
|
586
|
-
}, []);
|
|
587
|
-
|
|
588
|
-
if (unavailable.length === 1) {
|
|
589
|
-
return cb(new Error('Output format ' + unavailable[0] + ' is not available'));
|
|
590
|
-
} else if (unavailable.length > 1) {
|
|
591
|
-
return cb(new Error('Output formats ' + unavailable.join(', ') + ' are not available'));
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
// Input format(s)
|
|
595
|
-
unavailable = self._inputs
|
|
596
|
-
.reduce(function(fmts, input) {
|
|
597
|
-
var format = input.options.find('-f', 1);
|
|
598
|
-
if (format) {
|
|
599
|
-
if (!(format[0] in formats) || !(formats[format[0]].canDemux)) {
|
|
600
|
-
fmts.push(format[0]);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
return fmts;
|
|
605
|
-
}, []);
|
|
606
|
-
|
|
607
|
-
if (unavailable.length === 1) {
|
|
608
|
-
return cb(new Error('Input format ' + unavailable[0] + ' is not available'));
|
|
609
|
-
} else if (unavailable.length > 1) {
|
|
610
|
-
return cb(new Error('Input formats ' + unavailable.join(', ') + ' are not available'));
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
cb();
|
|
614
|
-
},
|
|
615
|
-
|
|
616
|
-
// Get available codecs
|
|
617
|
-
function(cb) {
|
|
618
|
-
self.availableEncoders(cb);
|
|
619
|
-
},
|
|
620
|
-
|
|
621
|
-
// Check whether specified codecs are available and add strict experimental options if needed
|
|
622
|
-
function(encoders, cb) {
|
|
623
|
-
var unavailable;
|
|
624
|
-
|
|
625
|
-
// Audio codec(s)
|
|
626
|
-
unavailable = self._outputs.reduce(function(cdcs, output) {
|
|
627
|
-
var acodec = output.audio.find('-acodec', 1);
|
|
628
|
-
if (acodec && acodec[0] !== 'copy') {
|
|
629
|
-
if (!(acodec[0] in encoders) || encoders[acodec[0]].type !== 'audio') {
|
|
630
|
-
cdcs.push(acodec[0]);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
return cdcs;
|
|
635
|
-
}, []);
|
|
636
|
-
|
|
637
|
-
if (unavailable.length === 1) {
|
|
638
|
-
return cb(new Error('Audio codec ' + unavailable[0] + ' is not available'));
|
|
639
|
-
} else if (unavailable.length > 1) {
|
|
640
|
-
return cb(new Error('Audio codecs ' + unavailable.join(', ') + ' are not available'));
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
// Video codec(s)
|
|
644
|
-
unavailable = self._outputs.reduce(function(cdcs, output) {
|
|
645
|
-
var vcodec = output.video.find('-vcodec', 1);
|
|
646
|
-
if (vcodec && vcodec[0] !== 'copy') {
|
|
647
|
-
if (!(vcodec[0] in encoders) || encoders[vcodec[0]].type !== 'video') {
|
|
648
|
-
cdcs.push(vcodec[0]);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
return cdcs;
|
|
653
|
-
}, []);
|
|
654
|
-
|
|
655
|
-
if (unavailable.length === 1) {
|
|
656
|
-
return cb(new Error('Video codec ' + unavailable[0] + ' is not available'));
|
|
657
|
-
} else if (unavailable.length > 1) {
|
|
658
|
-
return cb(new Error('Video codecs ' + unavailable.join(', ') + ' are not available'));
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
cb();
|
|
662
|
-
}
|
|
663
|
-
], callback);
|
|
664
|
-
};
|
|
665
|
-
};
|