Skip to content

Commit

Permalink
Sync alphalib
Browse files Browse the repository at this point in the history
  • Loading branch information
kvz committed Feb 4, 2025
1 parent 542ce00 commit 5cc5080
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 20 deletions.
10 changes: 8 additions & 2 deletions src/alphalib/types/robots/_instructions-primitives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,10 @@ export const ffmpegPresetSchema = z

export type FfmpegPreset = z.infer<typeof ffmpegPresetSchema>

export const ffmpegStackVersionSchema = z.enum(['v5.0.0', 'v6.0.0']).default('v5.0.0').describe(`
export const ffmpegStackVersionSchema = z
// Any semver in range is allowed and normalized. The enum is used for editor completions.
.union([z.enum(['v5', 'v6']), z.string().regex(/^v?[56](\.\d+)?(\.\d+)?$/)])
.default('v5.0.0').describe(`
Selects the FFmpeg stack version to use for encoding. These versions reflect real FFmpeg versions. We currently recommend to use "v6.0.0".
`)

Expand Down Expand Up @@ -390,7 +393,10 @@ export const optimize_priority = z
.enum(['compression-ratio', 'conversion-speed'])
.default('conversion-speed')

export const imagemagickStackVersionSchema = z.enum(['v2.0.10', 'v3.0.1']).default('v2.0.10')
export const imagemagickStackVersionSchema = z
// Any semver in range is allowed and normalized. The enum is used for editor completions.
.union([z.enum(['v2', 'v3']), z.string().regex(/^v?[23](\.\d+)?(\.\d+)?$/)])
.default('v2')
export type ImagemagickStackVersion = z.infer<typeof imagemagickStackVersionSchema>

export const colorspaceSchema = z.enum([
Expand Down
1 change: 0 additions & 1 deletion src/alphalib/types/robots/audio-artwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const meta: RobotMeta = {
artwork_extracted: {
robot: '/audio/artwork',
use: ':original',
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
},
Expand Down
1 change: 0 additions & 1 deletion src/alphalib/types/robots/audio-concat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const meta: RobotMeta = {
{ name: ':original', fields: 'third_audio_file', as: 'audio_3' },
],
},
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
},
Expand Down
1 change: 0 additions & 1 deletion src/alphalib/types/robots/audio-encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const meta: RobotMeta = {
use: ':original',
preset: 'mp3',
bitrate: 256000,
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
},
Expand Down
3 changes: 1 addition & 2 deletions src/alphalib/types/robots/audio-loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const meta: RobotMeta = {
robot: '/audio/loop',
use: ':original',
duration: 300,
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
},
Expand Down Expand Up @@ -53,7 +52,7 @@ export const robotAudioLoopInstructionsSchema = z
robot: z.literal('/audio/loop'),
use: useParamSchema.optional(),
output_meta: outputMetaParamSchema,
preset: preset.describe(`
preset: preset.optional().describe(`
Performs conversion using pre-configured settings.
If you specify your own FFmpeg parameters using the <dfn>Robot</dfn>'s \`ffmpeg\` parameter and you have not specified a preset, then the default \`mp3\` preset is not applied. This is to prevent you from having to override each of the \`mp3\` preset's values manually.
Expand Down
1 change: 0 additions & 1 deletion src/alphalib/types/robots/audio-merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const meta: RobotMeta = {
{ name: ':original', fields: 'third_audio_file', as: 'audio' },
],
},
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
},
Expand Down
1 change: 0 additions & 1 deletion src/alphalib/types/robots/meta-write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const meta: RobotMeta = {
data_to_write: {
copyright: '© Transloadit',
},
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
},
Expand Down
5 changes: 0 additions & 5 deletions src/alphalib/types/robots/video-adaptive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useParamSchema } from './_instructions-primitives.ts'
import type { RobotMeta } from './_instructions-primitives.ts'

export const meta: RobotMeta = {
allowed_for_free_plans: true,
allowed_for_url_transform: false,
bytescount: Infinity,
discount_factor: 1,
Expand All @@ -18,21 +17,18 @@ export const meta: RobotMeta = {
robot: '/video/encode',
use: ':original',
preset: 'hls/480p',
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
encoded_720p: {
robot: '/video/encode',
use: ':original',
preset: 'hls/720p',
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
encoded_1080p: {
robot: '/video/encode',
use: ':original',
preset: 'hls/1080p',
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
hls_bundled: {
Expand All @@ -49,7 +45,6 @@ export const meta: RobotMeta = {
example_code_description:
'Implementing HTTP Live Streaming: encode the uploaded video into three versions, then cut them into several segments and generate playlist files containing all the segments:',
minimum_charge: 0,
old_title: 'The /video/adaptive Robot',
output_factor: 1.2,
override_lvl1: 'Video Encoding',
purpose_sentence:
Expand Down
3 changes: 0 additions & 3 deletions src/alphalib/types/robots/video-subtitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import type { RobotMeta } from './_instructions-primitives.ts'

export const meta: RobotMeta = {
allowed_for_free_plans: true,
allowed_for_url_transform: false,
bytescount: 1,
discount_factor: 1,
Expand All @@ -28,15 +27,13 @@ export const meta: RobotMeta = {
{ name: ':original', fields: 'input_srt', as: 'subtitles' },
],
},
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
},
},
example_code_description:
'If you have two file input fields in a form — one for a video and another for an SRT or VTT subtitle, named `input_video` and `input_srt` respectively (with the HTML `name` attribute), hereʼs how to embed the subtitles into the video with Transloadit:',
minimum_charge: 0,
old_title: 'The /video/subtitle Robot',
output_factor: 0.6,
override_lvl1: 'Video Encoding',
purpose_sentence: 'adds subtitles and closed captions to videos',
Expand Down
3 changes: 0 additions & 3 deletions src/alphalib/types/robots/video-thumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import type { RobotMeta } from './_instructions-primitives.ts'

export const meta: RobotMeta = {
allowed_for_free_plans: true,
allowed_for_url_transform: false,
bytescount: 10,
discount_factor: 0.1,
Expand All @@ -23,14 +22,12 @@ export const meta: RobotMeta = {
robot: '/video/thumbs',
use: ':original',
count: 10,
// @ts-expect-error Discuss and resolve interpolation.
ffmpeg_stack: '{{ stacks.ffmpeg.recommended_version }}',
},
},
},
example_code_description: 'Extract 10 thumbnails from each uploaded video:',
minimum_charge: 0,
old_title: 'The /video/thumbs Robot',
output_factor: 0.05,
override_lvl1: 'Video Encoding',
purpose_sentence: 'extracts any number of images from videos for use as previews',
Expand Down

0 comments on commit 5cc5080

Please sign in to comment.