360 Secure SkillHub
360 安全技能中心

Pyvideotrans

该 Skill 解析西班牙语 SRT 字幕并追加中文翻译以生成双语字幕,再调用本地 ffmpeg 将 MP3 音频与背景图合成为 MP4;也支持仅西语字幕并通过 MarginV 调整字幕位置。依赖固定 Windows 路径。

分类:创作
fondas123
fondas123
热度 0.00
最近更新 2026-07-08 07:06:03

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add fondas123/pyvideotrans
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
pyvideotrans
description
Create bilingual (Spanish + Chinese) videos from Spanish MP3 audio + SRT subtitle files using ffmpeg. Use when the user wants to create a video from a Spanish audio lesson with subtitles, create bilingual ES-CN subtitle videos for language learning, convert MP3 files with SRT into MP4 videos, translate Spanish subtitles to Chinese and embed them, or produce Spanish-only listening exercise videos with adjusted subtitle positioning (MarginV).

pyVideoTrans - Spanish Audio Video Creator

Create playable MP4 videos from Spanish MP3 audio + SRT subtitle files, with optional Chinese translations.

Prerequisites

  • ffmpeg: D:\pyvideotrans\ffmpeg\ffmpeg.exe (also ffprobe)
  • Background image: D:\pyvideotrans\swiss-landscape.png (1920x1080)
  • Python 3.11+ available system-wide
  • Output directory: D:\pyvideotrans\

Core Workflow

1. Build a Bilingual SRT

The source .srt file has Spanish text. Create a bilingual version by appending a Chinese translation line after each Spanish text line, keeping the same sequence numbers and timings.

Pattern per entry: ` N HH:MM:SS,mmm --> HH:MM:SS,mmm Spanish text line Chinese translation

`

Read source SRT with encoding='utf-8-sig', write with encoding='utf-8'. Use Python to parse SRT blocks and provide translations inline.

2. Create the Video

Run ffmpeg from D:\pyvideotrans\ffmpeg:

.\ffmpeg.exe -y -loop 1 -i "D:\pyvideotrans\swiss-landscape.png" -i "AUDIO.mp3" -vf "subtitles='BILINGUAL_SRT':fontsdir='C:/Windows/Fonts'" -c:v libx264 -preset fast -crf 22 -c:a aac -b:a 128k -shortest "D:\pyvideotrans\OUTPUT.mp4"

Use -timeout_ms up to 300000 for longer audio files (6-7 min).

3. Adjust Subtitle Position (MarginV)

For Spanish-only exercises where subtitles overlap the background:

-vf "subtitles='SRT':fontsdir='C:/Windows/Fonts':force_style='MarginV=55'"

MarginV=55 moves subtitles upward (larger = higher above bottom).

Spanish-Only Videos

For pure listening exercises using *-es.srt files:

  • Use source SRT path directly in subtitles filter
  • Do not add Chinese translations
  • Add MarginV=55 if user requests adjusted positioning

Source File Locations

All under D:\Spain:

  • 听力教程1: 西班牙语听力教程1\
  • 晨读美文: 西班牙语晨读美文\第四章 经典台词\
  • FSI Course: Spanish-Basic-Course\
  • Output videos: D:\pyvideotrans\