@remotion/studio 4.0.522 → 4.0.523

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 (220) hide show
  1. package/dist/api/install-package.js +4 -2
  2. package/dist/components/AssetAudioVolume.d.ts +5 -0
  3. package/dist/components/AssetAudioVolume.js +33 -0
  4. package/dist/components/Canvas.js +5 -6
  5. package/dist/components/CaptionInspector.js +74 -20
  6. package/dist/components/CheckboardToggle.js +8 -6
  7. package/dist/components/Checkbox.d.ts +1 -0
  8. package/dist/components/Checkbox.js +2 -2
  9. package/dist/components/CompositionContextButton.js +4 -1
  10. package/dist/components/CompositionSelectorItem.js +2 -2
  11. package/dist/components/ConfigureLicenseModal.js +1 -1
  12. package/dist/components/CurrentAsset.js +40 -6
  13. package/dist/components/EditorContexts.js +3 -1
  14. package/dist/components/ElementInstallConfirmation.js +287 -135
  15. package/dist/components/FixComputedValueModal.js +38 -8
  16. package/dist/components/FullscreenToggle.js +9 -8
  17. package/dist/components/GlobalKeybindings.js +50 -49
  18. package/dist/components/HighlightedElementSource.d.ts +5 -0
  19. package/dist/components/HighlightedElementSource.js +78 -0
  20. package/dist/components/InspectorPanel/MultiSequenceField.d.ts +12 -0
  21. package/dist/components/InspectorPanel/MultiSequenceField.js +131 -0
  22. package/dist/components/InspectorPanel/MultiSequenceInspector.d.ts +8 -0
  23. package/dist/components/InspectorPanel/MultiSequenceInspector.js +102 -0
  24. package/dist/components/InspectorPanel/MultiSequenceNumberField.d.ts +9 -0
  25. package/dist/components/InspectorPanel/MultiSequenceNumberField.js +88 -0
  26. package/dist/components/InspectorPanel.js +4 -0
  27. package/dist/components/InspectorSequenceSection.js +64 -1
  28. package/dist/components/InstallPackage.js +4 -5
  29. package/dist/components/KeyboardShortcutsSettings.js +212 -33
  30. package/dist/components/MenuToolbar.js +7 -5
  31. package/dist/components/ModalContainer.d.ts +1 -0
  32. package/dist/components/ModalContainer.js +2 -2
  33. package/dist/components/Modals.js +3 -1
  34. package/dist/components/ModelManager.d.ts +16 -0
  35. package/dist/components/ModelManager.js +200 -0
  36. package/dist/components/ModelsSettings.d.ts +2 -0
  37. package/dist/components/ModelsSettings.js +133 -0
  38. package/dist/components/NewComposition/DismissableModal.d.ts +1 -0
  39. package/dist/components/NewComposition/DismissableModal.js +2 -2
  40. package/dist/components/NewComposition/InputDragger.d.ts +2 -2
  41. package/dist/components/NewComposition/InputDragger.js +6 -6
  42. package/dist/components/NewComposition/NewFolder.js +11 -8
  43. package/dist/components/NewComposition/RenameFolder.js +17 -10
  44. package/dist/components/OptionalPackageModal.d.ts +11 -0
  45. package/dist/components/OptionalPackageModal.js +155 -0
  46. package/dist/components/PlayPause.js +4 -8
  47. package/dist/components/PlaybackKeyboardShortcutsManager.js +3 -6
  48. package/dist/components/PreviewToolbarOverflowButton.js +11 -2
  49. package/dist/components/QuickSwitcher/ExplorerQuickSwitcherTrigger.js +5 -2
  50. package/dist/components/RadioButton.d.ts +1 -0
  51. package/dist/components/RadioButton.js +2 -2
  52. package/dist/components/RenderButton.js +5 -1
  53. package/dist/components/RenderModal/NumberSetting.d.ts +6 -1
  54. package/dist/components/RenderModal/NumberSetting.js +2 -2
  55. package/dist/components/RenderModal/RenderModalBasic.js +1 -1
  56. package/dist/components/RenderModal/RenderModalOutputName.d.ts +3 -1
  57. package/dist/components/RenderModal/RenderModalOutputName.js +4 -4
  58. package/dist/components/RenderModal/SeparateAudioOption.js +1 -1
  59. package/dist/components/RenderModal/WebRenderModalBasic.js +1 -1
  60. package/dist/components/RenderQueue/CaptionQueueItem.d.ts +6 -0
  61. package/dist/components/RenderQueue/CaptionQueueItem.js +129 -0
  62. package/dist/components/RenderQueue/CaptionQueueProcessor.d.ts +1 -0
  63. package/dist/components/RenderQueue/CaptionQueueProcessor.js +110 -0
  64. package/dist/components/RenderQueue/CaptionQueueProcessorLoader.d.ts +2 -0
  65. package/dist/components/RenderQueue/CaptionQueueProcessorLoader.js +54 -0
  66. package/dist/components/RenderQueue/RenderQueueItem.js +3 -3
  67. package/dist/components/RenderQueue/VideoMattingQueueItem.d.ts +6 -0
  68. package/dist/components/RenderQueue/VideoMattingQueueItem.js +129 -0
  69. package/dist/components/RenderQueue/VideoMattingQueueProcessor.d.ts +1 -0
  70. package/dist/components/RenderQueue/VideoMattingQueueProcessor.js +105 -0
  71. package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.d.ts +2 -0
  72. package/dist/components/RenderQueue/VideoMattingQueueProcessorLoader.js +54 -0
  73. package/dist/components/RenderQueue/caption-job-types.d.ts +47 -0
  74. package/dist/components/RenderQueue/caption-job-types.js +7 -0
  75. package/dist/components/RenderQueue/context.d.ts +16 -0
  76. package/dist/components/RenderQueue/context.js +224 -11
  77. package/dist/components/RenderQueue/index.js +34 -10
  78. package/dist/components/RenderQueue/item-style.d.ts +1 -0
  79. package/dist/components/RenderQueue/item-style.js +2 -1
  80. package/dist/components/RenderQueue/load-model-for-job.d.ts +11 -0
  81. package/dist/components/RenderQueue/load-model-for-job.js +14 -0
  82. package/dist/components/RenderQueue/video-matting-job-types.d.ts +38 -0
  83. package/dist/components/RenderQueue/video-matting-job-types.js +5 -0
  84. package/dist/components/RendersTab.js +4 -4
  85. package/dist/components/SegmentedControl.d.ts +2 -2
  86. package/dist/components/SegmentedControl.js +38 -13
  87. package/dist/components/SelectedOutlinePolygon.js +8 -2
  88. package/dist/components/SettingsButton.d.ts +4 -0
  89. package/dist/components/SettingsButton.js +49 -0
  90. package/dist/components/SettingsModal.d.ts +1 -1
  91. package/dist/components/SettingsModal.js +3 -1
  92. package/dist/components/ShowOutlinesProvider.js +12 -0
  93. package/dist/components/SidebarCollapserControls.js +10 -11
  94. package/dist/components/SizeSelector.js +10 -2
  95. package/dist/components/SkillsSettings.js +2 -3
  96. package/dist/components/SnappingToggle.js +5 -2
  97. package/dist/components/Tabs/vertical.d.ts +1 -0
  98. package/dist/components/Tabs/vertical.js +2 -2
  99. package/dist/components/TimeValue.js +2 -3
  100. package/dist/components/Timeline/SequencePropsObserver.js +4 -0
  101. package/dist/components/Timeline/Timeline.js +2 -42
  102. package/dist/components/Timeline/TimelineClipboardKeybindings.js +2 -4
  103. package/dist/components/Timeline/TimelineDeleteKeybindings.js +3 -18
  104. package/dist/components/Timeline/TimelineDragHandler.js +2 -2
  105. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +1 -0
  106. package/dist/components/Timeline/TimelineRowChrome.js +11 -3
  107. package/dist/components/Timeline/TimelineSchemaField.js +8 -4
  108. package/dist/components/Timeline/TimelineSelection.d.ts +2 -0
  109. package/dist/components/Timeline/TimelineSelection.js +55 -2
  110. package/dist/components/Timeline/TimelineSequence.js +75 -17
  111. package/dist/components/Timeline/TimelineSequenceItem.d.ts +0 -1
  112. package/dist/components/Timeline/TimelineSequenceItem.js +208 -111
  113. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +23 -3
  114. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +73 -25
  115. package/dist/components/Timeline/TimelineTimeIndicators.js +1 -0
  116. package/dist/components/Timeline/use-asset-timeline-context-menu.d.ts +2 -0
  117. package/dist/components/Timeline/use-asset-timeline-context-menu.js +52 -0
  118. package/dist/components/TimelineInOutToggle.js +20 -17
  119. package/dist/components/Transcription/LazyModels.d.ts +1 -0
  120. package/dist/components/Transcription/LazyModels.js +5 -0
  121. package/dist/components/Transcription/Models.d.ts +6 -0
  122. package/dist/components/Transcription/Models.js +18 -0
  123. package/dist/components/Transcription/TranscriptionModal.d.ts +3 -0
  124. package/dist/components/Transcription/TranscriptionModal.js +428 -0
  125. package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.d.ts +5 -0
  126. package/dist/components/Transcription/TranscriptionModalWithOptionalWhisper.js +48 -0
  127. package/dist/components/Transcription/caption-output-name.d.ts +2 -0
  128. package/dist/components/Transcription/caption-output-name.js +10 -0
  129. package/dist/components/Transcription/resample-media-to-16-khz.d.ts +6 -0
  130. package/dist/components/Transcription/resample-media-to-16-khz.js +82 -0
  131. package/dist/components/Transcription/whisper-languages.d.ts +2 -0
  132. package/dist/components/Transcription/whisper-languages.js +104 -0
  133. package/dist/components/Transcription/whisper-webgpu-capability.d.ts +2 -0
  134. package/dist/components/Transcription/whisper-webgpu-capability.js +7 -0
  135. package/dist/components/UndoRedoButtons.js +13 -38
  136. package/dist/components/UpdatesSettings.js +8 -12
  137. package/dist/components/VideoMatting/LazyModels.d.ts +1 -0
  138. package/dist/components/VideoMatting/LazyModels.js +5 -0
  139. package/dist/components/VideoMatting/Models.d.ts +6 -0
  140. package/dist/components/VideoMatting/Models.js +18 -0
  141. package/dist/components/VideoMatting/VideoMattingModal.d.ts +3 -0
  142. package/dist/components/VideoMatting/VideoMattingModal.js +207 -0
  143. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.d.ts +5 -0
  144. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.js +46 -0
  145. package/dist/components/VideoMatting/video-matting-capability.d.ts +2 -0
  146. package/dist/components/VideoMatting/video-matting-capability.js +7 -0
  147. package/dist/components/WebMcp.js +439 -22
  148. package/dist/components/import-assets.d.ts +3 -2
  149. package/dist/components/import-assets.js +5 -9
  150. package/dist/components/keyboard-shortcuts.d.ts +17 -1
  151. package/dist/components/keyboard-shortcuts.js +177 -89
  152. package/dist/components/public-output-name.d.ts +5 -0
  153. package/dist/components/public-output-name.js +60 -0
  154. package/dist/components/use-model-cache-status.d.ts +7 -0
  155. package/dist/components/use-model-cache-status.js +35 -0
  156. package/dist/esm/CaptionQueueProcessor-k0yrm3dj.mjs +211 -0
  157. package/dist/esm/HighlightedElementSource-jfc66k4p.mjs +1236 -0
  158. package/dist/esm/LazyModels-2trdm224.mjs +11 -0
  159. package/dist/esm/LazyModels-fjb5ckaq.mjs +11 -0
  160. package/dist/esm/TranscriptionModal-916jqhry.mjs +1011 -0
  161. package/dist/esm/VideoMattingModal-2tm79s9b.mjs +374 -0
  162. package/dist/esm/VideoMattingQueueProcessor-t1hgm2rm.mjs +109 -0
  163. package/dist/esm/index-1x7bsdh6.mjs +261 -0
  164. package/dist/esm/index-3hgr6gjx.mjs +41 -0
  165. package/dist/esm/index-5qddp5h7.mjs +36 -0
  166. package/dist/esm/index-5zrb1ft4.mjs +39 -0
  167. package/dist/esm/index-6cvm9a65.mjs +45923 -0
  168. package/dist/esm/index-7tt71e8n.mjs +36 -0
  169. package/dist/esm/index-9x6e1dq0.mjs +428 -0
  170. package/dist/esm/index-cw0pnpg5.mjs +50 -0
  171. package/dist/esm/index-czwvnn9g.mjs +35 -0
  172. package/dist/esm/index-hy4xcgty.mjs +1366 -0
  173. package/dist/esm/{chunk-je0h1bgt.js → index-jg13hf2g.mjs} +3 -1
  174. package/dist/esm/{chunk-6jf1natv.js → index-rcv7qkt5.mjs} +18 -1
  175. package/dist/esm/index-sgtmgc4h.mjs +423 -0
  176. package/dist/esm/index-te66vvrp.mjs +142 -0
  177. package/dist/esm/index-v4tr1bft.mjs +20 -0
  178. package/dist/esm/index-x7t2y7ws.mjs +54194 -0
  179. package/dist/esm/index-xhe2m2qr.mjs +1146 -0
  180. package/dist/esm/index.mjs +45 -933
  181. package/dist/esm/internals.mjs +13 -114393
  182. package/dist/esm/previewEntry.mjs +387 -115050
  183. package/dist/esm/renderEntry.mjs +3 -3
  184. package/dist/esm/{chunk-m0jqdbkr.js → resolve-composition-component-location-14148845.mjs} +1 -1
  185. package/dist/helpers/drag-aware-double-click.d.ts +2 -1
  186. package/dist/helpers/drag-aware-double-click.js +12 -1
  187. package/dist/helpers/get-asset-metadata.d.ts +1 -0
  188. package/dist/helpers/get-asset-metadata.js +4 -0
  189. package/dist/helpers/hoverable.js +8 -0
  190. package/dist/helpers/inject-css.js +2 -0
  191. package/dist/helpers/optional-package-dependencies.d.ts +3 -0
  192. package/dist/helpers/optional-package-dependencies.js +24 -0
  193. package/dist/helpers/pointer-session.d.ts +6 -0
  194. package/dist/helpers/pointer-session.js +36 -14
  195. package/dist/helpers/prism-tomorrow.d.ts +1 -0
  196. package/dist/helpers/prism-tomorrow.js +151 -0
  197. package/dist/helpers/sequence-node-path-mutations.js +11 -0
  198. package/dist/helpers/slugify-name.d.ts +1 -0
  199. package/dist/helpers/slugify-name.js +14 -0
  200. package/dist/helpers/studio-runtime-config.d.ts +1 -0
  201. package/dist/helpers/studio-runtime-config.js +6 -1
  202. package/dist/helpers/use-keybinding.d.ts +9 -3
  203. package/dist/helpers/use-keybinding.js +8 -9
  204. package/dist/helpers/use-keyboard-shortcut-label.d.ts +2 -0
  205. package/dist/helpers/use-keyboard-shortcut-label.js +15 -0
  206. package/dist/helpers/use-menu-structure.js +58 -13
  207. package/dist/icons/input-props.d.ts +1 -1
  208. package/dist/icons/input-props.js +2 -2
  209. package/dist/icons/models.d.ts +4 -0
  210. package/dist/icons/models.js +7 -0
  211. package/dist/icons/separation.d.ts +4 -0
  212. package/dist/icons/separation.js +7 -0
  213. package/dist/icons/transcription.d.ts +4 -0
  214. package/dist/icons/transcription.js +7 -0
  215. package/dist/icons/upload.js +1 -1
  216. package/dist/state/modals.d.ts +14 -2
  217. package/package.json +34 -20
  218. package/dist/components/UpdateCheck.d.ts +0 -1
  219. package/dist/components/UpdateCheck.js +0 -79
  220. package/dist/esm/chunk-3netyjd9.js +0 -99793
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VideoMattingQueueItem = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const colors_1 = require("../../helpers/colors");
7
+ const url_state_1 = require("../../helpers/url-state");
8
+ const ellipsis_1 = require("../../icons/ellipsis");
9
+ const InlineAction_1 = require("../InlineAction");
10
+ const InlineDropdown_1 = require("../InlineDropdown");
11
+ const layout_1 = require("../layout");
12
+ const use_select_asset_1 = require("../use-select-asset");
13
+ const CircularProgress_1 = require("./CircularProgress");
14
+ const context_1 = require("./context");
15
+ const item_style_1 = require("./item-style");
16
+ const SuccessIcon_1 = require("./SuccessIcon");
17
+ const container = {
18
+ borderRadius: 4,
19
+ display: 'flex',
20
+ marginBottom: 1,
21
+ marginLeft: 4,
22
+ padding: 12,
23
+ paddingBottom: 10,
24
+ paddingRight: 4,
25
+ width: 'calc(100% - 4px)',
26
+ };
27
+ const title = { fontSize: 13, lineHeight: 1 };
28
+ const right = {
29
+ display: 'flex',
30
+ flex: 1,
31
+ flexDirection: 'column',
32
+ overflow: 'hidden',
33
+ };
34
+ const subtitle = {
35
+ ...item_style_1.renderQueueItemSubtitleStyle,
36
+ cursor: 'default',
37
+ };
38
+ const subtitles = {
39
+ display: 'flex',
40
+ flexDirection: 'column',
41
+ overflow: 'hidden',
42
+ };
43
+ const statusIcon = {
44
+ height: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
45
+ width: CircularProgress_1.RENDER_STATUS_INDICATOR_SIZE,
46
+ };
47
+ const removeIcon = { color: colors_1.CURRENT_COLOR, height: 16 };
48
+ const ellipsisIconStyle = {
49
+ style: { height: 12 },
50
+ };
51
+ const Status = ({ job }) => {
52
+ if (job.status === 'running') {
53
+ return (jsx_runtime_1.jsx("div", { style: statusIcon, role: "progressbar", "aria-label": "Video matting progress", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(job.progress.value * 100), "aria-valuetext": job.progress.message, children: jsx_runtime_1.jsx(CircularProgress_1.CircularProgress, { progress: Math.max(0.07, job.progress.value) }) }));
54
+ }
55
+ if (job.status === 'done')
56
+ return jsx_runtime_1.jsx(SuccessIcon_1.SuccessIcon, {});
57
+ if (job.status === 'failed')
58
+ return (jsx_runtime_1.jsx("svg", { style: statusIcon, viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: colors_1.FAIL_COLOR, d: "M0 160V352L160 512H352L512 352V160L352 0H160L0 160zm353.9 32-64 64 64 64L320 353.9l-64-64-64 64L158.1 320l64-64-64-64L192 158.1l64 64 64-64z" }) }));
59
+ return (jsx_runtime_1.jsx("svg", { style: statusIcon, viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: colors_1.LIGHT_TEXT, d: "M256 512C114.6 512 0 397.4 0 256S114.6 0 256 0s256 114.6 256 256-114.6 256-256 256zM232 120v136c0 8 4 15.5 10.7 20l96 64 26.6-39.9-85.3-56.9V120z" }) }));
60
+ };
61
+ const VideoMattingQueueItem = ({ job, selected }) => {
62
+ const [hovered, setHovered] = (0, react_1.useState)(false);
63
+ const { removeVideoMattingJob } = (0, react_1.useContext)(context_1.RenderQueueContext);
64
+ const selectAsset = (0, use_select_asset_1.useSelectAsset)();
65
+ const done = job.status === 'done';
66
+ const style = (0, react_1.useMemo)(() => ({
67
+ ...container,
68
+ backgroundColor: (0, colors_1.getBackgroundFromHoverState)({
69
+ hovered: done && hovered,
70
+ selected,
71
+ }),
72
+ userSelect: 'none',
73
+ }), [done, hovered, selected]);
74
+ const messages = job.status === 'idle'
75
+ ? ['Queued for video matting']
76
+ : job.status === 'running'
77
+ ? [job.progress.message, job.progress.detail].filter((message) => message !== null)
78
+ : job.status === 'failed'
79
+ ? [job.error.message]
80
+ : [job.baseOutName, job.foregroundOutName];
81
+ const tooltip = messages.join('\n');
82
+ const revealAsset = (0, react_1.useCallback)((assetName) => {
83
+ selectAsset(assetName);
84
+ (0, url_state_1.pushUrl)(`/assets/${assetName}`);
85
+ }, [selectAsset]);
86
+ const onClick = (0, react_1.useCallback)(() => {
87
+ if (!done)
88
+ return;
89
+ revealAsset(job.foregroundOutName);
90
+ }, [done, job.foregroundOutName, revealAsset]);
91
+ const revealItems = (0, react_1.useMemo)(() => {
92
+ return [
93
+ {
94
+ disabled: false,
95
+ id: 'reveal-foreground',
96
+ keyHint: null,
97
+ label: 'Reveal foreground',
98
+ leftItem: null,
99
+ onClick: () => revealAsset(job.foregroundOutName),
100
+ quickSwitcherLabel: null,
101
+ subMenu: null,
102
+ type: 'item',
103
+ value: 'reveal-foreground',
104
+ },
105
+ {
106
+ disabled: false,
107
+ id: 'reveal-background',
108
+ keyHint: null,
109
+ label: 'Reveal background',
110
+ leftItem: null,
111
+ onClick: () => revealAsset(job.baseOutName),
112
+ quickSwitcherLabel: null,
113
+ subMenu: null,
114
+ type: 'item',
115
+ value: 'reveal-background',
116
+ },
117
+ ];
118
+ }, [job.baseOutName, job.foregroundOutName, revealAsset]);
119
+ const onRemove = (0, react_1.useCallback)((event) => {
120
+ event.stopPropagation();
121
+ removeVideoMattingJob(job.id);
122
+ }, [job.id, removeVideoMattingJob]);
123
+ const renderRemove = (0, react_1.useCallback)((color) => (jsx_runtime_1.jsx("svg", { style: removeIcon, viewBox: "0 0 320 512", children: jsx_runtime_1.jsx("path", { fill: color, d: "M310.6 150.6 205.3 256l105.3 105.4-45.3 45.3L160 301.3 54.6 406.6 9.4 361.4 114.7 256 9.4 150.6l45.2-45.2L160 210.7l105.3-105.3z" }) })), []);
124
+ return (jsx_runtime_1.jsxs(layout_1.Row, { "data-render-queue-item": job.id, style: style, align: "center", onClick: onClick, onPointerEnter: () => setHovered(true), onPointerLeave: () => setHovered(false), children: [
125
+ jsx_runtime_1.jsx(Status, { job: job }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), jsx_runtime_1.jsxs("div", { style: right, children: [
126
+ jsx_runtime_1.jsx("div", { style: title, children: job.displayName }), jsx_runtime_1.jsx("div", { style: subtitles, title: tooltip, children: messages.map((message) => (jsx_runtime_1.jsx("span", { style: subtitle, children: message }, message))) })
127
+ ] }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 }), done ? (jsx_runtime_1.jsx(InlineDropdown_1.InlineDropdown, { renderAction: (color) => (jsx_runtime_1.jsx(ellipsis_1.EllipsisIcon, { fill: color, svgProps: ellipsisIconStyle })), title: "Reveal video layer", values: revealItems, variant: null })) : null, job.status === 'running' ? null : (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { renderAction: renderRemove, onClick: onRemove, title: "Remove", variant: null }))] }));
128
+ };
129
+ exports.VideoMattingQueueItem = VideoMattingQueueItem;
@@ -0,0 +1 @@
1
+ export declare const VideoMattingQueueProcessor: React.FC;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VideoMattingQueueProcessor = void 0;
4
+ const video_matting_1 = require("@remotion/video-matting");
5
+ const react_1 = require("react");
6
+ const write_static_file_1 = require("../../api/write-static-file");
7
+ const context_1 = require("./context");
8
+ const load_model_for_job_1 = require("./load-model-for-job");
9
+ const VideoMattingQueueProcessor = () => {
10
+ const { markVideoMattingJobDone, markVideoMattingJobFailed, setProcessVideoMattingJobCallback, updateVideoMattingJobProgress, } = (0, react_1.useContext)(context_1.RenderQueueContext);
11
+ const processJob = (0, react_1.useCallback)(async (job) => {
12
+ let outputs = null;
13
+ let processingError = null;
14
+ try {
15
+ updateVideoMattingJobProgress(job.id, {
16
+ detail: null,
17
+ message: 'Checking WebGPU support...',
18
+ value: 0,
19
+ });
20
+ const support = await (0, video_matting_1.canUseVideoMatting)({ model: job.model });
21
+ if (!support.supported) {
22
+ throw new Error(support.detailedReason);
23
+ }
24
+ await (0, load_model_for_job_1.loadModelForJob)({
25
+ model: job.model,
26
+ progressStart: 0,
27
+ progressSpan: 0.2,
28
+ isModelCached: (model) => (0, video_matting_1.isVideoMattingModelCached)({ model }),
29
+ loadModel: (model, onProgress) => (0, video_matting_1.loadVideoMattingModel)({
30
+ model,
31
+ onProgress: (progress) => onProgress(progress.progress),
32
+ }),
33
+ updateProgress: (progress) => updateVideoMattingJobProgress(job.id, {
34
+ ...progress,
35
+ detail: null,
36
+ }),
37
+ });
38
+ outputs = await (0, video_matting_1.separateVideoLayers)({
39
+ src: job.src,
40
+ model: job.model,
41
+ audio: job.audio,
42
+ videoBitrate: job.videoBitrate,
43
+ onProgress: (progress) => {
44
+ var _a;
45
+ updateVideoMattingJobProgress(job.id, {
46
+ detail: progress.stage === 'finalizing'
47
+ ? `Processed ${progress.processedFrames} ${progress.processedFrames === 1 ? 'frame' : 'frames'}`
48
+ : `Processed ${progress.processedFrames} ${progress.processedFrames === 1 ? 'frame' : 'frames'} · ${Math.round(progress.progress * 100)}%`,
49
+ message: progress.stage === 'finalizing'
50
+ ? 'Finalizing video layers...'
51
+ : 'Separating foreground...',
52
+ value: 0.2 + ((_a = progress.progress) !== null && _a !== void 0 ? _a : 1) * 0.65,
53
+ });
54
+ },
55
+ });
56
+ updateVideoMattingJobProgress(job.id, {
57
+ detail: null,
58
+ message: 'Saving video layers...',
59
+ value: 0.88,
60
+ });
61
+ const [base, foreground] = await Promise.all([
62
+ outputs.base.getBlob(),
63
+ outputs.foreground.getBlob(),
64
+ ]);
65
+ await Promise.all([
66
+ base
67
+ .arrayBuffer()
68
+ .then((contents) => (0, write_static_file_1.writeStaticFile)({ contents, filePath: job.baseOutName })),
69
+ foreground
70
+ .arrayBuffer()
71
+ .then((contents) => (0, write_static_file_1.writeStaticFile)({ contents, filePath: job.foregroundOutName })),
72
+ ]);
73
+ }
74
+ catch (error) {
75
+ processingError =
76
+ error instanceof Error ? error : new Error(String(error));
77
+ }
78
+ try {
79
+ await Promise.all([
80
+ outputs === null || outputs === void 0 ? void 0 : outputs.base.dispose(),
81
+ outputs === null || outputs === void 0 ? void 0 : outputs.foreground.dispose(),
82
+ ]);
83
+ await (0, video_matting_1.disposeVideoMattingModel)({ model: job.model });
84
+ }
85
+ catch (_a) {
86
+ // Cleanup errors must not hide successfully written outputs.
87
+ }
88
+ if (processingError) {
89
+ markVideoMattingJobFailed(job.id, processingError);
90
+ }
91
+ else {
92
+ markVideoMattingJobDone(job.id);
93
+ }
94
+ }, [
95
+ markVideoMattingJobDone,
96
+ markVideoMattingJobFailed,
97
+ updateVideoMattingJobProgress,
98
+ ]);
99
+ (0, react_1.useEffect)(() => {
100
+ setProcessVideoMattingJobCallback(processJob);
101
+ return () => setProcessVideoMattingJobCallback(null);
102
+ }, [processJob, setProcessVideoMattingJobCallback]);
103
+ return null;
104
+ };
105
+ exports.VideoMattingQueueProcessor = VideoMattingQueueProcessor;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const VideoMattingQueueProcessorLoader: React.FC;
@@ -0,0 +1,54 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.VideoMattingQueueProcessorLoader = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const react_1 = __importStar(require("react"));
39
+ const OptionalPackageModal_1 = require("../OptionalPackageModal");
40
+ const video_matting_capability_1 = require("../VideoMatting/video-matting-capability");
41
+ const context_1 = require("./context");
42
+ const LazyProcessor = react_1.default.lazy(async () => {
43
+ const { VideoMattingQueueProcessor } = await Promise.resolve().then(() => __importStar(require('./VideoMattingQueueProcessor')));
44
+ return { default: VideoMattingQueueProcessor };
45
+ });
46
+ const VideoMattingQueueProcessorLoader = () => {
47
+ const installed = (0, OptionalPackageModal_1.useOptionalPackageInstalled)(video_matting_capability_1.VIDEO_MATTING_PACKAGE);
48
+ const { videoMattingJobs } = (0, react_1.useContext)(context_1.RenderQueueContext);
49
+ if (!installed || videoMattingJobs.length === 0) {
50
+ return null;
51
+ }
52
+ return (jsx_runtime_1.jsx(react_1.Suspense, { fallback: null, children: jsx_runtime_1.jsx(LazyProcessor, {}) }));
53
+ };
54
+ exports.VideoMattingQueueProcessorLoader = VideoMattingQueueProcessorLoader;
@@ -0,0 +1,47 @@
1
+ import type { WhisperWebGpuModel, WhisperWebGpuTask } from '@remotion/whisper-webgpu';
2
+ export type CaptionJobProgress = {
3
+ message: string;
4
+ value: number;
5
+ };
6
+ type CaptionJobStatus = {
7
+ status: 'idle';
8
+ } | {
9
+ status: 'running';
10
+ progress: CaptionJobProgress;
11
+ } | {
12
+ status: 'done';
13
+ captionCount: number;
14
+ } | {
15
+ status: 'failed';
16
+ error: {
17
+ message: string;
18
+ stack: string | undefined;
19
+ };
20
+ };
21
+ export type AddCaptionJobParams = {
22
+ src: string;
23
+ displayName: string;
24
+ audioStreamIndex: number | null;
25
+ requestInit: Omit<RequestInit, 'signal'> | null;
26
+ outName: string;
27
+ model: WhisperWebGpuModel;
28
+ language: string | null;
29
+ task: WhisperWebGpuTask;
30
+ chunkLengthInSeconds: number;
31
+ strideLengthInSeconds: number;
32
+ forceFullSequences: boolean;
33
+ doSample: boolean;
34
+ temperature: number;
35
+ topK: number;
36
+ repetitionPenalty: number;
37
+ noRepeatNgramSize: number;
38
+ };
39
+ export type CaptionJob = AddCaptionJobParams & {
40
+ id: string;
41
+ type: 'caption';
42
+ startedAt: number;
43
+ } & CaptionJobStatus;
44
+ export declare const isCaptionJob: (job: {
45
+ type: string;
46
+ }) => job is CaptionJob;
47
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCaptionJob = void 0;
4
+ const isCaptionJob = (job) => {
5
+ return job.type === 'caption';
6
+ };
7
+ exports.isCaptionJob = isCaptionJob;
@@ -1,7 +1,9 @@
1
1
  import type { CompletedClientRender, RenderJob } from '@remotion/studio-shared';
2
2
  import React from 'react';
3
+ import type { AddCaptionJobParams, CaptionJob, CaptionJobProgress } from './caption-job-types';
3
4
  import { type AddClientStillJobParams, type AddClientVideoJobParams, type CompositionRef } from './client-render-queue';
4
5
  import type { ClientRenderJob, ClientRenderJobProgress, GetBlobCallback } from './client-side-render-types';
6
+ import type { AddVideoMattingJobParams, VideoMattingJob, VideoMattingJobProgress } from './video-matting-job-types';
5
7
  declare global {
6
8
  interface Window {
7
9
  remotion_initialRenderQueue: RenderJob[] | null;
@@ -14,6 +16,8 @@ type RenderQueueContextType = {
14
16
  jobs: AnyRenderJob[];
15
17
  serverJobs: RenderJob[];
16
18
  clientJobs: ClientRenderJob[];
19
+ captionJobs: CaptionJob[];
20
+ videoMattingJobs: VideoMattingJob[];
17
21
  addClientStillJob: (params: AddClientStillJobParams, compositionRef: CompositionRef) => string;
18
22
  addClientVideoJob: (params: AddClientVideoJobParams, compositionRef: CompositionRef) => string;
19
23
  updateClientJobProgress: (jobId: string, progress: ClientRenderJobProgress) => void;
@@ -24,6 +28,18 @@ type RenderQueueContextType = {
24
28
  removeClientJob: (jobId: string) => void;
25
29
  cancelClientJob: (jobId: string) => void;
26
30
  setProcessJobCallback: (callback: ((job: ClientRenderJob) => Promise<void>) | null) => void;
31
+ addCaptionJob: (params: AddCaptionJobParams) => string;
32
+ updateCaptionJobProgress: (jobId: string, progress: CaptionJobProgress) => void;
33
+ markCaptionJobDone: (jobId: string, captionCount: number) => void;
34
+ markCaptionJobFailed: (jobId: string, error: Error) => void;
35
+ removeCaptionJob: (jobId: string) => void;
36
+ setProcessCaptionJobCallback: (callback: ((job: CaptionJob) => Promise<void>) | null) => void;
37
+ addVideoMattingJob: (params: AddVideoMattingJobParams) => string;
38
+ updateVideoMattingJobProgress: (jobId: string, progress: VideoMattingJobProgress) => void;
39
+ markVideoMattingJobDone: (jobId: string) => void;
40
+ markVideoMattingJobFailed: (jobId: string, error: Error) => void;
41
+ removeVideoMattingJob: (jobId: string) => void;
42
+ setProcessVideoMattingJobCallback: (callback: ((job: VideoMattingJob) => Promise<void>) | null) => void;
27
43
  getAbortController: (jobId: string) => AbortController;
28
44
  getCompositionForJob: (jobId: string) => CompositionRef | undefined;
29
45
  };