@@ -16,15 +16,44 @@ import kotlin.math.abs
1616import kotlin.math.min
1717
1818/* *
19- * Extracts frames from video files at specific timestamps or intervals
19+ * Extracts frames from video files at specific timestamps or intervals.
20+ *
21+ * Supports three extraction modes:
22+ * - `timestamps`: Array of specific timestamps in seconds
23+ * - `interval`: Extract every N seconds (with optional startTime/endTime/maxFrames)
24+ * - `count`: Extract N evenly-spaced frames
25+ *
26+ * If no mode is specified, extracts a single frame at t=0.
27+ *
28+ * **Supported source types:** `file`, `url` only (asset not supported on Android)
29+ *
30+ * **Output formats:**
31+ * - `base64` (default): JPEG encoded, quality 0-100 (default 90)
32+ * - `pixelData`: Raw pixel arrays with optional colorFormat/normalization
33+ *
34+ * **Note:** `colorFormat` and `normalization` only apply when `outputFormat === "pixelData"`.
35+ *
36+ * Per-frame extraction errors are captured in the frame's `error` field; extraction continues for remaining frames.
2037 */
2138object VideoFrameExtractorAndroid {
2239
2340 /* *
2441 * Extract frames from a video file
25- * @param source Video source (file path or URL)
26- * @param options Extraction options (timestamps, interval, resize, etc.)
27- * @return Map with extracted frames and metadata
42+ *
43+ * @param source Video source with `type` (file/url) and `value` (path or URL string).
44+ * Note: `asset` type is NOT supported on Android.
45+ * @param options Extraction options:
46+ * - `timestamps`: DoubleArray - specific timestamps in seconds
47+ * - `interval`: Double - extract every N seconds
48+ * - `count`: Int - number of evenly-spaced frames
49+ * - `startTime`/`endTime`: Double - range for interval/count modes
50+ * - `maxFrames`: Int - limit for interval mode (default 100)
51+ * - `resize`: {width: Int, height: Int} - resize frames
52+ * - `outputFormat`: "base64" (default) or "pixelData"
53+ * - `quality`: Int 0-100 (default 90) - JPEG quality for base64
54+ * - `colorFormat`: String - for pixelData (rgb/rgba/bgr/grayscale)
55+ * - `normalization`: {preset: String} - for pixelData (scale/imagenet/tensorflow)
56+ * @return WritableMap with `frames`, `frameCount`, `videoDuration`, `videoWidth`, `videoHeight`, `frameRate`, `processingTimeMs`
2857 */
2958 fun extractFrames (source : ReadableMap , options : ReadableMap ): WritableMap {
3059 val startTime = System .currentTimeMillis()
0 commit comments