diff --git a/.changeset/speaker-label-flags.md b/.changeset/speaker-label-flags.md new file mode 100644 index 00000000..2d84a608 --- /dev/null +++ b/.changeset/speaker-label-flags.md @@ -0,0 +1,10 @@ +--- +'@transloadit/node': minor +'transloadit': minor +'@transloadit/mcp-server': patch +--- + +Add `--speaker-labels` and `--max-speakers` to `transloadit speech transcribe`. With +`--speaker-labels` and no `--provider`, the API picks a provider that can label speakers instead of +the CLI forcing `replicate`; combining it with `--provider replicate`, or `--max-speakers` without +`--speaker-labels`, fails before an Assembly is created. diff --git a/packages/node/README.md b/packages/node/README.md index 46ece905..3a32ed30 100644 --- a/packages/node/README.md +++ b/packages/node/README.md @@ -440,6 +440,7 @@ npx transloadit preview generate --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | | `--format` | `string` | no | `jpg` | The output format for the generated thumbnail image. If a short video clip is generated using the clip strategy, its format is defined by clip_format. | +| `--quality` | `number` | no | `1` | Compression quality for still previews, from 1 to 100. When specified, the final image resize encodes directly into the requested format at this quality and strips embedded… | | `--width` | `number` | no | `1` | Width of the thumbnail, in pixels. | | `--height` | `number` | no | `1` | Height of the thumbnail, in pixels. | | `--resize-strategy` | `string` | no | `crop` | To achieve the desired dimensions of the preview thumbnail, the Robot might have to resize the generated image. | @@ -456,11 +457,11 @@ npx transloadit preview generate --input [options] | `--icon-text-color` | `string` | no | `value` | The color of the text used in the icon. The format is #rrggbb[aa]. Only used if the icon strategy is applied. | | `--icon-text-font` | `string` | no | `value` | The font family of the text used in the icon. Only used if the icon strategy is applied. Here is a list of all supported fonts. | | `--icon-text-content` | `string` | no | `extension` | The content of the text box in generated icons. Only used if the icon_style parameter is set to with-text. The default value, extension, adds the file extension (e.g. MP4, JPEG)… | -| `--optimize` | `boolean` | no | `true` | Specifies whether the generated preview image should be optimized to reduce the image's file size while keeping their quaility. | +| `--optimize` | `boolean` | no | `true` | Specifies whether the generated preview image should be optimized to reduce its file size while maintaining visual quality. | | `--optimize-priority` | `string` | no | `compression-ratio` | Specifies whether conversion speed or compression ratio is prioritized when optimizing images. | | `--optimize-progressive` | `boolean` | no | `true` | Specifies whether images should be interlaced, which makes the result image load progressively in browsers. | | `--clip-format` | `string` | no | `apng` | The animated image format for the generated video clip. Only used if the clip strategy for video files is applied. Please consult the MDN Web Docs for detailed information about… | -| `--clip-offset` | `number` | no | `1` | The start position in seconds of where the clip is cut. Only used if the clip strategy for video files is applied. Be aware that for larger video only the first few MBs of the… | +| `--clip-offset` | `number` | no | `1` | The start position in seconds of where the clip is cut. Only used if the clip strategy for video files is applied. For large videos, only portions of the file may be imported to… | | `--clip-duration` | `number` | no | `1` | The duration in seconds of the generated video clip. Only used if the clip strategy for video files is applied. Be aware that a longer clip duration also results in a larger file… | | `--clip-framerate` | `number` | no | `1` | The framerate of the generated video clip. Only used if the clip strategy for video files is applied. Be aware that a higher framerate appears smoother but also results in a… | | `--clip-loop` | `boolean` | no | `true` | Specifies whether the generated animated image should loop forever (true) or stop after playing the animation once (false). | @@ -501,7 +502,7 @@ npx transloadit image remove-background --input [options] | --- | --- | --- | --- | --- | | `--select` | `string` | no | `foreground` | Region to select and keep in the image. The other region is removed. | | `--format` | `string` | no | `png` | Format of the generated image. Defaults to PNG when not provided. | -| `--provider` | `string` | no | `aws` | Provider to use for removing the background. | +| `--provider` | `string` | no | `aws` | Chooses the best provider based on your request. Select a specific provider to override automatic selection. | | `--model` | `string` | no | `value` | Provider-specific model to use for removing the background. Mostly intended for testing and evaluation. | **Examples** @@ -539,14 +540,19 @@ npx transloadit image merge --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | | `--format` | `string` | no | `jpg` | The output format for the modified image. | -| `--direction` | `string` | no | `horizontal` | Specifies the direction which the images are displayed. Only applies to the default spritesheet layout. Ignored when effect is set to polaroid-stack or mosaic, as those effects… | +| `--direction` | `string` | no | `horizontal` | Specifies the direction which the images are displayed. Use grid to arrange inputs left-to-right and top-to-bottom. Only applies to the default spritesheet layout. Ignored when… | | `--effect` | `string` | no | `mosaic` | Applies a styled collage layout instead of a plain horizontal or vertical spritesheet. | +| `--columns` | `number` | no | `1` | Number of columns in the grid layout. Only applies when direction is grid. If omitted, columns are calculated automatically from the number of inputs and requested rows. | +| `--rows` | `number` | no | `1` | Number of rows in the grid layout. Only applies when direction is grid. If omitted, rows are calculated automatically from the number of inputs and requested columns. | +| `--cell-width` | `number` | no | `1` | Uniform width for each grid cell in pixels. Only applies when direction is grid. Images are resized to fit within the cell while preserving aspect ratio. | +| `--cell-height` | `number` | no | `1` | Uniform height for each grid cell in pixels. Only applies when direction is grid. Images are resized to fit within the cell while preserving aspect ratio. | | `--border` | `number` | no | `1` | An integer value which defines the gap between images on the spritesheet. | | `--background` | `string` | no | `transparent` | Either the hexadecimal code or name of the color used to fill the background (only shown with a border > 1). | | `--width` | `number` | no | `1` | The output canvas width in pixels. This is mainly used by styled effects such as polaroid-stack and mosaic. | | `--height` | `number` | no | `1` | The output canvas height in pixels. This is mainly used by styled effects such as polaroid-stack and mosaic. | | `--seed` | `number` | no | `1` | Optional deterministic seed used by styled effects such as polaroid-stack and mosaic. | | `--shuffle` | `boolean` | no | `true` | Whether styled effects such as polaroid-stack and mosaic may shuffle the input order before laying out the canvas. | +| `--sort-by` | `string` | no | `auto` | Controls how bundled inputs are ordered when no explicit numbered alias for the input type is used. | | `--coverage` | `number` | no | `1` | Area-coverage multiplier for the polaroid-stack effect. Controls how large each polaroid is relative to the canvas and consequently how much of the canvas is covered by photos.… | | `--adaptive-filtering` | `boolean` | no | `true` | Controls the image compression for PNG images. Setting to true results in smaller file size, while increasing processing time. It is encouraged to keep this option disabled. | | `--quality` | `number` | no | `1` | Controls the image compression for JPG, PNG, and WebP images. Please also take a look at 🤖/image/optimize. | @@ -631,7 +637,7 @@ npx transloadit image resize --input [options] | `--resize-strategy` | `string` | no | `crop` | See the list of available resize strategies. | | `--zoom` | `boolean` | no | `true` | If this is set to false, smaller images will not be stretched to the desired width and height. | | `--crop` | `auto` | no | `value` | Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original image(s). | -| `--gravity` | `string` | no | `bottom` | The direction from which the image is to be cropped, when "resize_strategy" is set to "crop", but no crop coordinates are defined. | +| `--gravity` | `string` | no | `bottom` | Sets crop direction for crop or fillcrop without explicit coordinates. | | `--strip` | `boolean` | no | `true` | Strips all metadata from the image. This is useful to keep thumbnails as small as possible. | | `--alpha` | `string` | no | `Activate` | Gives control of the alpha/matte channel of an image. | | `--preclip-alpha` | `string` | no | `Activate` | Gives control of the alpha/matte channel of an image before applying the clipping path via clip: true. | @@ -651,7 +657,7 @@ npx transloadit image resize --input [options] | `--brightness` | `number` | no | `1` | Increases or decreases the brightness of the image by using a multiplier. For example 1.5 would increase the brightness by 50%, and 0.75 would decrease the brightness by 25%. | | `--saturation` | `number` | no | `1` | Increases or decreases the saturation of the image by using a multiplier. For example 1.5 would increase the saturation by 50%, and 0.75 would decrease the saturation by 25%. | | `--hue` | `number` | no | `1` | Changes the hue by rotating the color of the image. The value 100 would produce no change whereas 0 and 200 will negate the colors in the image. | -| `--contrast` | `number` | no | `1` | Adjusts the contrast of the image. A value of 1 produces no change. Values below 1 decrease contrast (with 0 being minimum contrast), and values above 1 increase contrast (with 2… | +| `--contrast` | `number` | no | `1` | Adjusts the contrast of the image. A value of 1 produces no change. Values below 1 decrease contrast, and values above 1 increase it. Start with small adjustments, such as 0.9 or… | | `--watermark-url` | `string` | no | `value` | A URL indicating a PNG image to be overlaid above this image. | | `--watermark-position` | `string[]` | no | `bottom` | The position at which the watermark is placed. The available options are "center", "top", "bottom", "left", and "right". You can also combine options, such as "bottom-right". An… | | `--watermark-x-offset` | `number` | no | `1` | The x-offset in number of pixels at which the watermark will be placed in relation to the position it has due to watermark_position. | @@ -706,9 +712,9 @@ npx transloadit image upscale --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | -| `--model` | `string` | no | `nightmareai/real-esrgan` | The AI model to use for image upscaling. Defaults to nightmareai/real-esrgan. | -| `--scale` | `number` | no | `2` | Upscale factor. Defaults to 2. | -| `--face-enhance` | `boolean` | no | `true` | Enable face enhancement for better face restoration. Defaults to false. | +| `--model` | `string` | no | `nightmareai/real-esrgan` | The AI model to use for image upscaling. Defaults to nightmareai/real-esrgan. Real-ESRGAN inputs exceeding 2,096,704 pixels are resized proportionally before upscaling. | +| `--scale` | `number` | no | `2` | Upscale factor, applied after any input resizing. Defaults to 2. GFPGAN results are resized after restoration to match this factor. | +| `--face-enhance` | `boolean` | no | `true` | Enable face enhancement with Real-ESRGAN or face upsampling with CodeFormer. GFPGAN always performs face restoration and ignores this parameter. Defaults to false. | **Examples** @@ -749,7 +755,7 @@ npx transloadit document convert --input [options] | `--markdown-theme` | `string` | no | `bare` | This parameter overhauls your Markdown files styling based on several canned presets. | | `--pdf-margin` | `string` | no | `value` | PDF Paper margins, separated by , and with units. We support the following unit values: px, in, cm, mm. Currently this parameter is only supported when converting from html. | | `--pdf-print-background` | `boolean` | no | `true` | Print PDF background graphics. Currently this parameter is only supported when converting from html. | -| `--pdf-format` | `string` | no | `A0` | PDF paper format. Currently this parameter is only supported when converting from html. | +| `--pdf-format` | `string` | no | `A0` | PDF paper format. Values are case-insensitive. Currently this parameter is only supported when converting from html. | | `--pdf-display-header-footer` | `boolean` | no | `true` | Display PDF header and footer. Currently this parameter is only supported when converting from html. | | `--pdf-header-template` | `string` | no | `value` | HTML template for the PDF print header. Should be valid HTML markup with following classes used to inject printing values into them: - date formatted print date - title document… | | `--pdf-footer-template` | `string` | no | `value` | HTML template for the PDF print footer. Should use the same format as the pdf_header_template. Currently this parameter is only supported when converting from html, and requires… | @@ -980,10 +986,12 @@ npx transloadit speech transcribe --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | -| `--provider` | `string` | no | `replicate` | Provider to use for transcription. Defaults to replicate. | +| `--provider` | `string` | no | `replicate` | Provider to use for transcription. Defaults to replicate, or to aws with --speaker-labels. | | `--format` | `string` | no | `text` | Output format. Defaults to text. | | `--source-language` | `string` | no | `en-US` | Spoken language as a BCP-47 code, for providers that support explicit source languages. | | `--target-language` | `string` | no | `french` | Sets the spoken language hint for the "replicate" provider. Omit this parameter to detect the spoken language automatically. Set it to the full lowercase English language name,… | +| `--speaker-labels` | `boolean` | no | — | Label who is speaking: one paragraph per speaker in text, voice spans in WebVTT. Uses aws or gcp. | +| `--max-speakers` | `number` | no | — | Maximum number of speakers to label, from 1 to 10. Requires --speaker-labels. | **Examples** @@ -992,6 +1000,8 @@ npx transloadit speech transcribe --input [options] transloadit speech transcribe --input voice.opus --output voice.txt # Generate subtitles transloadit speech transcribe --input clip.mp4 --format webvtt --output captions.vtt +# Label who is speaking in an interview +transloadit speech transcribe --input interview.mp4 --speaker-labels --output interview.txt ``` #### `text speak` @@ -1023,7 +1033,7 @@ npx transloadit text speak [--input ] [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | | `--prompt` | `string` | no | `"A red bicycle in a studio"` | Which text to speak. You can also set this to null and supply an input text file. | -| `--provider` | `string` | yes | `aws` | Which AI provider to leverage. Transloadit outsources this task and abstracts the interface so you can expect the same data structures, but different latencies and information… | +| `--provider` | `string` | no | `aws` | Chooses the best provider based on your request. Select a specific provider to override automatic selection. | | `--target-language` | `string` | no | `en-US` | The written language of the document. This will also be the language of the spoken text. The language should be specified in the BCP-47 format, such as "en-GB", "de-DE" or… | | `--voice` | `string` | no | `female-1` | The gender to be used for voice synthesis. Please consult the list of supported languages and voices. | | `--ssml` | `boolean` | no | `true` | Supply Speech Synthesis Markup Language instead of raw text, in order to gain more control over how your text is voiced, including rests and pronounciations. | @@ -1031,7 +1041,7 @@ npx transloadit text speak [--input ] [options] **Examples** ```bash -transloadit text speak --input input.pdf --provider aws --output output.mp3 +transloadit text speak --input input.pdf --output output.mp3 ``` #### `video thumbs` @@ -1066,12 +1076,14 @@ npx transloadit video thumbs --input [options] | `--count` | `number` | no | `1` | The number of thumbnails to be extracted. As some videos have incorrect durations, the actual number of thumbnails generated may be less in rare cases. The maximum number of… | | `--offsets` | `auto` | no | `value` | An array of offsets representing seconds of the file duration, such as [ 2, 45, 120 ]. | | `--format` | `string` | no | `jpg` | The format of the extracted thumbnail. Supported values are "jpg", "jpeg" and "png". Even if you specify the format to be "jpeg" the resulting thumbnails will have a "jpg" file… | -| `--width` | `number` | no | `1` | The width of the thumbnail, in pixels. Defaults to the original width of the video. | -| `--height` | `number` | no | `1` | The height of the thumbnail, in pixels. Defaults to the original height of the video. | +| `--width` | `number` | no | `1` | The width of the thumbnail, in pixels. Omit or use null for the original width of the video. | +| `--height` | `number` | no | `1` | The thumbnail height in pixels, capped like width. Omit or use null for the original height. | | `--resize-strategy` | `string` | no | `crop` | One of the available resize strategies. | -| `--background` | `string` | no | `value` | The background color of the resulting thumbnails in the "rrggbbaa" format (red, green, blue, alpha) when used with the "pad" resize strategy. The default color is black. | +| `--background` | `string` | no | `value` | The background color of the resulting thumbnails in the "rrggbbaa" format (red, green, blue, alpha) when used with the "pad" resize strategy. The default color is opaque black. | | `--rotate` | `number` | no | `0` | Forces the video to be rotated by the specified degree integer. | | `--input-codec` | `string` | no | `value` | Specifies the input codec to use when decoding the video. This is useful for videos with special codecs that require specific decoders. | +| `--smart` | `boolean` | no | `true` | When set to true, enables AI-powered smart thumbnail selection. | +| `--smart-max-candidates` | `number` | no | `1` | The maximum size of the candidate pool when smart is true. The Robot analyzes up to three candidates per requested thumbnail, capped by this value, but it will never analyze… | **Examples** @@ -2313,3 +2325,4 @@ Thanks to [Ian Hansen](https://github.com/supershabam) for donating the `translo ## Development See [CONTRIBUTING](./CONTRIBUTING.md). + diff --git a/packages/node/docs/intent-commands.md b/packages/node/docs/intent-commands.md index 18eac1d0..334d17fa 100644 --- a/packages/node/docs/intent-commands.md +++ b/packages/node/docs/intent-commands.md @@ -157,6 +157,7 @@ npx transloadit preview generate --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | | `--format` | `string` | no | `jpg` | The output format for the generated thumbnail image. If a short video clip is generated using the clip strategy, its format is defined by clip_format. | +| `--quality` | `number` | no | `1` | Compression quality for still previews, from 1 to 100. When specified, the final image resize encodes directly into the requested format at this quality and strips embedded… | | `--width` | `number` | no | `1` | Width of the thumbnail, in pixels. | | `--height` | `number` | no | `1` | Height of the thumbnail, in pixels. | | `--resize-strategy` | `string` | no | `crop` | To achieve the desired dimensions of the preview thumbnail, the Robot might have to resize the generated image. | @@ -173,11 +174,11 @@ npx transloadit preview generate --input [options] | `--icon-text-color` | `string` | no | `value` | The color of the text used in the icon. The format is #rrggbb[aa]. Only used if the icon strategy is applied. | | `--icon-text-font` | `string` | no | `value` | The font family of the text used in the icon. Only used if the icon strategy is applied. Here is a list of all supported fonts. | | `--icon-text-content` | `string` | no | `extension` | The content of the text box in generated icons. Only used if the icon_style parameter is set to with-text. The default value, extension, adds the file extension (e.g. MP4, JPEG)… | -| `--optimize` | `boolean` | no | `true` | Specifies whether the generated preview image should be optimized to reduce the image's file size while keeping their quaility. | +| `--optimize` | `boolean` | no | `true` | Specifies whether the generated preview image should be optimized to reduce its file size while maintaining visual quality. | | `--optimize-priority` | `string` | no | `compression-ratio` | Specifies whether conversion speed or compression ratio is prioritized when optimizing images. | | `--optimize-progressive` | `boolean` | no | `true` | Specifies whether images should be interlaced, which makes the result image load progressively in browsers. | | `--clip-format` | `string` | no | `apng` | The animated image format for the generated video clip. Only used if the clip strategy for video files is applied. Please consult the MDN Web Docs for detailed information about… | -| `--clip-offset` | `number` | no | `1` | The start position in seconds of where the clip is cut. Only used if the clip strategy for video files is applied. Be aware that for larger video only the first few MBs of the… | +| `--clip-offset` | `number` | no | `1` | The start position in seconds of where the clip is cut. Only used if the clip strategy for video files is applied. For large videos, only portions of the file may be imported to… | | `--clip-duration` | `number` | no | `1` | The duration in seconds of the generated video clip. Only used if the clip strategy for video files is applied. Be aware that a longer clip duration also results in a larger file… | | `--clip-framerate` | `number` | no | `1` | The framerate of the generated video clip. Only used if the clip strategy for video files is applied. Be aware that a higher framerate appears smoother but also results in a… | | `--clip-loop` | `boolean` | no | `true` | Specifies whether the generated animated image should loop forever (true) or stop after playing the animation once (false). | @@ -218,7 +219,7 @@ npx transloadit image remove-background --input [options] | --- | --- | --- | --- | --- | | `--select` | `string` | no | `foreground` | Region to select and keep in the image. The other region is removed. | | `--format` | `string` | no | `png` | Format of the generated image. Defaults to PNG when not provided. | -| `--provider` | `string` | no | `aws` | Provider to use for removing the background. | +| `--provider` | `string` | no | `aws` | Chooses the best provider based on your request. Select a specific provider to override automatic selection. | | `--model` | `string` | no | `value` | Provider-specific model to use for removing the background. Mostly intended for testing and evaluation. | **Examples** @@ -256,14 +257,19 @@ npx transloadit image merge --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | | `--format` | `string` | no | `jpg` | The output format for the modified image. | -| `--direction` | `string` | no | `horizontal` | Specifies the direction which the images are displayed. Only applies to the default spritesheet layout. Ignored when effect is set to polaroid-stack or mosaic, as those effects… | +| `--direction` | `string` | no | `horizontal` | Specifies the direction which the images are displayed. Use grid to arrange inputs left-to-right and top-to-bottom. Only applies to the default spritesheet layout. Ignored when… | | `--effect` | `string` | no | `mosaic` | Applies a styled collage layout instead of a plain horizontal or vertical spritesheet. | +| `--columns` | `number` | no | `1` | Number of columns in the grid layout. Only applies when direction is grid. If omitted, columns are calculated automatically from the number of inputs and requested rows. | +| `--rows` | `number` | no | `1` | Number of rows in the grid layout. Only applies when direction is grid. If omitted, rows are calculated automatically from the number of inputs and requested columns. | +| `--cell-width` | `number` | no | `1` | Uniform width for each grid cell in pixels. Only applies when direction is grid. Images are resized to fit within the cell while preserving aspect ratio. | +| `--cell-height` | `number` | no | `1` | Uniform height for each grid cell in pixels. Only applies when direction is grid. Images are resized to fit within the cell while preserving aspect ratio. | | `--border` | `number` | no | `1` | An integer value which defines the gap between images on the spritesheet. | | `--background` | `string` | no | `transparent` | Either the hexadecimal code or name of the color used to fill the background (only shown with a border > 1). | | `--width` | `number` | no | `1` | The output canvas width in pixels. This is mainly used by styled effects such as polaroid-stack and mosaic. | | `--height` | `number` | no | `1` | The output canvas height in pixels. This is mainly used by styled effects such as polaroid-stack and mosaic. | | `--seed` | `number` | no | `1` | Optional deterministic seed used by styled effects such as polaroid-stack and mosaic. | | `--shuffle` | `boolean` | no | `true` | Whether styled effects such as polaroid-stack and mosaic may shuffle the input order before laying out the canvas. | +| `--sort-by` | `string` | no | `auto` | Controls how bundled inputs are ordered when no explicit numbered alias for the input type is used. | | `--coverage` | `number` | no | `1` | Area-coverage multiplier for the polaroid-stack effect. Controls how large each polaroid is relative to the canvas and consequently how much of the canvas is covered by photos.… | | `--adaptive-filtering` | `boolean` | no | `true` | Controls the image compression for PNG images. Setting to true results in smaller file size, while increasing processing time. It is encouraged to keep this option disabled. | | `--quality` | `number` | no | `1` | Controls the image compression for JPG, PNG, and WebP images. Please also take a look at 🤖/image/optimize. | @@ -348,7 +354,7 @@ npx transloadit image resize --input [options] | `--resize-strategy` | `string` | no | `crop` | See the list of available resize strategies. | | `--zoom` | `boolean` | no | `true` | If this is set to false, smaller images will not be stretched to the desired width and height. | | `--crop` | `auto` | no | `value` | Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original image(s). | -| `--gravity` | `string` | no | `bottom` | The direction from which the image is to be cropped, when "resize_strategy" is set to "crop", but no crop coordinates are defined. | +| `--gravity` | `string` | no | `bottom` | Sets crop direction for crop or fillcrop without explicit coordinates. | | `--strip` | `boolean` | no | `true` | Strips all metadata from the image. This is useful to keep thumbnails as small as possible. | | `--alpha` | `string` | no | `Activate` | Gives control of the alpha/matte channel of an image. | | `--preclip-alpha` | `string` | no | `Activate` | Gives control of the alpha/matte channel of an image before applying the clipping path via clip: true. | @@ -368,7 +374,7 @@ npx transloadit image resize --input [options] | `--brightness` | `number` | no | `1` | Increases or decreases the brightness of the image by using a multiplier. For example 1.5 would increase the brightness by 50%, and 0.75 would decrease the brightness by 25%. | | `--saturation` | `number` | no | `1` | Increases or decreases the saturation of the image by using a multiplier. For example 1.5 would increase the saturation by 50%, and 0.75 would decrease the saturation by 25%. | | `--hue` | `number` | no | `1` | Changes the hue by rotating the color of the image. The value 100 would produce no change whereas 0 and 200 will negate the colors in the image. | -| `--contrast` | `number` | no | `1` | Adjusts the contrast of the image. A value of 1 produces no change. Values below 1 decrease contrast (with 0 being minimum contrast), and values above 1 increase contrast (with 2… | +| `--contrast` | `number` | no | `1` | Adjusts the contrast of the image. A value of 1 produces no change. Values below 1 decrease contrast, and values above 1 increase it. Start with small adjustments, such as 0.9 or… | | `--watermark-url` | `string` | no | `value` | A URL indicating a PNG image to be overlaid above this image. | | `--watermark-position` | `string[]` | no | `bottom` | The position at which the watermark is placed. The available options are "center", "top", "bottom", "left", and "right". You can also combine options, such as "bottom-right". An… | | `--watermark-x-offset` | `number` | no | `1` | The x-offset in number of pixels at which the watermark will be placed in relation to the position it has due to watermark_position. | @@ -423,9 +429,9 @@ npx transloadit image upscale --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | -| `--model` | `string` | no | `nightmareai/real-esrgan` | The AI model to use for image upscaling. Defaults to nightmareai/real-esrgan. | -| `--scale` | `number` | no | `2` | Upscale factor. Defaults to 2. | -| `--face-enhance` | `boolean` | no | `true` | Enable face enhancement for better face restoration. Defaults to false. | +| `--model` | `string` | no | `nightmareai/real-esrgan` | The AI model to use for image upscaling. Defaults to nightmareai/real-esrgan. Real-ESRGAN inputs exceeding 2,096,704 pixels are resized proportionally before upscaling. | +| `--scale` | `number` | no | `2` | Upscale factor, applied after any input resizing. Defaults to 2. GFPGAN results are resized after restoration to match this factor. | +| `--face-enhance` | `boolean` | no | `true` | Enable face enhancement with Real-ESRGAN or face upsampling with CodeFormer. GFPGAN always performs face restoration and ignores this parameter. Defaults to false. | **Examples** @@ -466,7 +472,7 @@ npx transloadit document convert --input [options] | `--markdown-theme` | `string` | no | `bare` | This parameter overhauls your Markdown files styling based on several canned presets. | | `--pdf-margin` | `string` | no | `value` | PDF Paper margins, separated by , and with units. We support the following unit values: px, in, cm, mm. Currently this parameter is only supported when converting from html. | | `--pdf-print-background` | `boolean` | no | `true` | Print PDF background graphics. Currently this parameter is only supported when converting from html. | -| `--pdf-format` | `string` | no | `A0` | PDF paper format. Currently this parameter is only supported when converting from html. | +| `--pdf-format` | `string` | no | `A0` | PDF paper format. Values are case-insensitive. Currently this parameter is only supported when converting from html. | | `--pdf-display-header-footer` | `boolean` | no | `true` | Display PDF header and footer. Currently this parameter is only supported when converting from html. | | `--pdf-header-template` | `string` | no | `value` | HTML template for the PDF print header. Should be valid HTML markup with following classes used to inject printing values into them: - date formatted print date - title document… | | `--pdf-footer-template` | `string` | no | `value` | HTML template for the PDF print footer. Should use the same format as the pdf_header_template. Currently this parameter is only supported when converting from html, and requires… | @@ -697,10 +703,12 @@ npx transloadit speech transcribe --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | -| `--provider` | `string` | no | `replicate` | Provider to use for transcription. Defaults to replicate. | +| `--provider` | `string` | no | `replicate` | Provider to use for transcription. Defaults to replicate, or to aws with --speaker-labels. | | `--format` | `string` | no | `text` | Output format. Defaults to text. | | `--source-language` | `string` | no | `en-US` | Spoken language as a BCP-47 code, for providers that support explicit source languages. | | `--target-language` | `string` | no | `french` | Sets the spoken language hint for the "replicate" provider. Omit this parameter to detect the spoken language automatically. Set it to the full lowercase English language name,… | +| `--speaker-labels` | `boolean` | no | — | Label who is speaking: one paragraph per speaker in text, voice spans in WebVTT. Uses aws or gcp. | +| `--max-speakers` | `number` | no | — | Maximum number of speakers to label, from 1 to 10. Requires --speaker-labels. | **Examples** @@ -709,6 +717,8 @@ npx transloadit speech transcribe --input [options] transloadit speech transcribe --input voice.opus --output voice.txt # Generate subtitles transloadit speech transcribe --input clip.mp4 --format webvtt --output captions.vtt +# Label who is speaking in an interview +transloadit speech transcribe --input interview.mp4 --speaker-labels --output interview.txt ``` ## `text speak` @@ -740,7 +750,7 @@ npx transloadit text speak [--input ] [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | | `--prompt` | `string` | no | `"A red bicycle in a studio"` | Which text to speak. You can also set this to null and supply an input text file. | -| `--provider` | `string` | yes | `aws` | Which AI provider to leverage. Transloadit outsources this task and abstracts the interface so you can expect the same data structures, but different latencies and information… | +| `--provider` | `string` | no | `aws` | Chooses the best provider based on your request. Select a specific provider to override automatic selection. | | `--target-language` | `string` | no | `en-US` | The written language of the document. This will also be the language of the spoken text. The language should be specified in the BCP-47 format, such as "en-GB", "de-DE" or… | | `--voice` | `string` | no | `female-1` | The gender to be used for voice synthesis. Please consult the list of supported languages and voices. | | `--ssml` | `boolean` | no | `true` | Supply Speech Synthesis Markup Language instead of raw text, in order to gain more control over how your text is voiced, including rests and pronounciations. | @@ -748,7 +758,7 @@ npx transloadit text speak [--input ] [options] **Examples** ```bash -transloadit text speak --input input.pdf --provider aws --output output.mp3 +transloadit text speak --input input.pdf --output output.mp3 ``` ## `video thumbs` @@ -783,12 +793,14 @@ npx transloadit video thumbs --input [options] | `--count` | `number` | no | `1` | The number of thumbnails to be extracted. As some videos have incorrect durations, the actual number of thumbnails generated may be less in rare cases. The maximum number of… | | `--offsets` | `auto` | no | `value` | An array of offsets representing seconds of the file duration, such as [ 2, 45, 120 ]. | | `--format` | `string` | no | `jpg` | The format of the extracted thumbnail. Supported values are "jpg", "jpeg" and "png". Even if you specify the format to be "jpeg" the resulting thumbnails will have a "jpg" file… | -| `--width` | `number` | no | `1` | The width of the thumbnail, in pixels. Defaults to the original width of the video. | -| `--height` | `number` | no | `1` | The height of the thumbnail, in pixels. Defaults to the original height of the video. | +| `--width` | `number` | no | `1` | The width of the thumbnail, in pixels. Omit or use null for the original width of the video. | +| `--height` | `number` | no | `1` | The thumbnail height in pixels, capped like width. Omit or use null for the original height. | | `--resize-strategy` | `string` | no | `crop` | One of the available resize strategies. | -| `--background` | `string` | no | `value` | The background color of the resulting thumbnails in the "rrggbbaa" format (red, green, blue, alpha) when used with the "pad" resize strategy. The default color is black. | +| `--background` | `string` | no | `value` | The background color of the resulting thumbnails in the "rrggbbaa" format (red, green, blue, alpha) when used with the "pad" resize strategy. The default color is opaque black. | | `--rotate` | `number` | no | `0` | Forces the video to be rotated by the specified degree integer. | | `--input-codec` | `string` | no | `value` | Specifies the input codec to use when decoding the video. This is useful for videos with special codecs that require specific decoders. | +| `--smart` | `boolean` | no | `true` | When set to true, enables AI-powered smart thumbnail selection. | +| `--smart-max-candidates` | `number` | no | `1` | The maximum size of the candidate pool when smart is true. The Robot analyzes up to three candidates per requested thumbnail, capped by this value, but it will never analyze… | **Examples** diff --git a/packages/node/src/cli/semanticIntents/speechTranscribe.ts b/packages/node/src/cli/semanticIntents/speechTranscribe.ts index 12e1d73b..1af3e4b3 100644 --- a/packages/node/src/cli/semanticIntents/speechTranscribe.ts +++ b/packages/node/src/cli/semanticIntents/speechTranscribe.ts @@ -33,7 +33,8 @@ const speechTranscribeExecutionDefinition = { kind: 'string', propertyName: 'provider', optionFlags: '--provider', - description: 'Provider to use for transcription. Defaults to replicate.', + description: + 'Provider to use for transcription. Defaults to replicate, or to aws with --speaker-labels.', required: false, exampleValue: defaultSpeechTranscribeProvider, }, @@ -65,6 +66,24 @@ const speechTranscribeExecutionDefinition = { required: false, exampleValue: 'french', }, + { + name: 'speaker_labels', + kind: 'boolean', + propertyName: 'speakerLabels', + optionFlags: '--speaker-labels', + description: + 'Label who is speaking: one paragraph per speaker in text, voice spans in WebVTT. Uses aws or gcp.', + required: false, + }, + { + name: 'max_speakers', + kind: 'number', + propertyName: 'maxSpeakers', + optionFlags: '--max-speakers', + description: 'Maximum number of speakers to label, from 1 to 10. Requires --speaker-labels.', + required: false, + exampleValue: 2, + }, ] as const satisfies readonly IntentOptionDefinition[], } satisfies IntentDynamicStepExecutionDefinition @@ -83,17 +102,19 @@ const speechTranscribeCommandPresentation = { 'Generate subtitles', 'transloadit speech transcribe --input clip.mp4 --format webvtt --output captions.vtt', ], + [ + 'Label who is speaking in an interview', + 'transloadit speech transcribe --input interview.mp4 --speaker-labels --output interview.txt', + ], ] as Array<[string, string]>, } as const satisfies SemanticIntentPresentation -function parseProvider(value: unknown): SpeechTranscribeProvider { - return ( - parseOptionalEnumValue({ - flagName: '--provider', - supportedValues: speechTranscribeProviders, - value, - }) ?? defaultSpeechTranscribeProvider - ) +function parseProvider(value: unknown): SpeechTranscribeProvider | null { + return parseOptionalEnumValue({ + flagName: '--provider', + supportedValues: speechTranscribeProviders, + value, + }) } function parseFormat(value: unknown): SpeechTranscribeFormat { @@ -119,23 +140,52 @@ function parseOptionalString(value: unknown, flagName: string): string | null { return trimmed.length > 0 ? trimmed : null } +function parseMaxSpeakers(value: unknown, speakerLabels: boolean): number | null { + if (value == null) { + return null + } + + if (!speakerLabels) { + throw new Error('--max-speakers requires --speaker-labels') + } + + if (typeof value !== 'number' || !Number.isInteger(value) || value < 1 || value > 10) { + throw new Error('--max-speakers must be an integer from 1 to 10') + } + + return value +} + function createSpeechTranscribeStep( rawValues: Record, _context: { hasInputs: boolean }, ): Record { - const provider = parseProvider(rawValues.provider) + const requestedProvider = parseProvider(rawValues.provider) const format = parseFormat(rawValues.format) const sourceLanguage = parseOptionalString(rawValues.source_language, '--source-language') const targetLanguage = parseOptionalString(rawValues.target_language, '--target-language') + const speakerLabels = rawValues.speaker_labels === true + const maxSpeakers = parseMaxSpeakers(rawValues.max_speakers, speakerLabels) + + if (speakerLabels && requestedProvider === 'replicate') { + throw new Error('--speaker-labels needs --provider aws or gcp') + } + + // Without an explicit provider, the API picks one that supports speaker labels. + const provider = speakerLabels + ? requestedProvider + : (requestedProvider ?? defaultSpeechTranscribeProvider) return { robot: '/speech/transcribe', use: ':original', result: true, - provider, + ...(provider != null ? { provider } : {}), format, ...(sourceLanguage != null ? { source_language: sourceLanguage } : {}), ...(targetLanguage != null ? { target_language: targetLanguage } : {}), + ...(speakerLabels ? { speaker_labels: true } : {}), + ...(maxSpeakers != null ? { max_speakers: maxSpeakers } : {}), } } diff --git a/packages/node/test/unit/cli/intents.test.ts b/packages/node/test/unit/cli/intents.test.ts index c0ea8830..f417ce66 100644 --- a/packages/node/test/unit/cli/intents.test.ts +++ b/packages/node/test/unit/cli/intents.test.ts @@ -845,6 +845,71 @@ describe('intent commands', () => { expect(createSpy).not.toHaveBeenCalled() }) + it('lets the API pick a speaker-labeling provider for speech transcribe', async () => { + const { createSpy } = await runIntentCommand([ + 'speech', + 'transcribe', + '--input', + 'interview.mp4', + '--speaker-labels', + '--max-speakers', + '2', + '--output', + 'interview.txt', + ]) + + expect(process.exitCode).toBeUndefined() + expect(createSpy).toHaveBeenCalledWith( + expect.any(OutputCtl), + expect.anything(), + expect.objectContaining({ + stepsData: { + transcribe: { + robot: '/speech/transcribe', + use: ':original', + result: true, + format: 'text', + speaker_labels: true, + max_speakers: 2, + }, + }, + }), + ) + }) + + it('rejects speaker labels with the replicate provider', async () => { + const { createSpy } = await runIntentCommand([ + 'speech', + 'transcribe', + '--input', + 'interview.mp4', + '--speaker-labels', + '--provider', + 'replicate', + '--output', + 'interview.txt', + ]) + + expect(process.exitCode).toBe(1) + expect(createSpy).not.toHaveBeenCalled() + }) + + it('rejects --max-speakers without --speaker-labels', async () => { + const { createSpy } = await runIntentCommand([ + 'speech', + 'transcribe', + '--input', + 'interview.mp4', + '--max-speakers', + '2', + '--output', + 'interview.txt', + ]) + + expect(process.exitCode).toBe(1) + expect(createSpy).not.toHaveBeenCalled() + }) + it('passes through explicit markdown options for backend rendering', async () => { const { createSpy } = await runIntentCommand([ 'markdown', diff --git a/packages/transloadit/README.md b/packages/transloadit/README.md index 46ece905..3a32ed30 100644 --- a/packages/transloadit/README.md +++ b/packages/transloadit/README.md @@ -440,6 +440,7 @@ npx transloadit preview generate --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | | `--format` | `string` | no | `jpg` | The output format for the generated thumbnail image. If a short video clip is generated using the clip strategy, its format is defined by clip_format. | +| `--quality` | `number` | no | `1` | Compression quality for still previews, from 1 to 100. When specified, the final image resize encodes directly into the requested format at this quality and strips embedded… | | `--width` | `number` | no | `1` | Width of the thumbnail, in pixels. | | `--height` | `number` | no | `1` | Height of the thumbnail, in pixels. | | `--resize-strategy` | `string` | no | `crop` | To achieve the desired dimensions of the preview thumbnail, the Robot might have to resize the generated image. | @@ -456,11 +457,11 @@ npx transloadit preview generate --input [options] | `--icon-text-color` | `string` | no | `value` | The color of the text used in the icon. The format is #rrggbb[aa]. Only used if the icon strategy is applied. | | `--icon-text-font` | `string` | no | `value` | The font family of the text used in the icon. Only used if the icon strategy is applied. Here is a list of all supported fonts. | | `--icon-text-content` | `string` | no | `extension` | The content of the text box in generated icons. Only used if the icon_style parameter is set to with-text. The default value, extension, adds the file extension (e.g. MP4, JPEG)… | -| `--optimize` | `boolean` | no | `true` | Specifies whether the generated preview image should be optimized to reduce the image's file size while keeping their quaility. | +| `--optimize` | `boolean` | no | `true` | Specifies whether the generated preview image should be optimized to reduce its file size while maintaining visual quality. | | `--optimize-priority` | `string` | no | `compression-ratio` | Specifies whether conversion speed or compression ratio is prioritized when optimizing images. | | `--optimize-progressive` | `boolean` | no | `true` | Specifies whether images should be interlaced, which makes the result image load progressively in browsers. | | `--clip-format` | `string` | no | `apng` | The animated image format for the generated video clip. Only used if the clip strategy for video files is applied. Please consult the MDN Web Docs for detailed information about… | -| `--clip-offset` | `number` | no | `1` | The start position in seconds of where the clip is cut. Only used if the clip strategy for video files is applied. Be aware that for larger video only the first few MBs of the… | +| `--clip-offset` | `number` | no | `1` | The start position in seconds of where the clip is cut. Only used if the clip strategy for video files is applied. For large videos, only portions of the file may be imported to… | | `--clip-duration` | `number` | no | `1` | The duration in seconds of the generated video clip. Only used if the clip strategy for video files is applied. Be aware that a longer clip duration also results in a larger file… | | `--clip-framerate` | `number` | no | `1` | The framerate of the generated video clip. Only used if the clip strategy for video files is applied. Be aware that a higher framerate appears smoother but also results in a… | | `--clip-loop` | `boolean` | no | `true` | Specifies whether the generated animated image should loop forever (true) or stop after playing the animation once (false). | @@ -501,7 +502,7 @@ npx transloadit image remove-background --input [options] | --- | --- | --- | --- | --- | | `--select` | `string` | no | `foreground` | Region to select and keep in the image. The other region is removed. | | `--format` | `string` | no | `png` | Format of the generated image. Defaults to PNG when not provided. | -| `--provider` | `string` | no | `aws` | Provider to use for removing the background. | +| `--provider` | `string` | no | `aws` | Chooses the best provider based on your request. Select a specific provider to override automatic selection. | | `--model` | `string` | no | `value` | Provider-specific model to use for removing the background. Mostly intended for testing and evaluation. | **Examples** @@ -539,14 +540,19 @@ npx transloadit image merge --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | | `--format` | `string` | no | `jpg` | The output format for the modified image. | -| `--direction` | `string` | no | `horizontal` | Specifies the direction which the images are displayed. Only applies to the default spritesheet layout. Ignored when effect is set to polaroid-stack or mosaic, as those effects… | +| `--direction` | `string` | no | `horizontal` | Specifies the direction which the images are displayed. Use grid to arrange inputs left-to-right and top-to-bottom. Only applies to the default spritesheet layout. Ignored when… | | `--effect` | `string` | no | `mosaic` | Applies a styled collage layout instead of a plain horizontal or vertical spritesheet. | +| `--columns` | `number` | no | `1` | Number of columns in the grid layout. Only applies when direction is grid. If omitted, columns are calculated automatically from the number of inputs and requested rows. | +| `--rows` | `number` | no | `1` | Number of rows in the grid layout. Only applies when direction is grid. If omitted, rows are calculated automatically from the number of inputs and requested columns. | +| `--cell-width` | `number` | no | `1` | Uniform width for each grid cell in pixels. Only applies when direction is grid. Images are resized to fit within the cell while preserving aspect ratio. | +| `--cell-height` | `number` | no | `1` | Uniform height for each grid cell in pixels. Only applies when direction is grid. Images are resized to fit within the cell while preserving aspect ratio. | | `--border` | `number` | no | `1` | An integer value which defines the gap between images on the spritesheet. | | `--background` | `string` | no | `transparent` | Either the hexadecimal code or name of the color used to fill the background (only shown with a border > 1). | | `--width` | `number` | no | `1` | The output canvas width in pixels. This is mainly used by styled effects such as polaroid-stack and mosaic. | | `--height` | `number` | no | `1` | The output canvas height in pixels. This is mainly used by styled effects such as polaroid-stack and mosaic. | | `--seed` | `number` | no | `1` | Optional deterministic seed used by styled effects such as polaroid-stack and mosaic. | | `--shuffle` | `boolean` | no | `true` | Whether styled effects such as polaroid-stack and mosaic may shuffle the input order before laying out the canvas. | +| `--sort-by` | `string` | no | `auto` | Controls how bundled inputs are ordered when no explicit numbered alias for the input type is used. | | `--coverage` | `number` | no | `1` | Area-coverage multiplier for the polaroid-stack effect. Controls how large each polaroid is relative to the canvas and consequently how much of the canvas is covered by photos.… | | `--adaptive-filtering` | `boolean` | no | `true` | Controls the image compression for PNG images. Setting to true results in smaller file size, while increasing processing time. It is encouraged to keep this option disabled. | | `--quality` | `number` | no | `1` | Controls the image compression for JPG, PNG, and WebP images. Please also take a look at 🤖/image/optimize. | @@ -631,7 +637,7 @@ npx transloadit image resize --input [options] | `--resize-strategy` | `string` | no | `crop` | See the list of available resize strategies. | | `--zoom` | `boolean` | no | `true` | If this is set to false, smaller images will not be stretched to the desired width and height. | | `--crop` | `auto` | no | `value` | Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original image(s). | -| `--gravity` | `string` | no | `bottom` | The direction from which the image is to be cropped, when "resize_strategy" is set to "crop", but no crop coordinates are defined. | +| `--gravity` | `string` | no | `bottom` | Sets crop direction for crop or fillcrop without explicit coordinates. | | `--strip` | `boolean` | no | `true` | Strips all metadata from the image. This is useful to keep thumbnails as small as possible. | | `--alpha` | `string` | no | `Activate` | Gives control of the alpha/matte channel of an image. | | `--preclip-alpha` | `string` | no | `Activate` | Gives control of the alpha/matte channel of an image before applying the clipping path via clip: true. | @@ -651,7 +657,7 @@ npx transloadit image resize --input [options] | `--brightness` | `number` | no | `1` | Increases or decreases the brightness of the image by using a multiplier. For example 1.5 would increase the brightness by 50%, and 0.75 would decrease the brightness by 25%. | | `--saturation` | `number` | no | `1` | Increases or decreases the saturation of the image by using a multiplier. For example 1.5 would increase the saturation by 50%, and 0.75 would decrease the saturation by 25%. | | `--hue` | `number` | no | `1` | Changes the hue by rotating the color of the image. The value 100 would produce no change whereas 0 and 200 will negate the colors in the image. | -| `--contrast` | `number` | no | `1` | Adjusts the contrast of the image. A value of 1 produces no change. Values below 1 decrease contrast (with 0 being minimum contrast), and values above 1 increase contrast (with 2… | +| `--contrast` | `number` | no | `1` | Adjusts the contrast of the image. A value of 1 produces no change. Values below 1 decrease contrast, and values above 1 increase it. Start with small adjustments, such as 0.9 or… | | `--watermark-url` | `string` | no | `value` | A URL indicating a PNG image to be overlaid above this image. | | `--watermark-position` | `string[]` | no | `bottom` | The position at which the watermark is placed. The available options are "center", "top", "bottom", "left", and "right". You can also combine options, such as "bottom-right". An… | | `--watermark-x-offset` | `number` | no | `1` | The x-offset in number of pixels at which the watermark will be placed in relation to the position it has due to watermark_position. | @@ -706,9 +712,9 @@ npx transloadit image upscale --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | -| `--model` | `string` | no | `nightmareai/real-esrgan` | The AI model to use for image upscaling. Defaults to nightmareai/real-esrgan. | -| `--scale` | `number` | no | `2` | Upscale factor. Defaults to 2. | -| `--face-enhance` | `boolean` | no | `true` | Enable face enhancement for better face restoration. Defaults to false. | +| `--model` | `string` | no | `nightmareai/real-esrgan` | The AI model to use for image upscaling. Defaults to nightmareai/real-esrgan. Real-ESRGAN inputs exceeding 2,096,704 pixels are resized proportionally before upscaling. | +| `--scale` | `number` | no | `2` | Upscale factor, applied after any input resizing. Defaults to 2. GFPGAN results are resized after restoration to match this factor. | +| `--face-enhance` | `boolean` | no | `true` | Enable face enhancement with Real-ESRGAN or face upsampling with CodeFormer. GFPGAN always performs face restoration and ignores this parameter. Defaults to false. | **Examples** @@ -749,7 +755,7 @@ npx transloadit document convert --input [options] | `--markdown-theme` | `string` | no | `bare` | This parameter overhauls your Markdown files styling based on several canned presets. | | `--pdf-margin` | `string` | no | `value` | PDF Paper margins, separated by , and with units. We support the following unit values: px, in, cm, mm. Currently this parameter is only supported when converting from html. | | `--pdf-print-background` | `boolean` | no | `true` | Print PDF background graphics. Currently this parameter is only supported when converting from html. | -| `--pdf-format` | `string` | no | `A0` | PDF paper format. Currently this parameter is only supported when converting from html. | +| `--pdf-format` | `string` | no | `A0` | PDF paper format. Values are case-insensitive. Currently this parameter is only supported when converting from html. | | `--pdf-display-header-footer` | `boolean` | no | `true` | Display PDF header and footer. Currently this parameter is only supported when converting from html. | | `--pdf-header-template` | `string` | no | `value` | HTML template for the PDF print header. Should be valid HTML markup with following classes used to inject printing values into them: - date formatted print date - title document… | | `--pdf-footer-template` | `string` | no | `value` | HTML template for the PDF print footer. Should use the same format as the pdf_header_template. Currently this parameter is only supported when converting from html, and requires… | @@ -980,10 +986,12 @@ npx transloadit speech transcribe --input [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | -| `--provider` | `string` | no | `replicate` | Provider to use for transcription. Defaults to replicate. | +| `--provider` | `string` | no | `replicate` | Provider to use for transcription. Defaults to replicate, or to aws with --speaker-labels. | | `--format` | `string` | no | `text` | Output format. Defaults to text. | | `--source-language` | `string` | no | `en-US` | Spoken language as a BCP-47 code, for providers that support explicit source languages. | | `--target-language` | `string` | no | `french` | Sets the spoken language hint for the "replicate" provider. Omit this parameter to detect the spoken language automatically. Set it to the full lowercase English language name,… | +| `--speaker-labels` | `boolean` | no | — | Label who is speaking: one paragraph per speaker in text, voice spans in WebVTT. Uses aws or gcp. | +| `--max-speakers` | `number` | no | — | Maximum number of speakers to label, from 1 to 10. Requires --speaker-labels. | **Examples** @@ -992,6 +1000,8 @@ npx transloadit speech transcribe --input [options] transloadit speech transcribe --input voice.opus --output voice.txt # Generate subtitles transloadit speech transcribe --input clip.mp4 --format webvtt --output captions.vtt +# Label who is speaking in an interview +transloadit speech transcribe --input interview.mp4 --speaker-labels --output interview.txt ``` #### `text speak` @@ -1023,7 +1033,7 @@ npx transloadit text speak [--input ] [options] | Flag | Type | Required | Example | Description | | --- | --- | --- | --- | --- | | `--prompt` | `string` | no | `"A red bicycle in a studio"` | Which text to speak. You can also set this to null and supply an input text file. | -| `--provider` | `string` | yes | `aws` | Which AI provider to leverage. Transloadit outsources this task and abstracts the interface so you can expect the same data structures, but different latencies and information… | +| `--provider` | `string` | no | `aws` | Chooses the best provider based on your request. Select a specific provider to override automatic selection. | | `--target-language` | `string` | no | `en-US` | The written language of the document. This will also be the language of the spoken text. The language should be specified in the BCP-47 format, such as "en-GB", "de-DE" or… | | `--voice` | `string` | no | `female-1` | The gender to be used for voice synthesis. Please consult the list of supported languages and voices. | | `--ssml` | `boolean` | no | `true` | Supply Speech Synthesis Markup Language instead of raw text, in order to gain more control over how your text is voiced, including rests and pronounciations. | @@ -1031,7 +1041,7 @@ npx transloadit text speak [--input ] [options] **Examples** ```bash -transloadit text speak --input input.pdf --provider aws --output output.mp3 +transloadit text speak --input input.pdf --output output.mp3 ``` #### `video thumbs` @@ -1066,12 +1076,14 @@ npx transloadit video thumbs --input [options] | `--count` | `number` | no | `1` | The number of thumbnails to be extracted. As some videos have incorrect durations, the actual number of thumbnails generated may be less in rare cases. The maximum number of… | | `--offsets` | `auto` | no | `value` | An array of offsets representing seconds of the file duration, such as [ 2, 45, 120 ]. | | `--format` | `string` | no | `jpg` | The format of the extracted thumbnail. Supported values are "jpg", "jpeg" and "png". Even if you specify the format to be "jpeg" the resulting thumbnails will have a "jpg" file… | -| `--width` | `number` | no | `1` | The width of the thumbnail, in pixels. Defaults to the original width of the video. | -| `--height` | `number` | no | `1` | The height of the thumbnail, in pixels. Defaults to the original height of the video. | +| `--width` | `number` | no | `1` | The width of the thumbnail, in pixels. Omit or use null for the original width of the video. | +| `--height` | `number` | no | `1` | The thumbnail height in pixels, capped like width. Omit or use null for the original height. | | `--resize-strategy` | `string` | no | `crop` | One of the available resize strategies. | -| `--background` | `string` | no | `value` | The background color of the resulting thumbnails in the "rrggbbaa" format (red, green, blue, alpha) when used with the "pad" resize strategy. The default color is black. | +| `--background` | `string` | no | `value` | The background color of the resulting thumbnails in the "rrggbbaa" format (red, green, blue, alpha) when used with the "pad" resize strategy. The default color is opaque black. | | `--rotate` | `number` | no | `0` | Forces the video to be rotated by the specified degree integer. | | `--input-codec` | `string` | no | `value` | Specifies the input codec to use when decoding the video. This is useful for videos with special codecs that require specific decoders. | +| `--smart` | `boolean` | no | `true` | When set to true, enables AI-powered smart thumbnail selection. | +| `--smart-max-candidates` | `number` | no | `1` | The maximum size of the candidate pool when smart is true. The Robot analyzes up to three candidates per requested thumbnail, capped by this value, but it will never analyze… | **Examples** @@ -2313,3 +2325,4 @@ Thanks to [Ian Hansen](https://github.com/supershabam) for donating the `translo ## Development See [CONTRIBUTING](./CONTRIBUTING.md). +