Video translation during playback

I would like my videos, which are in French, to be viewable while reading in other languages. At best with voice translation (with AI?), but subtitles in another language would be more than enough.

My videos are on my host server, I don’t use youtube.

If I understand correctly, if I were to use a translator like Zeemo, HeyGen or others, I would have to translate the video using these translators and post the translated version on my server. However, I’m less happy with this approach because this does not leave the viewer free to determine the language of their choice.

Do you have any “elegant” idea on how to do this?

Hi @zdenek,

What exactly are the requirements?

Is the translation merely subtitles, or do you have different audiotracks for the videos?

Should the visitor be able to select the language of the video regardless of the language in which they view the rest of the site?

Cheers,
Erwin

Hi @Heroic_Nonsense , Erwin,

Very simply, keep my original video version and allow the visitors to get their language (if supported) while watching. I imagine this should be possible via browser, but I am not sure about easiness of this approach.

Cheers,
Zdenek

Hi @zdenek,

Your response is very confusing. To be sure we understand eachother, let’s go through this again.

  1. You have a site, in French
  2. There’s a video on your site, which has French audio
  3. You want your visitors to be able to see the video in their own language

Correct?

If you need the audio of the video to be in their own language, then you’ll need to upload versions of your video with different language tracks, and have the visitor pick the right one to view. If you use Stacks, you can use the Agent stack ($40, from Weaver’s Space) to have the right language version shown automatically to the visitor (Agent will read the user’s preferred language from their browser settings, and show the correct video to them. If you don’t have a video in their language, you can specify which version of the video it should default to)..

If you’ll be using subtitles, you’ll need to add some HTML to display the right subtitle track while the video plays. There currently is no stack that does this out of the box. For subtitles, the VTT format is the way to go for web content. You’ll need the HTML5 video player, as that can show VTT subtitles, and implement that into your page.

The code would ook something like this:

<video id="video" controls preload="metadata">
 <source src="yourvideo.mp4" type="video/mp4">
   <track label="Francais" kind="subtitles" srclang="fr" src="yourvideo-fr.vtt" default>
   <track label="Nederlands" kind="subtitles" srclang="nl" src="yourvideo-nl.vtt">
   <track label="English" kind="subtitles" srclang="en" src="yourvideo-en.vtt">
</video>
</html>

You of course need to write out the VTT files yourself, and there are quite a few online tools to do that. You can use ChatGPT to translate a finished VTT file to another language.

Cheers,
Erwin

1 Like

Hi Erwin @Heroic_Nonsense,

Thank you for your reply. What you are suggesting is to generate versions with different audio tracks or subtitles and then direct the viewer to the version of their choice. I understand this approach. I do this for written texts.

For videos (I use the HTML 5 Video stack), from my point of view, I would prefer a more ‘lazy’ approach. Namely, having a single version and letting the browser used by the reader automatically add subtitles during playback according to their geographical location. As is the case when playing certain videos on YouTube.

I understand that this is not the role of stacks, but I was wondering if I could add some code somewhere to make the subtitles appear according to the above criteria.

I hope my request is clear.

Cheers,
Zdenek

Hi @zdenek,

The right subtitles for the visitor’s language are automatically applied, IF the user has set their browser to a language that you have a VTT file configured for in the HTML code. So, in my example, a visitor from the Netherlands with their browser set to Dutch, will automatically see the Dutch subtitles.

If the visitor has their browser set to a language that you’ve not specified, the browser will dapply the subtitles you set as default (in my example from before, I set French as the default).

Now if you mean that the translation happens automatically (in other words: AI based subtitles) without any effort from you, then I’m afraid that’s not (yet) possible at this time.

Cheers,
Erwin

Yes, this is the way I would like it works. If AI can help us, so why not.
For some french speaking youtube videos, I get automatically the text in french (see the picture here after), so I wonder how it works. I don’t think subtitles are generated in the same language for a spoken language (this is done for DVDs with tracks for the hearing impaired). And if it works for the same language, why not for another one?

I’m using FCPX for my videos and and know that generating subtitle tracks is a lengthy process.

Cheers,

Zdenek

You really can’t compare Youtube to webpages on the regular internet, like yours and mine.

Youtube spends an awful amount of money on software, algorithms and processing power to make real time transcription, translation and streaming of text into rendered videos possible. This is not something us mortals can replicate.

What you can do, is have your video transcribed by AI. This service, for example, does this. You’ll end up with a (French in your case) transcription of the video.

Next, you’d turn that in to a French language VTT file. This service does this.

You’ll end up with a .vtt file that looks like this:

You can use ChatGPT to generate translations of the file into the languages you’ll need for your website. You’ll end up with a bunch of files, one for each language.

Using the code snippet in one of my previous posts, you can now have the subtitles loaded automatically based on the visitor’s browser settings for language.

Cheers,
Erwin

Yes, that’s understandable.

Thanks for sharing your thoughts and links.

For now, I’ve done a quick test. My videos are in an accordion, and I’m a little confused about where to put the html VTT snippet (and also whether I need to define an ID for each video and where).

However, generating SRT format subtitles works well and allows me to use them in FCPX.

Cheers,

Zdenek

Hi @zdenek,

In order for the VTT to work, you’ll need to do the following:

  • Remove the MediaElements video player from the accordion
  • In the space where the MediaElements video player was (in the accordion), drop in an HTML stack
  • Edit the HTML stack and replace the default placeholder content with the following HTML code snippet:
<video id="video" controls preload="metadata">
 <source src="yourvideo.mp4" type="video/mp4">
   <track label="Francais" kind="subtitles" srclang="fr" src="yourvideo-fr.vtt" default>
   <track label="Nederlands" kind="subtitles" srclang="nl" src="yourvideo-nl.vtt">
   <track label="English" kind="subtitles" srclang="en" src="yourvideo-en.vtt">
</video>
</html>
  • Repeat for all your videos

You’ll of course need to replace yourvideo.mp4 in the HTML code snippet with the filename of the video file you’re using (you can also specify a path, but always include the filename). The same goes for yourvideo-fr.vtt (and the other languages); you’ll need to replace those in my example code with the file names you’ll be using.

Cheers,
Erwin

Hi Erwin @Heroic_Nonsense ,

OK, it works the way you described it. However there is a difference of the video shape between the HTML stack and the HTML 5 Video stack. The last one I’m using, gives me the video size inside the window. This is not the case for HTML stack which does not resize it (so I see only a part of the picture surface and i suppose additional code would be necessary). This job is directly done with HTML 5 Video stack.

I wonder if subtitle management could be integrated into HTML 5 Video stack.

Also, with RMWL stack I’m using, the language versions are directly selected from the menu (on the right top) because there are not only videos attributed, but also additional texts.

For your information, for each video on the web page, my stack structure is as follows :

  • Card
  • SEO meta tags
  • 2 columns
  • card section
    • 3x RMWL wrapper (for each language versions)
      • Container
      • Accordion
      • HTML 5 video

With regard to my structure, I wonder if it wouldn’t be better to generate different language versions directly during editing in FinalCut Pro… (knowing that it adds volume to my host folder).

Cheers,

Zdenek

PS. I’ll will be back in 3 weeks

Hi @zdenek,

You can set width and height for the HTML5 video player.

You do this by adding them to the video tag in the source code like this:

<video width="400px" height="300px" id="video" controls preload="metadata">
 <source src="yourvideo.mp4" type="video/mp4">
   <track label="Francais" kind="subtitles" srclang="fr" src="yourvideo-fr.vtt" default>
   <track label="Nederlands" kind="subtitles" srclang="nl" src="yourvideo-nl.vtt">
   <track label="English" kind="subtitles" srclang="en" src="yourvideo-en.vtt">
</video>
</html>

It will take a bit of experimenting to figure out what looks best.

Keep in mind that the way the video player looks, depends on the browser. There is no video player in HTML 5 or RapidWeaver, just the

<video>

tag. This tag will tell the visitor’s browser to load the video player that’s built into that browser to load and display the video as you’ve laid out in your HTML. Each browser does this a little differently, and the way that the player controls look differs per browser too.

As for RMWL, you can opt to leave the HTML code the same in each instance of RMWL (optionally by using a Partial and reusing that in each instance of RMWL in that accordeon). Or you can still use RMWL and only list the one VTT file in the language of the RMWL instance.

Cheers,
Erwin

Hi Erwin @Heroic_Nonsense

OK, it works. However, I realised that the automatically generated text is often misaligned with the image. You can choose the number of words per line, which sometimes truncates the text in a strange way.

In fact, you can’t replace human intelligence with algorithms. :thinking:

If I want the two to match up well, I go back into FCPX and adjust the words manually. It takes more time, but it’s more appropriate.

I don’t know if you also work with these tools, but if so, I’d be happy to hear about your experience.

Cheers,

Zdenek

Hi @zdenek,

I’m afraid I don’t use Final Cut Pro, so I can’t help you with that. Sorry :frowning:

Cheers,
Erwin