Script to preserve subtitles in edited videos

jhyler

Member
This is something I wrote to preserve timed text (srt) or Advanced Substation Alpha (ass) subtitles in videos being edited with VideoRedo. It is used as follows:
  1. Install ffmpeg, if you don't already have it. I would suggest adding the path to the binaries into your path, but it isn't required.
  2. Modify the attached bat file with your choice of directores and options.
  3. Use VideoReDo to make cuts in your videos. I recommend you don't do anything other than make cuts. DO NOT SAVE YOUR VIDEOS - save project files instead, put them in the directory you specified in the bat file.
  4. Open a command window and type the command "subtitler" to start the bat file. The subtitler will open each of your projects in turn, save the video using the profile you selected, retrieve the first English subtitles it finds on the original video, modifies their timing in accordance with your cuts, and (depending on the options you choose) either embeds the updated subtitles into the output video or leaves them in a .srt file with the video.
I strongly recommend the profile you choose saves your videos as mkv files. Almost all the use I've made of this script has been in creating mkv files, a little bit as mp4 files, and I've never tried anything else at all.

That's all there is to it. Please note that the default behavior of the program is to delete your project files after it uses them. You can disable this behavior with the -kp (keep projects) option.

Best of luck! I can't promise any support, but you can reply here with any feedback.
 

Attachments

Last edited:

reneg

New member
Brilliant. I've been looking for something that could handle timed text and edits with VideoRedo. Your script works well for me on the files that I've tried. Thank you for posting it.
 

bhiga

New member
This is great!! Thank you for sharing your work, also nice to see a fellow VBScripter. :cool:

MKV output works well, the only issue I ran into was an error deleting the temporary .ass file if it doesn't exist because there are no subtitles in the output scene - got around it with if fso.FileExists check.

My primary use is to split combined episode files, so I also customized it to use the project name as the output file name for the video and subtitle file - that way I can just save an appropriately-named project file for each episode since I already have the episode names and numbers added from FileBot. Using your script is much faster and less error-prone compared to my previous workflow of saving split scenes from VRD and renaming the output files afterward!

BTW, if you aren't already familiar with the site, SS64.com has been my go-to site for both batch/CMD and VBScript reference/examples (there's more there too) for decades and it's where I learned a key errorlevel evaluation difference between .bat and .cmd processing.
 
Top Bottom