Last active
March 26, 2021 16:18
-
-
Save frijole/479e3eea44bf2eb6c544b7e32a462289 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
say you have some files, maybe youtube-dl output, thats includes an mpeg 4 video file and captions in ttml format like this: | |
$ ls | |
Destroy the Technostructure.description | |
Destroy the Technostructure.en.ttml | |
Destroy the Technostructure.jpg | |
Destroy the Technostructure.mp4 | |
and you want to prepare a nice mp4 file to use in Home Sharing with that subtitle track available like a real movie. | |
ffmpeg doesn't support the ttml format, so you need to convert to `srt` with this purpose-built utility: https://github.com/Cryental/Kayla.NET | |
$ ./Kayla.NET-macOS -f SubRip -i Destroy\ the\ Technostructure.en.ttml -o Destroy\ the\ Technostructure.en.srt | |
and then use ffmpeg to combine the tracks: | |
$ ffmpeg -i Destroy\ the\ Technostructure.mp4 -i Destroy\ the\ Technostructure.en.srt -c copy -c:s mov_text -metadata:s:2 language=eng Destroy\ the\ Technostructure-CC.mp4 | |
...and you'll have a video file with the option for "English" captions! | |
post script: the ffmpeg invocation | |
$ ffmpeg \ | |
-i Destroy\ the\ Technostructure.mp4 \ # first input | |
-i Destroy\ the\ Technostructure.en.srt \ # second input | |
-c copy -c:s mov_text \ # copy viewo and convert caption to mov_text | |
-metadata:s:2 language=eng \ # set the language for the second track (the captions) to english | |
Destroy\ the\ Technostructure-CC.mp4 # output filename | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can convert all the
ttml
files in a folder at once with$ ./Kayla.NET-macOS -f SubRip -b -i ./ -o ./