Score:0

Looking for a subtitle translator-&-merger to create dual-language subtitles

ni flag

I want to translate an .srt file, and then merge the result with the original such that both texts appear in the resulting .srt file, the original at the top and the translation at the bottom. If I can modify the font size, choose what goes where, and perform it all on my machine (Ubuntu 20.04) without internet access, even better. Has anyone found solutions for this?

I've tried many things so far but these two were the most promising. The third was a nice thing to imagine working someday.

srtssa/transmerge

I found something that sounded perfect on https://forum.language-learners.org/viewtopic.php?t=13897#p162942. I installed and ran https://gist.github.com/bathtime/6ec36e47bb4a104bd648dc1abcaaccc7 (updated 2021.5.9; seemingly the updated version of https://gitlab.com/bedtime_/srtssa/-/tree/master, updated 2020.7.6). It created a mynewfile.txt.0813115519.tmp file and opened in terminal either it or the original .srt file (both had the same content so I couldn't tell). After over ten minutes' waiting I canceled the operation because it seemed stuck. The code I ran to get here was (from one of the links above):

[code]./srtssa.sh -t en --alt -i myfile.srt -o mynewfile.srt[/code]

I do not know what the -t or --alt of the code above mean, unfortunately.

I then tried what was probably the precursor to the above, https://gist.github.com/bathtime/8ae8303e870b2909c03f3b9332a4dd47 (updated 2020.4.7). It failed with the following messages:

./transmerge.sh: 25: [: en: unexpected operator
./transmerge.sh: 26: [: unexpected operator
./transmerge.sh: 31: [: utf-8: unexpected operator
./transmerge.sh: 98: Syntax error: Bad for loop variable[/code]

The code I ran was: ./transmerge.sh fr en en sample.srt. From the last link above, it should be telling the program that the source language is French, the target language is English and that English should be displayed on top and French on the bottom.

Subtitle Editor

I tried this next however keep getting stuck at untarring the tar file. Following https://github.com/kitone/subtitleeditor I tried:

./autogen.sh
make
sudo make install

... but keep getting the following error after the make command:

make: *** No targets specified and no makefile found.  Stop.

I used https://wiki.asterisk.org/wiki/display/AST/Untarring+the+Source to help me untar the file but I'm still new at installing things this way so it could be that I messed something up there.

Apertium+Gaupol

https://wiki.apertium.org/wiki/Translating_subtitles#Gaupol_extension seemed promising but the Gaupol community said the extension is outdated and "in hindsight Gaupol extensions were a bad idea". Too bad because it seemed like a great utility.

David avatar
cn flag
What does this have to do with Ubuntu?
raj avatar
cn flag
raj
If you want one subtitle at the bottom and another at the top with a `.srt` file, you need a **video player** that supports this in the first place (ie. subtitles in two different locations). From what I know, most players don't.
zulu avatar
ni flag
The key seems to be making an `.ass`/`.ssa` file instead. Then you just need a player that works with it, eg: VLC.
Score:0
ni flag

Figured it out! You need Aegisub, https://ubuntuhandbook.org/index.php/2018/08/how-to-install-aegisub-subtitle-editor-in-ubuntu-18-04/:

sudo add-apt-repository ppa:alex-p/aegisub
sudo apt-get install aegisub

Open the first subtitle file and through the Style Editor update the Alignment to 8 for centring above: https://www.youtube.com/watch?v=gopfzv6tZYA&t=63s. It's useful to save these styles via Subtitle > Style Manager. The second subtitle file will already likely be set at the default of 2, which is centred below:

Alignment-menu

Then simply Ctrl+A, Ctrl+C the subtitles from the first file and Ctrl+V them into the second (found on https://forum.videohelp.com/threads/392423-Merge-Two-ass-Files-in-Aegisub#post2544365). It doesn't matter where, the program will automatically order them chronologically on save. Then Ctrl+S to be prompted where to save your file. Save it with the extension .ass because an .srt file will pile everything at the bottom and not save the font size, rendering the left instead of the right:

ass-vs-srt-subtitles-rendered-by-Aegisub

You can then play with font styles to grey one out a tad or make it appear later (Ctrl+A then Timing > Shift Times…, useful for language learning for example).

This works with VLC but not with the stock video player in Ubuntu 20.04 (I don't think it supports .ass files). I tried hardcoding and burning the subtitles into the video file with HandBrake (https://www.youtube.com/watch?v=ZjX5v5Z4jQA&t=146s) but it didn't work. I fiddled with it for some time but ultimately wasn't able to figure out why.

Note on .srt/.ssa/.ass files

.srt's seem to be the most basic, and can only layer one set of subs directly over a second. Everything is either/or. You can manually add {\an8} to the beginning of lines and then they all move to the top of the video, but will still be one directly above the other.

.ssa's were an upgrade and .ass's are the latest revision: https://en.wikipedia.org/wiki/SubStation_Alpha. They allow for different font sizes, colours, positioning, splitting of subtitle streams, etc.

Conclusion

Or how to transcribe, translate, and merge subtitles for multilingual output:

  1. Transcribe an .srt file from the video file using pyTranscriber: How do I install pyTranscriber on Ubuntu 20.04 from GitHub? (might need to be an .mp4; .mkv doesn't work at any rate)
  2. Translate the file online (I use https://www.syedgakbar.com/projects/dst but https://www.subtitlecat.com looks good as well)
  3. Use Aegisub as outlined above to merge the resulting .srt/.ass files into a final .ass file. Both it the same as and place it in the same folder as your video file (eg: mymovie.mp4 mymovie.ass) and it should load automatically.

I wish I could translate it directly on my machine (step 2) and then hardcode it into the actual .mp4 file but I'm sure these, too, will come with time. As will better transcription and translation, but we've definitely long passed "good enough" territory.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.