DEV Community

Kenny Shaw
Kenny Shaw

Posted on

How to Turn TikTok and YouTube Videos into SRT with One CLI Command

Turning a public video into editable subtitles often means juggling a downloader, an audio converter, a speech-to-text model, and an SRT formatter. That is manageable once. It becomes tedious when the source is a TikTok link today, a YouTube URL tomorrow, and an Instagram Reel the next day.

I wanted a workflow that starts with the link and ends with text or subtitles, without writing a new scraper for every platform. This tutorial shows the CLI workflow I use with Videosays.

What the workflow produces

From a supported public video link, you can request:

  • plain transcript text
  • timestamped timeline text
  • SRT subtitles
  • WebVTT subtitles

The CLI supports public links and share text from sources including YouTube, TikTok, Instagram Reels, X, Douyin, Xiaohongshu, Bilibili, and Kuaishou. Availability still depends on whether the source video is publicly accessible and whether its audio can be processed.

1. Log in from the terminal

You need Node.js 18 or newer. There is no global installation step:

npx videosays login
Enter fullscreen mode Exit fullscreen mode

The command opens a browser authorization flow and stores the resulting API key locally in ~/.videosays. For CI or another non-interactive environment, you can also provide VIDEOSAYS_API_KEY.

2. Transcribe a public video link

Pass the video URL directly to the command:

npx videosays transcribe "https://www.tiktok.com/@creator/video/123456"
Enter fullscreen mode Exit fullscreen mode

The default output is clean transcript text. You can also paste the complete share text copied from a social app; the CLI extracts a supported link from it.

For YouTube, the workflow is identical:

npx videosays transcribe "https://www.youtube.com/watch?v=VIDEO_ID"
Enter fullscreen mode Exit fullscreen mode

Each accepted transcription creates a task. Keep the returned task ID, especially for longer videos that may still be processing when the first command returns.

3. Export SRT subtitles

Choose SRT with the --format option:

npx videosays transcribe "https://www.youtube.com/watch?v=VIDEO_ID" --format srt
Enter fullscreen mode Exit fullscreen mode

If the task is still running, retrieve it later:

npx videosays status "TASK_ID" --format srt
Enter fullscreen mode Exit fullscreen mode

SRT is useful for video editors and publishing platforms because each subtitle block contains a sequence number, a start time, an end time, and the spoken text.

4. Use timeline or VTT output when needed

For a readable timestamped transcript:

npx videosays transcribe "VIDEO_URL" --format timeline
Enter fullscreen mode Exit fullscreen mode

For web players that expect WebVTT:

npx videosays transcribe "VIDEO_URL" --format vtt
Enter fullscreen mode Exit fullscreen mode

The four available formats are:

Format Best for
text notes, search, summaries, and content repurposing
timeline reviewing what was said at a specific moment
srt subtitle editing and common publishing workflows
vtt HTML5 video players and web caption tracks

5. Let an AI agent run the same workflow

The CLI also ships with a SKILL.md package. In an agent environment that supports skills, you can install the public repository:

npx skills add xwchris/videosays-agent-tools
Enter fullscreen mode Exit fullscreen mode

Or give the agent this instruction:

Read https://videosays.com/SKILL.md, install the Videosays Skill if your environment supports skills, and help me transcribe this public video link.
Enter fullscreen mode Exit fullscreen mode

This is useful when the transcript is only the first step. An agent can obtain the text and then turn it into notes, chapters, a summary, or a content brief.

Practical considerations

A few details matter in production:

  1. Only process content you are allowed to use. This workflow is for transcription and subtitle extraction, not for bypassing access controls or republishing someone else's video.
  2. Expect platform variability. A public URL can still be blocked by region, login requirements, deleted media, or source-platform changes.
  3. Keep task IDs. Longer jobs may require polling with the status command.
  4. Choose the output format at retrieval time. The same task can be retrieved as text, timeline, SRT, or VTT.
  5. Use batch commands for lists. The CLI also includes batch creation, status, continuation, and cancellation commands.

Links

The core idea is simple: keep the input as a video link and make transcript formatting an option, rather than building a different pipeline for every source platform.

Top comments (0)