This project provides a batch script to automatically embed subtitles into videos using FFmpeg on Windows.
- Download FFmpeg from the official website.
- Extract the downloaded ZIP file. You should now have a folder like
ffmpeg-4.x.x-win64-static
. - Rename the folder to simply
ffmpeg
for easier access. - Move this
ffmpeg
folder toC:\
. So, it should beC:\ffmpeg\
. - Add
C:\ffmpeg\bin
to your system's PATH:- Right-click on the
Start
button and selectSystem
. - Click on
Advanced system settings
. - Click the
Environment Variables
button. - Under
System Variables
, locate thePath
variable and clickEdit
. - Click
New
and add the pathC:\ffmpeg\bin
. - Press
OK
to save your changes.
- Right-click on the
- Download the project by clicking "Code" (Green button) and then "Download Zip"
- Unzip the files into a folder
- Place your video and .srt files in the folder named "input" (created when you unzipped the project). Remove the files there, they are just a sample. You should have an mp4 file and an srt file named the same.
-
Open Command Prompt (
cmd
) as administrator. -
Navigate to the folder you created:
cd path\to\folder
Replace
path\to\SubtitleProject
with your actual path. -
Run the script:
addsubtitles.bat (or sh addsubtitles.sh in Mac)
-
The script will process each video in the
input
folder. If a corresponding.srt
subtitle file is present, it will embed the subtitles into the video. The output video will have_subtitled
added to its name (e.g.,video1_subtitled.mp4
). -
The script will notify you about its progress in the Command Prompt, such as when it's processing a video or if a subtitle file isn't found for a particular video.
-
Once completed, it will display "All videos processed."
- Check the
input
folder in your porject. - You'll see the original videos, subtitle files, and the new videos with the embedded subtitles.
- Play one of the subtitled videos to ensure the subtitles are correctly embedded.