当前位置:网站首页>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.com
requests 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.
边栏推荐
猜你喜欢
[Introduction to go language] 12. Pointer
浅谈外挂常识和如何防御
No matching function for call to 'RCTBridgeModuleNameForClass'
YOLOV4流程图(方便理解)
fuser 使用—— YOLOV5内存溢出——kill nvidai-smi 无pid 的 GPU 进程
【CV-Learning】图像分类
How to get started with MOOSE platform - an example of how to run the official tutorial
剪映专业版字幕导出随笔
典型CCN网络——efficientNet(2019-Google-已开源)
0, deep learning 21 days learning challenge 】 【 set up learning environment
随机推荐
Qt日常学习
Windows10重置MySQL用户密码
Deep Adversarial Decomposition: A Unified Framework for Separating Superimposed Images
度量学习(Metric learning)—— 基于分类损失函数(softmax、交叉熵、cosface、arcface)
tensorRT教程——tensor RT OP理解(实现自定义层,搭建网络)
ConnectionRefusedError: [Errno 111] Connection refused问题解决
How to grow into a senior engineer?
度量学习(Metric learning、损失函数、triplet、三元组损失、fastreid)
(Navigation page) OpenStack-M version - manual construction of two nodes - with video from station B
Android foundation [Super detailed android storage method analysis (SharedPreferences, SQLite database storage)]
【CV-Learning】图像分类
迅雷关闭自动更新
动手学深度学习_多层感知机
Amazon Cloud Technology Build On 2022 - AIot Season 2 IoT Special Experiment Experience
图像形变(插值方法)
(TensorFlow) - detailed explanation of tf.variable_scope and tf.name_scope
计算某像素点法线
光条提取中的连通域筛除
[Deep Learning 21 Days Learning Challenge] 2. Complex sample classification and recognition - convolutional neural network (CNN) clothing image classification
2020-10-29