How to Automatically Sync Subtitles with Video using Machine Learning

0 Comments
Editor Ratings:
User Ratings:
[Total: 0 Average: 0]




This is a simple tutorial to explain how to sync subtitles automatically on MAC using machine learning. There is a free command line tool called, Subsync that lets you do that. It uses some deep learning approach to fix the supplied subtitle file. It actually takes a video from you along with a SRT file to correct it. In output, it produces synced SRT file that you can play with your video in any video player you like that supports external subtitle files. You just have to run a simple command and it will produce the output depending on the size of the supplied video. In my case, it was able to sync subtitles for the whole movie file that I used for testing.

There are subtitle maker software out there that you can use to do the same. But in those tools, you have to manually sync the subtitles by adding delays and shifts. But Subsync here is an intelligent tool to do the same without your interference. It analyzes the dialogues in the video file and then calculates the correct time to shift the subtitles to properly sync them. In the terminal window, you can see the process and it even shows you the amount of time in seconds that needs to be used as offset to sync the subtitles. In addition to this, this tool relies on FFmpeg so you will have to make sure that it is installed on your MBP.

How to Automatically Sync Subtitles with Video using Machine Learning

How to Automatically Sync Subtitles with Video using Machine Learning?

Using this tool on your MAC is very simple. You just need to have a little experience with the terminal. Make sure that Homebrew is updated and then install FFmpeg. After that, proceed with installation of Subsync.

Execute the following command to install Subsync. After this command finishes successfully, you are free to use this tool.

sudo pip3 install git+https://github.com/smacke/subsync

Install Subsync in MAC via PIP

Now, navigate to the folder in terminal where the video and incorrect subtitle file is. Simply run the command in the following syntax and then wait for the process to finish. In the end, you will see the calculated offset in the terminal window and it will save the corrected subtitle file in the same folder.

Syntax: subsync "Input Video" -i "UnSynced Subtitle File" -o "Synced Subtitle File"

Examplesubsync Sample.mp4 -i unsyncsample.srt -o synced.srt

Subsync in action

The above command will take some time based on the input file size. In my case it took around 4-5 minutes to process a video file of size 1.2GB and 130 minutes in length. You can simply copy the synced subtitles file from the folder and then do whatever you want. Currently, it supports English only

Final words

If you want to auto-magically synchronize subtitle of a video file then the above mentioned tool does a great job. You just have to get ready the input files and then leave the rest on this tool. It hardly takes a few minutes to sync subtitles. Also, as it is a open source command line tool so you can use it to batch sync subtitles with video. Just create a batch file with name of videos and corresponding subtitle files to fix.

Editor Ratings:
User Ratings:
[Total: 0 Average: 0]
Free/Paid: Free

Leave A Reply

 

Get 100 GB FREE

Provide details to get this offer