Jump to content
The Dark Mod Forums

Automatic subtitles generation in Kdenlive


datiswous
 Share

Recommended Posts

I previously posted about this in a status update. To make it a bit more in-view for the future I post the info also in this topic.

I recently figured out how to make subtitles work for missions following this wiki guide: https://wiki.thedarkmod.com/index.php?title=Subtitles

You can type in the subtitle-text manually either in the .subs or .srt files (in a text-editor) or use an video editor for that (recomended for .srt). What is also possible on some advanced editors including the free and open source multiplatform Kdenlive editor is to auto generate the subtitle text for you from the audio or video file. You can then export to an .srt file that works directly in tdm. If you want to use the subs files for shorter sentences, you can just copy text from the .srt files.

In Kdenlive you can install speech to text libraries from VOSK. For this to work you have to download and install Python. Info how to do the process of installation and usage can be seen in the following video (6.5 minutes):

Spoiler

 

To sum it up:

Configure first time:

  1. Install Python. (on Windows) During setup, you have to select Advanced Options and there mark Add Python to environment variables (super important!).
  2. In Kdenlive go to menu settings, click on configure Kdenlive.
  3. In that configure window, click in the left menu on Speech to text.
  4. There you click on the link to download speech models.
  5. On the website ( https://alphacephei.com/vosk/models ) you can click on a model download link, but keep the click pressed and move your mouse with the link to the configure Kdenlive window. Kdenlive then asks to install the model from url. vosk-model-en-us-0.22-lgraph is probably decent for most use cases. but you can install and test them all.

To use it:

  1. First load an audio or video file into the view by dragging the file in one of the audio or video bars at the bottom (video: v1, v2 or audio: a1, a2).
  2. Click on menu Project > Subtitles > Edit Subtitle tool. You see an extra Subtitles bar on top.
  3. Now you select the audio or video file (it is sellected when it is outlined with an orange border) in the specific bar and then click on menu Project > Subtitles > Speech recognition.
  4. In the Speech recognition dialog, you select the correct language model and choose option Selected clip.
  5. After generation, you can preview the generated subtitles via the top right window. Make sure it is at starter position for playback. Using an audio file, you see a black background with the subtitles on top.
  6. Now you can tweek the position and edit the text directly in the Subtitles bar. This takes up the most time. Unfortunatelly the generation is not flawless, so you have to correct some words.

Tweeking the subtitles for Requiem took me hours, becouse I wanted them to line up differently. Usually the subtitles are not generated as full senteces. This looks sloppy. If you want to add subtitles quickly without spending much time on it, it can be done this way. If you want to do it right, it still takes a lot of time in my experience.

To export to .srt is shown in the following video:

Spoiler

 

Although actually it's just one step:

  1. Click on menu Project > Subtitles > Export subtitle file.

I will probably create a wiki article with images about it later.

Edited by datiswous
  • Like 2
Link to comment
Share on other sites

The subtitle generation doesn't take different voices into account. So often different voices end up in the same subtitle line (so you have to devide them by editting). Can for example bee seen in fm Hair in the Snare where the mission intro has 2 voices.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recent Status Updates

    • snatcher

      TDM Modpack v2.6 released!
      · 0 replies
    • peter_spy

      Perhaps an unpopular opinion: TDM team might benefit from someone with actual QA experience; someone with naturally and professionally developed curiosity, who is interested in how and why things work, how they break At least to me it's kind of mind-boggling how untested some rather important features are (first the absence alert feature for items, now the rope +body carry behavior).
      · 4 replies
    • nbohr1more

      The Dark Mod is hosting an Ask Me Anything thread on the PC Gaming reddit forum:  https://www.reddit.com/r/pcgaming/comments/10nfcwj/hello_we_are_the_international_development_team/
      Feel free to join the discussion there
      · 2 replies
    • stgatilov

      Bumped into an interesting piece of wisdom called Hyrum's Law:
      With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody.
      · 5 replies
    • The Black Arrow

      I love playing The Dark Mod when it's cold in my place. Bonus points when it's a bit (or even very) dark and it's raining, too.
      · 2 replies
×
×
  • Create New...