当前位置:网站首页>Cut the hit pro subtitles export of essays
Cut the hit pro subtitles export of essays
2022-08-04 06:21:00 【language】
Clipping Pro Subtitle Export Essay
Recently, there is a small need to identify the human voice in the video and convert it into subtitles and export it,After looking around, I found that the professional version of Toutiao is really easy to use,Take advantage of the Subtitle Recognition feature of Clip Movie Pro,以及抓包工具 fiddler Get the subtitlesjson文件,实现“字幕导出”.This article is here to commemorate it,截止2021年03月14日12:19:26,此方法有效,It is not excluded that the method may fail after the clipping upgrade.
环境准备
First you must install Clipper Pro,If you haven't used Clipping Pro,请自行搜索关键字【剪映】下载安装;In addition, you need to install a package capture tool,笔者安装的是【Fiddler】,It is worth noting that it needs to be turned on https 抓包模式.
A screenshot of the environment is as follows:
剪映

Fiddler

Data processing I use NodeJS,此处就不展开介绍了,If you don't know how to code,可以搜索一下【Cut the subtitlessrt】
字幕生成
首先,We import the video into the clipping footage,如下图所示,After the import is successful, a video preview will be generated,And the small window on the left shows that it has been added.
接着,我们切换到到【文本-识别字幕】,点击【开始识别】,At this point, Clipping Pro will recognize the human voice in the video,And automatically generate subtitle files on the timeline.
Caption Capture
然后呢,We methodically opened the packet grabber,并开启 HTTPS 模式,It is worth noting that this step requires a trust certificate.
At this time, we better add a filter condition,只显示lv-pc-api.ulikecam.comrequests under this domain,That is, the interface for clipping and subtitle processing.If the subtitles have been processed at this point,Then click again in the above step【开始识别】按钮.
Because the video I deal with is relatively long,About an hour and a half,Therefore, it takes a long time to generate subtitles,That's why I'm not in a hurry,稍等片刻,发现 fiddler No more spitting out new request messages,最终https://lv-pc-api.ulikecam.com/lv/v1/audio_subtitle/query This interface returns our subtitles.
字幕处理
最后一步了,In fact, we just need to copy what we caught in the previous stepJSONThe data realizes the subtitle export.处理这个JSON数据的方式有很多,For example, you can use some public gadgets,把这个JSON数据直接转成SRT字幕文件,You can also write programs by yourself through programming languages to handle according to your own needs.The author is more familiar with itJavaScript,因此使用NodeJS来处理,The final file is generated in text format.
Let's first take a look at the subtitle data format I captured:
{
"ret": "0",
"errmsg": "success",
"svr_time": 1615699052,
"log_id": "202103141317310102121441631D8D72AD",
"data": {
"utterances": [{
"text": "直播课堂",
"start_time": 0,
"end_time": 896,
"words": [{
"text": "直",
"start_time": 0,
"end_time": 258
},
{
"text": "播",
"start_time": 258,
"end_time": 360
},
{
"text": "课",
"start_time": 360,
"end_time": 520
},
{
"text": "堂",
"start_time": 520,
"end_time": 896
}
]
},
{
"text": "See you all again",
"start_time": 2063,
"end_time": 3680,
"words": [{
"text": "又",
"start_time": 2063,
"end_time": 2240
},
{
"text": "一",
"start_time": 2240,
"end_time": 2400
},
{
"text": "次",
"start_time": 2400,
"end_time": 2576
},
{
"text": "跟",
"start_time": 2663,
"end_time": 2840
},
{
"text": "大",
"start_time": 2840,
"end_time": 2980
},
{
"text": "家",
"start_time": 2980,
"end_time": 3120
},
{
"text": "见",
"start_time": 3120,
"end_time": 3296
},
{
"text": "面",
"start_time": 3303,
"end_time": 3496
},
{
"text": "了",
"start_time": 3503,
"end_time": 3680
}
]
},
{
"text": "I'm still the familiar host Mina",
"start_time": 3680,
"end_time": 6656,
"words": [{
"text": "我",
"start_time": 3680,
"end_time": 3856
},
{
"text": "还",
"start_time": 3863,
"end_time": 4056
},
{
"text": "是",
"start_time": 4103,
"end_time": 4296
},
{
"text": "大",
"start_time": 4543,
"end_time": 4700
},
{
"text": "家",
"start_time": 4700,
"end_time": 4856
},
{
"text": "熟",
"start_time": 5023,
"end_time": 5216
},
{
"text": "悉",
"start_time": 5223,
"end_time": 5380
},
{
"text": "的",
"start_time": 5380,
"end_time": 5500
},
{
"text": "主",
"start_time": 5500,
"end_time": 5620
},
{
"text": "持",
"start_time": 5620,
"end_time": 5740
},
{
"text": "人",
"start_time": 5740,
"end_time": 5896
},
{
"text": "美",
"start_time": 6063,
"end_time": 6256
},
{
"text": "娜",
"start_time": 6263,
"end_time": 6656
}
]
}
]
}
}
因此,The author's code is also very concise:
const fs = require('fs')
const rawdata = fs.readFileSync('./srt.json');
const {
data} = JSON.parse(rawdata);
const {
utterances} = data
let txt = ''
for(let i of utterances) {
txt += i.text + '\n'
}
fs.writeFile('srt.txt', txt, function (err) {
if (err) {
return console.error(err);
}
});
最终生成的txt文件如下图:
Of course if you need processing time,处理start_time和end_time这两个字段即可.
小结
本次分享就到这,In fact, the whole process is very simple,It just captures the identification request based on the subtitles identified by the professional version of Clipping,最终获得JOSN数据.If you have a better way to handle it,Feel free to share with me in the comments section.
边栏推荐
- 度量学习(Metric learning、损失函数、triplet、三元组损失、fastreid)
- No matching function for call to ‘RCTBridgeModuleNameForClass‘
- 机器学习——分类问题对于文字标签的处理(特征工程)
- Usage of Thread, Handler and IntentService
- YOLOV5 V6.1 详细训练方法
- MNIST Handwritten Digit Recognition - Building a Perceptron from Zero for Two-Classification
- CSDN大礼包--高校圆桌派大礼包
- 如何成长为高级工程师?
- WARNING: sql version 9.2, server version 11.0. Some psql features might not work.
- Thoroughly understand box plot analysis
猜你喜欢

Install Minikube Cluster in AWS-EC2

安装pyspider后运行pyspider all后遇到的问题

动手学深度学习__数据操作

MOOSE平台官方第二个例子分析——关于创建Kernel,求解对流扩散方程

【CV-Learning】Object Detection & Instance Segmentation

浅谈游戏音效测试点
![[Copy Siege Lion Log] Flying Pulp Academy Intensive Learning 7-Day Punch Camp-Study Notes](/img/af/05caea638de8d75f6d3b42b3d8e28f.png)
[Copy Siege Lion Log] Flying Pulp Academy Intensive Learning 7-Day Punch Camp-Study Notes

Image-Adaptive YOLO for Object Detection in Adverse Weather Conditions

Windows10重置MySQL用户密码

How to get started with MOOSE platform - an example of how to run the official tutorial
随机推荐
yolov3 data reading (2)
【CV-Learning】Object Detection & Instance Segmentation
(导航页)OpenStack-M版-双节点手工搭建-附B站视频
Amazon Cloud Technology Build On-Amazon Neptune's Knowledge Graph-Based Recommendation Model Building Experience
【CV-Learning】Convolutional Neural Network
腾讯、网易纷纷出手,火到出圈的元宇宙到底是个啥?
Unity ML-agents 参数设置解明
Comparison of oracle's number and postgresql's numeric
浅谈外挂常识和如何防御
MAE 论文《Masked Autoencoders Are Scalable Vision Learners》
Pytest常用插件
Introduction to Convolutional Neural Networks
学习资料re-id
剪映专业版字幕导出随笔
ValueError: Expected 96 from C header, got 88 from PyObject
如何成长为高级工程师?
[Go language entry notes] 13. Structure (struct)
TensorFlow: tf.ConfigProto() and Session
MNIST Handwritten Digit Recognition - Building a Perceptron from Zero for Two-Classification
图像合并水平拼接