ThioJoe / Auto-Synced-Translated-Dubs

Automatically translates the text of a video based on a subtitle file, and also uses AI voice to dub the video, and synced using the subtitle's timings
GNU General Public License v3.0
1.55k stars 152 forks source link

There should be compatibility with local and open source programs #7

Closed Pythone closed 1 year ago

Pythone commented 1 year ago

Why?

The reason why is to stop relying on these cloud servers entirely. It would also reduce the cost for API credits(local does not require credits, and some open source APIs are self-hostable with changeable servers that it would help).

examples of These types of projects

Translation

LibreTranslate is an open-source self-hostable API. Some servers(including the official one) require credits, while others do not. TranslateLocally and Firefox Translations are local tools that are similar to each other and perform a little bit better.

note: DO NOT CONFUSE "Firefox Translations" WITH To Google Translate"

Text To Speech

Coqui.ai's open source engine works similar to the cloud TTS engines you use. It is a self-hostable API that you could host locally. There are more accurate TTS engines out there(I listed this one to give an example).

Implementation:

Translation

For LibreTranslate, You can use LibreTranslate-py for the Python API. For TranslateLocally, You could probably run the commands from the website in Python.

TTS

For Coqui.ai, you could use the examples provided

ghost commented 1 year ago

+1 We should not rely on large corporations, and even if you do not hate large corporations, this would allow the script to function without the need for third-party APIs.

pankaj-yadav0507 commented 1 year ago

Nice suggestion. But comparing both LibreTranslate-py with Google translate is a bit of overstatement. I love open source and I know it's limitations also. But hey you get good amount of free conversations in google translate also. Now where LibreTranslate-py really lacks is no. of languages available. It's really limited for a production use case. On top of it lacks many features like there is no equivalent to <span translate="no"></span> in it.

Also, Comparing a translated sample from both, Google translate have a huge advantage.

Sample:

LibreTranslate is awesome!

Results (Hindi):

LibreTranslate -> LibreTranslate भयानक है! Google translate -> लिब्रेट्रांसलेट बहुत बढ़िया है!

Any Hindi speaking person will tell you how wrong LibreTranslate's conversion is.

Haven't tested Coqui.ai so can't comment much on it. But the base thing is it doesn't work on windows that's a big disappointment even before starting.

PS: I am not a google translate fanboy just putting some insights since we are using it on production level.

qgustavor commented 1 year ago

I tried LibreTranslate in the past (I even contributed a little to the project in the past) and I want to add something: the idea of LibreTranslate is good, but the translation quality is often not great. While it's open-source, I'm starting to think that their models are not going to improve a lot in future since they started to promote the paid training option in the language requests discussion. That's just a theory of mine and it might be wrong (well, I hope it is wrong), but that's a thing to consider about that project.

I switched to using Helsinki-NLP's models available on Hugging Face. Some models such this one allow translating without English being an intermediate language, which was amazing for me since almost every translation service and model uses English as a pivot language. For translating English videos to other languages that's fine, but I was translating Italian subtitles to Portuguese and a lot of context (mostly gender information because many words in Italian and Portuguese are gendered but in English they are not) was being lost during the intermediate English translation.

There are many translation models in Hugging Face, maybe some performs better than LibreTranslate in tasks other than [non-English language] to [other non-English language]. I don't know Hindi at all, but at least I see that this translation looks a bit more similar to the one from Google Translate than from the one from LibreTranslate. Is it better? I don't know, again, I don't know nothing about Hindi, sorry.

Sometimes (well, in some rare cases to be fair) Hugging Face models can be better than Google: from the languages I know something I'm certain that this translation is better than the one from Google Translate: because Google uses English as an intermediate language it first translates "ツル" (the crane bird) into "crane" then translates it into Portuguese, but translates "crane" as being the machine (guindaste), not the bird (grou).

Pythone commented 1 year ago

I tried LibreTranslate in the past (I even contributed a little to the project in the past) and I want to add something: the idea of LibreTranslate is good, but the translation quality is often not great. While it's open-source, I'm starting to think that their models are not going to improve a lot in future since they started to promote the paid training option in the language requests discussion. That's just a theory of mine and it might be wrong (well, I hope it is wrong), but that's a thing to consider about that project.

I switched to using Helsinki-NLP's models available on Hugging Face. Some models such this one allow translating without English being an intermediate language, which was amazing for me since almost every translation service and model uses English as a pivot language. For translating English videos to other languages that's fine, but I was translating Italian subtitles to Portuguese and a lot of context (mostly gender information because many words in Italian and Portuguese are gendered but in English they are not) was being lost during the intermediate English translation.

There are many translation models in Hugging Face, maybe some performs better than LibreTranslate in tasks other than [non-English language] to [other non-English language]. I don't know Hindi at all, but at least I see that this translation looks a bit more similar to the one from Google Translate than from the one from LibreTranslate. Is it better? I don't know, again, I don't know nothing about Hindi, sorry.

Sometimes (well, in some rare cases to be fair) Hugging Face models can be better than Google: from the languages I know something I'm certain that this translation is better than the one from Google Translate: because Google uses English as an intermediate language it first translates "ツル" (the crane bird) into "crane" then translates it into Portuguese, but translates "crane" as being the machine (guindaste), not the bird (grou).

thank you

Pythone commented 1 year ago

Nice suggestion. But comparing both LibreTranslate-py with Google translate is a bit of overstatement. I love open source and I know it's limitations also. But hey you get good amount of free conversations in google translate also. Now where LibreTranslate-py really lacks is no. of languages available. It's really limited for a production use case. On top of it lacks many features like there is no equivalent to <span translate="no"></span> in it.

Also, Comparing a translated sample from both, Google translate have a huge advantage.

Sample:

LibreTranslate is awesome!

Results (Hindi):

LibreTranslate -> LibreTranslate भयानक है! Google translate -> लिब्रेट्रांसलेट बहुत बढ़िया है!

Any Hindi speaking person will tell you how wrong LibreTranslate's conversion is.

Haven't tested Coqui.ai so can't comment much on it. But the base thing is it doesn't work on windows that's a big disappointment even before starting.

PS: I am not a google translate fanboy just putting some insights since we are using it on production level.

I am taking your suggestion in. In fact, we could do different models with TranslateLocally. There could be similar programs to Coqui.ai that do work on Windows, otherwise there are bridges.

ThioJoe commented 1 year ago

Moving this to a discussion instead