抖音自动生成文字_语音自动转文字和自动生成字幕



点击 链接看效果

生活中经常会有一些痛点。比如,当你在地铁上时,戴着耳机看没有字幕的视频会很困难,因为噪音太大了,你听不到视频里说的话,而且你不能把声音开得很大而伤害你的耳朵。看英文视频的时候,如果没有中文字幕,英文水平差,很难看懂。如果你加上英文字幕,精通英语的人或许就能看懂。在日常生活中,您可能有一个想要自动转换为文本的录制文件。

[En]

There are often some pain points in life. For example, when you are on the subway, it will be very difficult for you to watch a video without subtitles with headphones, because the noise is so loud that you can’t hear what is said in the video, and you can’t turn it up very loudly and hurt your ears. When watching English videos, if there are no Chinese subtitles, the English level is poor, it is difficult for you to understand. If you add English subtitles, those who are proficient in English may be able to understand it. In daily life, you may have a recording file that you would like to convert into text automatically.

以上的痛点说痛不痛,但如果有工具能自动帮我们做一些语音到文字的自动化工作该有多好啊。根据视频的语音信息,自动添加字幕youtube很早就有了,而且youtube上可以自动翻译。如果说句话识别成文字 科大讯飞,百度等有许多的产品。但是将很长的音频转成文字或者自动为视频添加字幕,这样自动化的软件并不常见。科大讯飞应该有这样的软件,不知道是不是要收钱。

自己是做软件的,生活中的这些痛点让自己觉得,不如用已有的资源做个添加字幕或者音频转文字的工作吧。于是花了一些时间做了一个Demo,对于一些比较好的视频,比如演讲视频,效果还是不错的。

我用 TED的演讲做了一个Demo,TED演讲者英语清晰,噪音也少:

Ted视频来自:AomawaShields_2015U.mp4

自动生成的字幕文件见:ted80001.srt

在我的python脚本中,基本的思路是:

(1)将长语音文件切割成小的语音文件。

(2)直接用Baidu的语音识别,做小文件的语音到文字的识别

(3)小语音文件包括了语音的开始时间和结束时间,所以能做字幕

其实,不容易处理的是把一个长文件切成一个小的语音文件。经过一番思考,有一个切割过程是这样的:

[En]

In fact, what is not easy to deal with is to cut a long file into a small voice file. After some thinking, there is a cutting process as follows:

(1)提取wav文件的数据,对数据做一些平滑处理

(2)将数据做归一化处理

(3)设定一个阈值,用来定义用户的停顿阈值(归一化以后我取 0.2)。对于语音的每一个数值超过这个阈值算说话,低于这个算停顿。统计连续的停顿和连续的说话点的长度。

(4)对于所有的统计的长度数据,按照停顿的时间长短排序

(5)按照排序的数据做切割,越靠前面的越是应该被切割。切割什么时候停止?切割以后的所有小音频小于某个指定的指定试讲长度就停止。基本上根据我的经验可以设定这个值为17S左右。

(6)有了这些小音频,就可以用已有的语音识别技术做语音到文字的识别了,甚至添加字幕。

您还可以添加将来自动翻译的内容。

[En]

You can also add something that translates automatically in the future.

如果是码农请参见,我的项目:github

如果想听一下切割效果,点击下面链接看百度网盘。切割文件按照 ID_起始时间_结束时间命名的( ID 从1开始)

以后学习英语或音乐时,可以先把长音频切成小句子,方便多了。

[En]

In the future, when learning English or music, you can first cut the long audio into small sentences, which is much more convenient.

TED音频文件分割以后的小音频 清唱

清唱我只在乎你切割后小音频 TED

中文识别 小蝌蚪找妈妈:

睡前故事,

小蝌蚪找妈妈,

小蝌蚪在池塘里游啊游,

当我带着一群小鸭子遇到我的母亲时,池塘里有水。小鸭跟着鸭子妈妈,不停地叫妈妈。

[En]

When I met my mother with a group of ducklings, there was water in the pond. The duckling followed the mother duck and kept calling her mother.

下课后,他们都想知道我们的母亲在哪里。

[En]

After class, they all wonder where our mother is.

他们走到妈妈跟前,问道:鸭子妈妈,你知道我们的妈妈长什么样吗?

[En]

They came to their mother and asked, Mother Duck, do you know what our mother looks like?

你妈妈的头上有两只大眼睛。

[En]

Your mother has two big eyes on her head.

嘴巴又大又宽,

小蝌蚪觉得大鱼长得像妈妈,连忙追着他喊妈妈。大鱼笑了笑,说我不是你妈妈。

[En]

The little tadpole felt that Dayu was like his mother and hurriedly chased after him and called for his mother. The big fish smiled and said that I was not your mother.

你们的妈妈有四条腿,

小蝌蚪看到乌龟有四条腿

[En]

The little tadpole saw that the turtle had four legs

就追上去喊,

妈妈,乌龟笑着说,我不是你妈妈,你妈妈的肚子是白的

[En]

Mother, said the tortoise with a smile, I am not your mother, your mother’s belly is white

小蝌蚪很高兴看到一只大白鹅,想上去。

[En]

The little tadpole is happy to see a big white goose and wants to go up.

妈妈,那只大白鹅说你妈妈穿着绿色的衣服。

[En]

Mom, the big white goose said your mother was dressed in green.

唱着歌,小蝌蚪看到一只青蛙坐在荷叶上,穿着绿色的衣服

[En]

Singing, the little tadpole saw a frog sitting on the lotus leaf, dressed in green

青蛙叫道:我的孩子们,快来。我是你妈妈,为什么我和你不一样?

[En]

The frog croaked and said, my children, come quickly. I am your mother, so why am I different from you?

当你长大了,你会像你妈妈一样。

[En]

When you grow up, you’ll be just like your mother.

小蝌蚪终于找到了妈妈,它们在水里快乐地游来游去。

[En]

The little tadpoles finally found their mother, and they swam about happily in the water.

后来,这只小蝌蚪慢慢长出了四条腿,尾巴掉了,换上了绿色的衣服,变成了一只真正的青蛙。

[En]

Later, the little tadpole slowly grew four legs, lost its tail, changed into green clothes, and became a real frog.

他们每天在岸上散步害虫。

[En]

They walk pests on the shore every day.

是人类的好朋友哦,

英文识别结果:

our,

the,the,

i am in search of another planet in the universe where life exists,

ican’tsee this planet with my naked eyes,or even with the most powerful telescopes we currently possess,

but i know thatit’sthere,

and understanding contradictions that occur in nature will help find,

on our planet where there is water there is life,

so we look for planets that orbit at just the right distance from their stars,

at this distance shown in blue on this diagram for stars of different temperatures planets could be warm enough for water to flow on their surfaces has lakes and oceans where life might reside,

some astronomers focus their time and energy on finding planets that these distances from their stars on,

what i do takes up where their job and,

i model the possible climates affect the planet,

andhere’swhythat’simportant there are many factors besides distance from its star that control whether a planet can support life,

take the planet venus,

IT’snamed after the roman goddess of love and beauty because of its benign if serial appearance in the sky,

but spacecraft measurements revealed a different story,

the surface temperature is close to nine hundred degrees fahrenheit five hundred celsius,

that’shot enough to melt lead,

its thick atmosphere not its distance from the sun is the reason causes the greenhouse effect on steroids trapping heat from the sun is scorching the planet surface,

the reality totally contradicted initial perceptions on this planet,

from these lessons from our own solar systemwe’velearned that aplanet’satmosphere is crucial to its climate and potential to host life,

wedon’tknow what the atmospheres of these planets are like because the planets are so small in game compared to their stars,and so far away from us,

for example one of the closest planet that could support surface water is called least six six seven cc touch a glamorous name write, my phone number for a nameit’stwenty three light years away,

sothat’smore than one hundred trillion miles,

trying to measure the atmospheric composition of axle planet passing in front of its host star for his hard,

IT’slike trying to see a fruit fly passing by acar’sheadlight,

they now imagine that cause one hundred trillion miles away and you want to know the precise color of the fly,

so i use computer models to calculate the kind of atmosphere a planet would need you have suitable climate for water and life,

here’sanartist’sconcept of the planet kepler sixty to ask with your for reference,

IT’stwelve hundred light years away and just forty percent larger than earth,

or in excess funded work found that IT could be warm enough for open water for many types of atmospheres and orientations of its orbit to live like feature telescope to follow up on this planet to look for signs of life,

ice on a planet surface is also important for climate ice absorbs longer redder wavelengths of light and reflects shorter bluer light,

that’swhy the iceberg in the photo looks so blue the redder light from the sun is absorbed on its way through the ice only the blue light makes IT all the way to the bottom,

the gets reflected back up to our eyes as we see blue wife,

my model show that planets orbiting cooler stars could actually be warmer than planets orbiting hotter stars she does another contradiction that ice absorbs the longer wavelength light from cooler stars in that light that energy,

heats the ice,

using climate models,to explore how these contradictions can affect planetary climate is vital to the search for life elsewhere,

andit’sno surprise that this,

my specialty,

i’mafrican american female astronomer,and a classically trained actor who love to wear make up and read fashion magazines so i am uniquely positioned to appreciate contradictions in nature,

the,and how they can inform our search for the next planet where life exists,

my organization rising star girls teaches astronomy to middle school girls of color,

using theatre writing and visual arts,

that’sanother contradiction science and artdon’toften go together but interweaving them can help these girls bring their whole selves to what a large and maybe one day,

join the ranks of astronomers were full of contradictions can use a background to discover once and for all that we are truly not alone in the universe,

thank you,the,

Original: https://blog.csdn.net/weixin_39544333/article/details/112241059
Author: weixin_39544333
Title: 抖音自动生成文字_语音自动转文字和自动生成字幕

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/525819/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球