video-subtitles-and-audio-insert-workflow

Burns SRT subtitles into videos and generates edge-tts voiceovers using moviepy and FFmpeg.

1.2k|126|Updated Mar 14, 2025
One-click install
npx skills add https://github.com/inclusionAI/AWorld --skill video-subtitles-and-audio-insert-workflow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: video-subtitles-and-audio-insert-workflow
Source: https://github.com/inclusionAI/AWorld/tree/main/aworld-skills/video_subtitles_audios_insert
Command: npx skills add https://github.com/inclusionAI/AWorld --skill video-subtitles-and-audio-insert-workflow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires moviepy, edge-tts.

What problem does it solve?

Adding hard subtitles and voiceover narration to videos involves fiddly details: CJK font selection, bitrate control to avoid oversized files, subtitle positioning, and matching TTS audio length to scene durations. This Skill provides tested moviepy 2.x and FFmpeg workflows that handle these details correctly across macOS, Linux, and Windows.

Core Features & Use Cases

  • Hard Subtitle Burning: Parse UTF-8 SRT files and burn subtitles into video with moviepy 2.x, with CJK-capable fonts, resolution-matched font sizes, stroke styling, and bitrate or CRF encode control.
  • AI Voiceover Generation: Create narration with edge-tts voices (e.g. zh-CN-YunjianNeural), tuning rate, volume, and pitch, then fit audio to scene length using atempo/apad filters.
  • Troubleshooting Guidance: Fix common failures such as box-character subtitles from wrong fonts, oversized outputs from excessive bitrate, and wrapped lines overflowing the frame.
  • Use Case: Given a 720p MP4 and a Chinese SRT file, produce a subtitled video at ~600 kbps with STHeiti 40px subtitles, then add edge-tts narration paced to each scene with breathing room.

Quick Start

Burn the subtitles from subtitles.srt into input_video.mp4 using a CJK font and a bitrate about 1.35 times the source, then generate Chinese voiceover audio with edge-tts matched to the video duration.

Frequently Asked Questions about video-subtitles-and-audio-insert-workflow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I burn SRT subtitles into a video with Python?

Use moviepy 2.x to parse the SRT file into timed text clips, composite them over the video with CompositeVideoClip, and write the result with write_videofile using libx264. Set a bitrate around 1.2-1.5 times the source to avoid oversized outputs.

How to generate Chinese voiceover audio with edge-tts?

Install edge-tts and call edge_tts.Communicate with a voice such as zh-CN-YunjianNeural or zh-CN-XiaoxiaoNeural, optionally setting rate, volume, and pitch. Save the result as an MP3, then adjust its duration with FFmpeg atempo or apad filters.

Why do my subtitles show as boxes in the video?

Box characters mean the chosen font lacks the required glyphs, such as using Arial for Chinese text. Switch to a CJK-capable font like STHeiti or Songti on macOS, WenQuanYi Micro Hei on Linux, or Microsoft YaHei on Windows.

Does moviepy subtitle burning work on Windows and Linux?

Yes, the moviepy 2.x workflow is cross-platform on macOS, Linux, and Windows with Python 3.x. Only the font path differs per operating system, and FFmpeg/ffprobe must be available for encoding and inspection.

Why is my output video file so large after adding subtitles?

The output bitrate is likely set far above the source, for example 5000k when the source is 444 kbps. Check the source bitrate with ffprobe and set the output to roughly 1.2-1.5 times that value, or use CRF encoding around 23 instead.

How do I match TTS audio length to a video scene?

Measure the audio duration with ffprobe, then speed it up with the FFmpeg atempo filter if too long or pad it with apad if too short. Targeting scene duration minus about 0.2 seconds adds breathing room between scenes.