当前位置:网站首页>Clip +json parsing converts the sound in the video into text
Clip +json parsing converts the sound in the video into text
2022-07-06 22:26:00 【fangye945a】
Preface
Sometimes we want to convert the audio in a video into text , The simplest and dumbest way is to listen through human ears , Then type it out . But this method is undoubtedly very laborious . Smart friends must know that we can do this with the help of speech recognition tools , But the more realistic point is , Many identification software is not charged , That is, the recognition accuracy is relatively low . So what can we do to convert the audio in the video into text without spending money and accurately ?
resolvent
Friends with editing experience must know , Cut and reflect
The subtitle recognition function of this software , Behind it is ByteDance speech recognition technology , The recognition accuracy of Putonghua is extremely high . But one thing is , The subtitles he recognizes are segmented , Copy them one by one to form a complete text , Its workload is also a lot .
that , Here is a simple method :
Specific operation steps
- 1. download windows Version clipping
- 2. Import video
- 3. Identify subtitles ( After importing the video , Click on the text -> Smart subtitles -> Just start to recognize )
- 4. Wait a while ( The length of time depends on the size of the video file ), Subtitles will be automatically generated .
- 5. After generating subtitles , Close clip , Will be automatically saved as a draft . At this time, open the clip , The box of draft parameters appears in the upper right corner , In the box, we can find the path to save the draft .
- 6. stay windows Open the save location in Explorer , You can see the following documents .
- 7. It is not difficult to find out according to the English name ,draft_content.json Is our draft content , The subtitle text just generated is also saved in this json In file .
- 8. Since it is json file , The next step is naturally json Parsed , We can extract the subtitle content from this file .
- 9. analysis json file , Find the fields to parse , simplified json The structure is as follows :
{"materials":{"texts":[{"content":"<font id=\"\" path=\"D:/Program Files/JianyingPro/3.0.5.8542/Resources/Font/SystemFont/zh-hans.ttf\"><color=(1.000000, 1.000000, 1.000000, 1.000000)><size=5.000000> Hello, students </size></color></font>"}]}}
And we need subtitles , By three xml Element label wrap .
- 10. Let's go through json Parse get content The contents of the field , And then eliminate by string processing xml label , Get the final text subtitle content .
Here is a simple one I wrote python Script , It can be easily and quickly processed to clip this one with subtitles json file :
import json
if __name__ == '__main__':
with open("draft_content.json", "r", encoding='utf-8') as f:
json_str = f.read()
json_content = json.loads(json_str)
texts_data = json_content["materials"]["texts"]
for text_data in texts_data:
content = text_data["content"]
content = content[:-22]
result = content.split("><size=")[1].split(">")[1]
print(result)
- 11. Directly connect the script to json The files are placed in the same directory , perform python The script can get the subtitle content you need .
We can also redirect symbols , Directly generate the output content into a file
python3 parse_jianyin.py >> output.txt
边栏推荐
- i. Mx6ull build boa server details and some of the problems encountered
- NetXpert XG2帮您解决“布线安装与维护”难题
- ZABBIX proxy server and ZABBIX SNMP monitoring
- 2500 common Chinese characters + 130 common Chinese and English characters
- How does the uni admin basic framework close the creation of super administrator entries?
- C # réalise la liaison des données du rapport Crystal et l'impression du Code à barres 4
- Attack and defense world miscall
- [linear algebra] determinant of order 1.3 n
- Report on technological progress and development prospects of solid oxide fuel cells in China (2022 Edition)
- 硬件開發筆記(十): 硬件開發基本流程,制作一個USB轉RS232的模塊(九):創建CH340G/MAX232封裝庫sop-16並關聯原理圖元器件
猜你喜欢
zabbix 代理服务器 与 zabbix-snmp 监控
Unity3d Learning Notes 6 - GPU instantiation (1)
小常识:保险中的“保全”是什么?
[MySQL] online DDL details
软考高级(信息系统项目管理师)高频考点:项目质量管理
[线性代数] 1.3 n阶行列式
基於 QEMUv8 搭建 OP-TEE 開發環境
[sciter]: encapsulate the notification bar component based on sciter
自制J-Flash烧录工具——Qt调用jlinkARM.dll方式
Management background --4, delete classification
随机推荐
Insert sort and Hill sort
Unity3d minigame unity webgl transform plug-in converts wechat games to use dlopen, you need to use embedded 's problem
Common sense: what is "preservation" in insurance?
GNN, please deepen your network layer~
QT | UDP broadcast communication, simple use case
NPDP认证|产品经理如何跨职能/跨团队沟通?
Shortcut keys in the terminal
i. Mx6ull build boa server details and some of the problems encountered
Unity3d minigame-unity-webgl-transform插件转换微信小游戏报错To use dlopen, you need to use Emscripten‘s...问题
The SQL response is slow. What are your troubleshooting ideas?
Powerful domestic API management tool
About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness
anaconda安装第三方包
pytorch_YOLOX剪枝【附代码】
How do I write Flask's excellent debug log message to a file in production?
i.mx6ull搭建boa服务器详解及其中遇到的一些问题
CCNA Cisco network EIGRP protocol
const关键字
2021 geometry deep learning master Michael Bronstein long article analysis
Unity3d Learning Notes 6 - GPU instantiation (1)