Apple Automator, Shell Script and batch files - video subtitles

287 views Asked by At

I'm making a Workflow to burn SRT to MP4. It's is working but I want it to go to all files of a folder and didn't find a way even with "Dispense Items Incrementally".

I have the SRT and the MP4 in the same folder, so I need the workflow to filter the results to only try the script with the MP4 files and maybe this is the problem for "Dispense Items".

Because the subtitled file goes to the same directory, the filter also excludes files named with "_SUB".

The image is below if someone has an idea... I'm open to other methods of doing this. I just need to go to a folder with 44 MP4 files (and .SRT with the same name) and batch encode the videos with subtitles.

Thank you, Luiz

enter image description here

1

There are 1 answers

1
llogan On BEST ANSWER

Open Terminal, navigate to the directory containing the files, and run:

for f in *.mp4; do ffmpeg -i "$f" -vf "subtitles=${f%.*}.srt" -c:a copy "${f%.*}_srt.mp4"; done