ugcinc 4.20.0 → 4.22.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.
- package/README.md +59 -0
- package/dist/automations/nodes/index.d.ts +3 -3
- package/dist/automations/nodes/remotion-composition.d.ts +6 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -1
- package/dist/media-analysis.d.ts +3056 -0
- package/dist/media-analysis.js +65 -0
- package/dist/media.d.ts +11 -0
- package/dist/media.js +29 -0
- package/dist/render/compositions/IMessageDmComposition/types.d.ts +8 -8
- package/dist/render/types/remotion-composition.d.ts +14 -14
- package/dist/tools/media.js +6 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -321,3 +321,62 @@ of original upload quality or watermark removal is made.
|
|
|
321
321
|
Both operations require an organization and `content:analyze` for scoped keys.
|
|
322
322
|
Errors may include `errorCode` and `retryable`. Existing scraper credit/rate safeguards
|
|
323
323
|
apply. Storage/provider errors do not imply that a post or profile was deleted.
|
|
324
|
+
|
|
325
|
+
## Video inspection
|
|
326
|
+
|
|
327
|
+
```ts
|
|
328
|
+
const frames = await client.media.extractFrames({url: videoUrl, timestampsMs: [0, 1500, 3000]});
|
|
329
|
+
const scenes = await client.media.detectScenes({url: videoUrl});
|
|
330
|
+
// Recover a pending job without submitting another analysis:
|
|
331
|
+
const status = await client.media.getMediaAnalysis({jobId});
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
These methods use authenticated `POST /media/analysis/extract-frames`,
|
|
335
|
+
`POST /media/analysis/detect-scenes` and `POST /media/analysis/status`.
|
|
336
|
+
They require an organization and `content:analyze`. Agent tools are `extract_frames`,
|
|
337
|
+
`detect_scenes` and the supporting `get_media_analysis` status operation.
|
|
338
|
+
|
|
339
|
+
Extraction accepts either `timestampsMs` (1–48 values, including timestamps from other
|
|
340
|
+
analysis results) or `range: {startMs,endMs,intervalMs}` (end exclusive, maximum 48
|
|
341
|
+
samples). `selection` is `nearest` (default; ties choose the earlier frame), `before`
|
|
342
|
+
or `after`. Times are milliseconds from the first displayed video frame. Out-of-range
|
|
343
|
+
requests fail; `after` fails if no later frame exists. Returned frames include requested
|
|
344
|
+
and actual times, original integer PTS as a string, decoded frame index, dimensions
|
|
345
|
+
and owned PNG URL. Rotation and sample aspect ratio are applied; outputs fit within
|
|
346
|
+
1280 pixels on each axis without upscaling. `contactSheet` defaults to true and returns
|
|
347
|
+
a labeled sheet with cell boxes linked to the individual images. Duplicate requests
|
|
348
|
+
retain their order and may reference the same decoded frame.
|
|
349
|
+
|
|
350
|
+
Scene detection reuses the existing adaptive and brightness/pHash detector and returns
|
|
351
|
+
source-time ranges, frame indices and detector settings. It does not export split MP4s.
|
|
352
|
+
Ranges end exclusively. The last scene ends at video duration; its endPts is null when
|
|
353
|
+
there is no following frame. Boundaries are detector estimates, especially for fades,
|
|
354
|
+
not a guarantee of semantic scenes or an exact creative edit point.
|
|
355
|
+
|
|
356
|
+
Both operations run as bounded worker jobs. SDK/tool calls make up to 180 status polls, spaced two seconds apart;
|
|
357
|
+
check `data.status`: pending/processing includes `jobId` for subsequent status calls,
|
|
358
|
+
completed includes `result`, and failed includes an explicit error. A successful HTTP
|
|
359
|
+
response does not imply job completion. Status handles belong to their organization
|
|
360
|
+
and expire after seven days. Each submission analyzes the current source bytes rather
|
|
361
|
+
than caching by URL. Results include source SHA-256, encoded/display dimensions,
|
|
362
|
+
rotation, time base, source starting PTS, decoded frame count and an owned manifest.
|
|
363
|
+
Video URLs must be public HTTPS sources. Limits: 100 MB, 30 minutes, 4096 pixels per
|
|
364
|
+
encoded dimension, 120,000 decoded frames. Unsupported/malformed media fails explicitly.
|
|
365
|
+
|
|
366
|
+
### Image and video OCR
|
|
367
|
+
|
|
368
|
+
Quick reference: `client.media.readImageText({url})`, `client.media.readVideoText({url, mode, range?, intervalMs?})`; agent tools `read_image_text` and `read_video_text`. Both use the authenticated analysis job/status flow above.
|
|
369
|
+
|
|
370
|
+
```ts
|
|
371
|
+
const imageText = await client.media.readImageText({url: imageUrl});
|
|
372
|
+
const sampledText = await client.media.readVideoText({url: videoUrl, mode: 'fast', intervalMs: 1000});
|
|
373
|
+
const everyFrame = await client.media.readVideoText({url: videoUrl, mode: 'frame_scan', range: {startMs: 0, endMs: 5000}});
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
`POST /media/analysis/read-image-text` accepts an HTTPS image URL. Results contain `regions` (raw recognized text, four-point polygon, enclosing box, model confidence, readable/unreadable status), inferred `lines` with region IDs and reading order, source dimensions/hash, model details, `previewUrl` and `manifestUrl`. Coordinates are pixels after EXIF orientation; transparent pixels are composited on white. English recognition only; no guaranteed reading order for columns or inverted text. Low-confidence candidates retain `rawText` but return `text: null`. Undetected text cannot be marked unreadable, and empty output does not prove absence. Images must be static, at most 4096 pixels per axis /16 megapixels, and at most 100 MiB.
|
|
377
|
+
|
|
378
|
+
`POST /media/analysis/read-video-text` accepts a video URL, `mode` (`fast` default or `frame_scan`), optional `{startMs,endMs}` range and optional `intervalMs` (fast only, default1000, minimum100). Range end is exclusive; range defaults to the whole clip. A request may cover at most120 seconds and inspect at most240 frames; split longer frame scans into ranges. Invalid/excessive requests fail explicitly, never silently truncate. Times are relative to the first displayed frame; original `sourcePts` and time base are retained. The frame displayed at a partial range's start is included, so its source timestamp can precede `startMs`.
|
|
379
|
+
|
|
380
|
+
Results include per-frame regions/lines, up to eight annotated frame previews, heuristic text `tracks` with observed boxes, and `coverage.inspected` plus `coverage.uninspected`. `coverage.complete` means all displayed frames within the range were inspected, not that OCR found every word. A track's `firstObservedMs` / `lastObservedEndMs` bounds observations; it does not prove uninterrupted visibility between sampled frames. Fast mode can miss brief text entirely. Fully scanned recognized single-frame text retains its decoded frame interval. Recognition scores are not calibrated probabilities. Track identity, scene-change rejection and line grouping are estimates; use individual observations and polygons for evidence.
|
|
381
|
+
|
|
382
|
+
Both methods return `ApiResponse<MediaAnalysisJob>`, waiting through up to180 two-second status polls. A pending/processing response retains `jobId`; resume with `getMediaAnalysis({jobId})`. Job results include model/runtime versions and SHA-256 checksums. These CPU jobs share the existing bounded analysis queue. A failed job does not return partial OCR as complete.
|
|
@@ -333,18 +333,18 @@ export declare const nodeDefinitions: {
|
|
|
333
333
|
__TOutputs: import("./screenshot-animation").ScreenshotAnimationNodeOutputs;
|
|
334
334
|
};
|
|
335
335
|
readonly 'remotion-composition': NodeDefinition<"remotion-composition", "generator", {
|
|
336
|
+
width: number;
|
|
337
|
+
height: number;
|
|
336
338
|
source: string;
|
|
337
339
|
outputMode: "per-input" | "single";
|
|
338
340
|
selectionMode: null;
|
|
339
341
|
outputType: "video" | "image";
|
|
340
342
|
inputs: {
|
|
341
|
-
type: "number" | "boolean" | "object" | "video" | "image" | "
|
|
343
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "text" | "audio";
|
|
342
344
|
id: string;
|
|
343
345
|
isArray: boolean;
|
|
344
346
|
required: boolean;
|
|
345
347
|
}[];
|
|
346
|
-
width: number;
|
|
347
|
-
height: number;
|
|
348
348
|
fps: number;
|
|
349
349
|
durationInFrames: number;
|
|
350
350
|
inputProps: Record<string, unknown>;
|
|
@@ -4,35 +4,35 @@ type Outputs = {
|
|
|
4
4
|
output: VideoValue;
|
|
5
5
|
};
|
|
6
6
|
declare const defaults: {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
7
9
|
source: string;
|
|
8
10
|
outputMode: "per-input" | "single";
|
|
9
11
|
selectionMode: null;
|
|
10
12
|
outputType: "video" | "image";
|
|
11
13
|
inputs: {
|
|
12
|
-
type: "number" | "boolean" | "object" | "video" | "image" | "
|
|
14
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "text" | "audio";
|
|
13
15
|
id: string;
|
|
14
16
|
isArray: boolean;
|
|
15
17
|
required: boolean;
|
|
16
18
|
}[];
|
|
17
|
-
width: number;
|
|
18
|
-
height: number;
|
|
19
19
|
fps: number;
|
|
20
20
|
durationInFrames: number;
|
|
21
21
|
inputProps: Record<string, unknown>;
|
|
22
22
|
};
|
|
23
23
|
declare const _default: import("./types").NodeDefinition<"remotion-composition", "generator", {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
24
26
|
source: string;
|
|
25
27
|
outputMode: "per-input" | "single";
|
|
26
28
|
selectionMode: null;
|
|
27
29
|
outputType: "video" | "image";
|
|
28
30
|
inputs: {
|
|
29
|
-
type: "number" | "boolean" | "object" | "video" | "image" | "
|
|
31
|
+
type: "number" | "boolean" | "object" | "video" | "image" | "text" | "audio";
|
|
30
32
|
id: string;
|
|
31
33
|
isArray: boolean;
|
|
32
34
|
required: boolean;
|
|
33
35
|
}[];
|
|
34
|
-
width: number;
|
|
35
|
-
height: number;
|
|
36
36
|
fps: number;
|
|
37
37
|
durationInFrames: number;
|
|
38
38
|
inputProps: Record<string, unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -86,3 +86,5 @@ export type { SuccessResponse, ErrorResponse, ApiResponse, } from './types';
|
|
|
86
86
|
export type { CropBoundary, CropAxisConfig, DynamicCropConfig, BorderRadiusConfig, VerticalAnchor, HorizontalAnchor, HorizontalSelfAnchor, VerticalSelfAnchor, RelativePositionConfigX, RelativePositionConfigY, } from './render/types';
|
|
87
87
|
export type { PublicPostFailureCode, PublicPostRecovery, PublicPostNextAction, PublicPostFailure } from './post-failure';
|
|
88
88
|
export type { ListProfilePostsParams, ListProfilePostsResult, DownloadSocialPostParams, DownloadSocialPostResult, SocialReferencePost, SocialReferenceAsset } from './social-acquisition';
|
|
89
|
+
export type { ReadImageTextParams, ReadVideoTextParams, ImageTextResult, VideoTextResult, ExtractFramesParams, DetectScenesParams, FramesResult, ScenesResult, MediaAnalysisResult, MediaAnalysisJob } from "./media-analysis";
|
|
90
|
+
export { readImageTextSchema, readVideoTextSchema, imageTextResultSchema, videoTextResultSchema, extractFramesSchema, detectScenesSchema, mediaAnalysisStatusSchema, mediaAnalysisResultSchema } from "./media-analysis";
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.hasMissingTriggerError = exports.getPortErrorsForNode = exports.getErrorNodeIds = exports.validateWorkflow = exports.getCapturedNodes = exports.getNodesDownstreamOfSet = exports.getDownstreamNodes = exports.checkCrossContextViolation = exports.getForEachContext = exports.getConnectedSource = exports.cleanupStaleConnections = exports.removeNodeConnections = exports.removeConnection = exports.addConnection = exports.deriveConnections = exports.createNode = exports.getOutputSchema = exports.getNodeByType = exports.getAllNodes = exports.getInputPreviewValue = exports.computeAllNodePortsWithPreviews = exports.computeAllNodePorts = exports.computePortsWithPreviews = exports.computePortsForNode = exports.areTypesCompatible = exports.parseRemotionPropsJson = exports.REMOTION_COMPOSITION_IMPORTS = exports.remotionCompositionPortSchema = exports.remotionCompositionNodeSchema = exports.remotionCompositionSchema = exports.submitIMessageDmRenderJob = exports.submitInstagramDmRenderJob = exports.submitAutoCaptionRenderJob = exports.submitRemotionCompositionRenderJob = exports.submitScreenshotAnimationRenderJob = exports.submitSceneSplitJob = exports.submitDeduplicationJob = exports.getRenderJobStatus = exports.submitVideoRenderJob = exports.submitImageRenderJob = exports.BillingClient = exports.CommentsClient = exports.MediaClient = exports.AutomationsClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
|
|
9
9
|
exports.parseOpenAPIOutputPath = exports.parseOpenAPIInputs = exports.mapOpenAPIType = exports.nodeConfigToCaptionStyle = exports.HttpMethods = exports.prepareImageComposerInput = exports.substituteVariables = exports.processTemplate = exports.extractTemplateVariables = exports.PortIdSchema = exports.normalizeToPortId = exports.portIdToTitle = exports.isValidPortId = exports.portId = exports.selectFromPool = exports.getModelDurations = exports.getModelAspectRatios = exports.ALL_VIDEO_MODELS = exports.getAvailableInputModes = exports.hasReferenceVariant = exports.getReferenceModelId = exports.hasFirstLastFrameVariant = exports.getFirstLastFrameModelId = exports.hasImageToVideoVariant = exports.getImageToVideoModelId = exports.isImageToVideoModel = exports.IMAGE_ASPECT_RATIOS = exports.ALL_IMAGE_MODELS = exports.getEditModelId = exports.isEditModel = exports.getCapturedSourceNodeTypes = exports.getFlowControlNodeTypes = exports.getAllNodeDefinitions = exports.getNodeDefinition = exports.isPortType = exports.formatPortType = exports.isAsyncExecutor = exports.internalNodeTypes = exports.nodeDefinitions = exports.extractWorkflowConfig = exports.generateNodeName = exports.shuffleNodePreview = exports.getPreviewValue = exports.removePreviewForConnection = exports.updatePreviewMapForConnection = exports.computePreviewMap = exports.computeAllNodePreviews = exports.resolveNodePreview = exports.getWorkflowOutputSchema = exports.hasMissingTerminalError = void 0;
|
|
10
|
-
exports.prepareVideoComposerInput = exports.formatDateTag = exports.outputFieldsToZod = exports.outputFieldToZod = exports.LLMProviders = exports.applyLogicOperator = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToString = exports.indexExpressionToIndexes = exports.resolveUnknownPath = exports.getOutputTypeFromCategory = void 0;
|
|
10
|
+
exports.mediaAnalysisResultSchema = exports.mediaAnalysisStatusSchema = exports.detectScenesSchema = exports.extractFramesSchema = exports.videoTextResultSchema = exports.imageTextResultSchema = exports.readVideoTextSchema = exports.readImageTextSchema = exports.prepareVideoComposerInput = exports.formatDateTag = exports.outputFieldsToZod = exports.outputFieldToZod = exports.LLMProviders = exports.applyLogicOperator = exports.IfLogicOperators = exports.resolvePath = exports.indexExpressionToString = exports.indexExpressionToIndexes = exports.resolveUnknownPath = exports.getOutputTypeFromCategory = void 0;
|
|
11
11
|
// =============================================================================
|
|
12
12
|
// Client Exports
|
|
13
13
|
// =============================================================================
|
|
@@ -174,3 +174,12 @@ var save_to_media_1 = require("./automations/nodes/save-to-media");
|
|
|
174
174
|
Object.defineProperty(exports, "formatDateTag", { enumerable: true, get: function () { return save_to_media_1.formatDateTag; } });
|
|
175
175
|
var video_composer_1 = require("./automations/nodes/video-composer");
|
|
176
176
|
Object.defineProperty(exports, "prepareVideoComposerInput", { enumerable: true, get: function () { return video_composer_1.prepareVideoComposerInput; } });
|
|
177
|
+
var media_analysis_1 = require("./media-analysis");
|
|
178
|
+
Object.defineProperty(exports, "readImageTextSchema", { enumerable: true, get: function () { return media_analysis_1.readImageTextSchema; } });
|
|
179
|
+
Object.defineProperty(exports, "readVideoTextSchema", { enumerable: true, get: function () { return media_analysis_1.readVideoTextSchema; } });
|
|
180
|
+
Object.defineProperty(exports, "imageTextResultSchema", { enumerable: true, get: function () { return media_analysis_1.imageTextResultSchema; } });
|
|
181
|
+
Object.defineProperty(exports, "videoTextResultSchema", { enumerable: true, get: function () { return media_analysis_1.videoTextResultSchema; } });
|
|
182
|
+
Object.defineProperty(exports, "extractFramesSchema", { enumerable: true, get: function () { return media_analysis_1.extractFramesSchema; } });
|
|
183
|
+
Object.defineProperty(exports, "detectScenesSchema", { enumerable: true, get: function () { return media_analysis_1.detectScenesSchema; } });
|
|
184
|
+
Object.defineProperty(exports, "mediaAnalysisStatusSchema", { enumerable: true, get: function () { return media_analysis_1.mediaAnalysisStatusSchema; } });
|
|
185
|
+
Object.defineProperty(exports, "mediaAnalysisResultSchema", { enumerable: true, get: function () { return media_analysis_1.mediaAnalysisResultSchema; } });
|