subtitle_import,
and replacing the transcript later needs subtitle_reimport.
What you can send
subtitles on createProject takes a source file, a target file, or both:
The rules for a file:
- Each file is
{"format": "srt", "content": "..."}, wherecontentis the whole SRT file as one JSON string, at most 2 MiB and 5000 cues. source_languageis required withsource.- With both files, the cues must match: the same number, with the same times and, where both files label a cue, the same speaker.
- A cue may start with a speaker label such as
[SPEAKER_00]:. Label every cue or none. - Every cue starts before it ends, and ends within the media.
subtitles_invalid, and its errors say which rule and where.
A content longer than 2,097,152 characters (2 MiB) answers 422 validation_failed instead.
1. Estimate
The price does not depend on the subtitles. A project with your own text costs what any project costs: the project itself, and the auto-dub, which is priced on the length of the media. So the estimate can leave the subtitles out, which also keeps it small: an estimate takes 1 MiB at most, while createProject takes 5 MiB. Without them, the estimate does not check the files or the plan featuresubtitle_import: only createProject does. When the request with them fits in 1 MiB, send
them to the estimate as well to check them first.
total_minutes: it is the price cap you send next.
2. Create the project
project_processing job with the new project_id, as in the Quickstart. The auto-dub follows
it as a dub job of its own.
Your own text is paid text like any other. Until the dub of the project is charged, reading the
transcript back answers 409 dub_payment_required.
3. Replace the transcript later
importTranscript puts new subtitles into a project that already exists, for example after a translator has edited the file. It needs the scopetranscripts:write, and it is free.
project_processing job. Wait for it as for any job. What to know before you send it:
- The whole transcript is replaced. Every segment gets a new id, and a
listSegmentscursor from before answers 409transcript_replaced. - The side you leave out is made again. With
sourceonly, the translation is made again by machine. Withtargetonly, the source text is recognized again inside your cue times. Send both files to keep both texts as you wrote them. - The old transcript is not lost. A version is saved first, and if the job fails the old transcript comes back. See listTranscriptVersions.
- It does not dub. The import ends when the text is ready.
- The first dub must have been charged. Before that, on a project created through this API, the import answers 409
dub_payment_required, like every other operation on the text. - The project must be at rest. While it is processing, dubbing, translating or lip-syncing, the import answers 409
project_not_ready,dub_in_progressortranscript_busy, and while another import runs,subtitle_import_in_progress. - It counts against the hourly translation budget, by its number of cues (
translation-hourin Rate limits). Over the budget it answers 429rate_limited, and a file with more cues than the whole budget answers 422translation_batch_too_large.
4. Bring the dub up to date
After the import, the dub no longer matches the text:- every segment reads
dub_state: outdated, andcounts.needs_redubof getTranscript counts them; - the dubbed outputs of listProjectOutputs read
outdated: true.
available: false,
unavailable_reason: not_produced), and a video with burned-in subtitles or translated on-screen text reads outdated: true. Order
those again, each at its own price: see Lip-sync, On-screen text and
Downloads.