当前位置:网站首页>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.
边栏推荐
- Lee‘s way of Deep Learning 深度学习笔记
- MNIST手写数字识别 —— 基于Mindspore快速构建感知机实现十分类
- lstm pipeline 过程理解(输入输出)
- TensorFlow2 study notes: 6. Overfitting and underfitting, and their mitigation solutions
- MNIST Handwritten Digit Recognition - Lenet-5's First Commercial Grade Convolutional Neural Network
- yolov3 data reading (2)
- BatchNorm&&LayerNorm
- Qt日常学习
- Thunderbolt turns off automatic updates
- Linear Regression 02---Boston Housing Price Prediction
猜你喜欢

深度学习理论 —— 初始化、参数调节

浅谈外挂常识和如何防御

fuser 使用—— YOLOV5内存溢出——kill nvidai-smi 无pid 的 GPU 进程

动手学深度学习_多层感知机

【论文阅读】Anchor-Free Person Search

Halcon缺陷检测

MOOSE平台使用入门攻略——如何运行官方教程的例子

Deep Learning Theory - Initialization, Parameter Adjustment

动手学深度学习__张量
![[Deep Learning 21 Days Learning Challenge] Memo: What does our neural network model look like? - detailed explanation of model.summary()](/img/99/819ccbfed599ffd52307235309cdc9.png)
[Deep Learning 21 Days Learning Challenge] Memo: What does our neural network model look like? - detailed explanation of model.summary()
随机推荐
MNIST手写数字识别 —— 图像分析法实现二分类
腾讯、网易纷纷出手,火到出圈的元宇宙到底是个啥?
[Deep Learning 21-Day Learning Challenge] 3. Use a self-made dataset - Convolutional Neural Network (CNN) Weather Recognition
No matching function for call to ‘RCTBridgeModuleNameForClass‘
多层LSTM
Lee‘s way of Deep Learning 深度学习笔记
基于BiGRU和GAN的数据生成方法
Use of double pointers
2020-10-29
pytorch学习-没掌握的点
TensorRT 5 初步认识
软著撰写注意事项
Vision Transformer 论文 + 详解( ViT )
【CV-Learning】Convolutional Neural Network
MNIST Handwritten Digit Recognition - From Perceptrons to Convolutional Neural Networks
机器学习——分类问题对于文字标签的处理(特征工程)
浅谈游戏音效测试点
如何用Pygame制作简单的贪吃蛇游戏
(导航页)OpenStack-M版-双节点手工搭建-附B站视频
卷积神经网络入门详解