As soon as you handle dozens or hundreds of videos per week, manual clicking in editing software becomes a bottleneck.
The Python + FFmpeg combination allows you to build a batch video processing pipeline that renames, reformats, subtitles, resizes, and compresses your files without human intervention.
Rename Your Files for Multi-Platform 📁
The Problem
Files named VID_20260123_142305.mp4 tell you nothing about:
- The target platform
- The content
- The publication date
The Solution: Intelligent Naming Convention
A first level of automation consists of imposing a logical naming convention:
Integrating the target platform, a timestamp, and a readable slug.
The Python Architecture
In Python, you can:
Step 1: Browse a source folder
Step 2: Read a CSV or table
Read a CSV or table (Airtable, Notion) containing metadata:
- Platform
- Title
- Publication date
Step 3: Rename according to the pattern
Rename each file in the form:
TIKTOK_2026-01-23_my-hook-title.mp4YT_SHORTS_2026-01-23_topic-keyword.mp4
The Code
import os
import csv
from pathlib import Path
def rename_videos_from_csv(source_dir, csv_path):
"""
Renames videos according to CSV metadata.
CSV format: filename,platform,slug,date
"""
with open(csv_path, 'r') as f:
reader = csv.DictReader(f)
for row in reader:
old_path = Path(source_dir) / row['filename']
new_name = f"{row['platform']}_{row['date']}_{row['slug']}.mp4"
new_path = Path(source_dir) / new_name
if old_path.exists():
old_path.rename(new_path)
print(f"✓ Renamed: {old_path.name}→{new_path.name}")
The Impact
This simple renaming aligns your filesystem with your editorial strategy and facilitates the rest of the pipeline:
- Filter by prefix for each platform
- Archive by date
- Automate upload
💡 Pro Tip
Add an MD5 hash to the filename to detect duplicates.
This prevents reprocessing the same video twice if it's already in the pipeline.
Add Captions in Batch 📝
The Problem
Manually adding subtitles to 100 videos = 100 hours of work.
The Automated Solution
Batch generation and injection of subtitles.
The Two Approaches
Approach 1: OCR or Speech-to-Text
Via an external service to produce subtitle files (SRT, VTT).
Approach 2: Direct addition to the video
With FFmpeg, by burning text into the image or adding a separate subtitle track.
The Complete Pipeline
A Python script can:
Step 1: Transcription
Send each audio/video file to a transcription service.
Step 2: SRT Retrieval
Retrieve the generated SRT.
Step 3: Integration with FFmpeg
Call FFmpeg on the command line to integrate subtitles, respecting the resolution and target format.
The Code
import subprocess
def burn_subtitles(video_path, srt_path, output_path):
"""
Burns subtitles into the video with FFmpeg.
"""
cmd = [
'ffmpeg',
'-i', video_path,
'-vf', f"subtitles={srt_path}:force_style='FontSize=24,PrimaryColour=&HFFFFFF&'",
'-c:a', 'copy',
output_path
]
subprocess.run(cmd, check=True)
print(f"✓ Subtitles burned: {output_path}")
The Result
You get a batch of videos ready for TikTok, Reels, or Shorts with integrated captions, without going through a manual editor for each one.
⚠️ Warning
Burning subtitles into the video = irreversible.
Always keep a copy of the video without subtitles to be able to adjust the style or language later.
Related reading
Stop scrolling. Start scaling.
Viral Manager monitors Instagram & TikTok virality every 6h, auto-generates content blueprints, and assigns tasks to your creators — all in one platform.

Resize and Compress for TikTok, Reels, Shorts 📱
The Context
The three main platforms share the same vertical format (9:16), but weight and codec constraints remain crucial for:
- Upload speed
- Playback fluidity
FFmpeg is designed for this type of large-scale processing.
Compression Profiles
You can configure a series of profiles:
Vertical 9:16 Profile
scale=1080:1920 with cropping if necessary, for TikTok, Reels, Shorts.
Social Compression Profile
Adjusted video bitrate (for example ~4–8 Mbps depending on duration), H.264 codec and AAC audio to find the right balance between quality and upload speed.
The Batch Pipeline
On the script side, a simple Python loop can:
Step 1: Browse all .mp4 files in a folder
Step 2: Apply the FFmpeg command
Apply the corresponding FFmpeg command to each profile, generating suffixed files:
_tiktok.mp4_reels.mp4_shorts.mp4
The Code
def process_vertical_video(input_path, output_path, bitrate='6M'):
"""
Resizes to 9:16 and compresses for social networks.
"""
cmd = [
'ffmpeg',
'-i', input_path,
'-vf', 'scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920',
'-c:v', 'libx264',
'-b:v', bitrate,
'-c:a', 'aac',
'-b:a', '128k',
'-movflags', '+faststart',
output_path
]
subprocess.run(cmd, check=True)
print(f"✓ Processed: {output_path}")
# Batch processing
source_dir = Path('./raw_videos')
output_dir = Path('./processed_videos')
output_dir.mkdir(exist_ok=True)
for video in source_dir.glob('*.mp4'):
output_path = output_dir / f"{video.stem}_vertical.mp4"
process_vertical_video(str(video), str(output_path))
💡 Pro Tip
Use the
-movflags +faststartflag to optimize streaming.This allows the video to start playing before being fully downloaded. Crucial for mobile user experience.
Conclusion: From Craft to Automated Factory
By combining these operations — renaming, subtitles, resize, compression — in a single script, you move from a craft flow to a true automated post-production factory.
The difference between a creator who scales and a creator who stagnates?
Post-production automation.
Act now.
Related reading
Resources to go further
Your agency deserves better than spreadsheets.
Join OFM agencies using Viral Manager to spot viral formats before competitors, brief VAs in 5 minutes, and post across creator accounts without shadowban risk.

Starter · Scale · Empire — 7 days free, cancel anytime.
Frequently asked questions
How can I automate video renaming for multiple social media platforms?+
You can automate video renaming using Python scripts that browse source folders and read metadata from sources like CSV, Airtable, or Notion. This allows files to be intelligently renamed, for example, TIKTOK_2026-01-23_my-hook-title.mp4, aligning your filesystem with your editorial strategy for easier filtering and archiving.
Is it possible to add subtitles to a large number of videos in a batch?+
Yes, batch subtitling is possible by integrating Python scripts with transcription services to generate SRT files. These can then be integrated into videos using FFmpeg, either by burning them directly into the image or adding a separate track, potentially saving 100 hours of manual work for 100 videos.
What's the fastest way to optimize videos for TikTok, Reels, and YouTube Shorts?+
The fastest way is using FFmpeg within a Python script to batch process videos. It resizes them to the 9:16 vertical format (e.g., 1080x1920) and compresses them with optimized profiles like H.264 codec and 4-8 Mbps bitrate, generating platform-specific outputs for quick uploads.
What are the key benefits of automating video post-production for content creators and OFM agencies?+
Automating post-production tasks like renaming, subtitling, resizing, and compression transforms a manual 'craft' flow into an 'automated factory.' This eliminates bottlenecks, saves dozens of hours weekly, and is crucial for creators and OFM agencies looking to scale their content output without stagnation.
How does Viral Manager support OFM agencies in implementing video automation?+
Viral Manager assists OFM agencies in leveraging advanced automation solutions, such as the Python + FFmpeg pipeline described here, to streamline video post-production. This enables agencies to efficiently manage tasks like intelligent renaming, batch subtitling, and multi-platform optimization for hundreds of videos, ultimately helping them scale their content operations effectively.

