- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这个问题与this other question @ SuperUser有关.
我要下载 TED Talks以及离线观看的相应字幕,例如让我们看this short talk by Richard St. John ,高清视频下载地址如下:
相应的JSON编码的英文字幕可以在以下网址下载:
下面是实际字幕的开头:
{
"captions": [{
"content": "This is really a two hour presentation I give to high school students,",
"startTime": 0,
"duration": 3000,
"startOfParagraph": false
}, {
"content": "cut down to three minutes.",
"startTime": 3000,
"duration": 1000,
"startOfParagraph": false
}, {
"content": "And it all started one day on a plane, on my way to TED,",
"startTime": 4000,
"duration": 3000,
"startOfParagraph": false
}, {
"content": "seven years ago."
从副标题的结尾开始:
{
"content": "Or failing that, do the eight things -- and trust me,",
"startTime": 177000,
"duration": 3000,
"startOfParagraph": false
}, {
"content": "these are the big eight things that lead to success.",
"startTime": 180000,
"duration": 4000,
"startOfParagraph": false
}, {
"content": "Thank you TED-sters for all your interviews!",
"startTime": 184000,
"duration": 2000,
"startOfParagraph": false
}]
}
我想编写一个应用程序来自动下载高分辨率版本的视频和所有可用的字幕,但我遇到了很多困难,因为我必须将字幕转换为(VLC 或任何其他像样的视频播放器)兼容格式(.srt 或 .sub 是我的首选)我不知道什么是startTime
和JSON文件的duration
键代表。
目前我所知道的是:
startTime
从 0 开始,duration
为 3000 = 3000startTime
结束于 184000,duration
为 2000 = 186000下面的 Javascript 片段可能也值得一提:
introDuration:16500,
adDuration:4000,
postAdDuration:2000,
所以我的问题是,我应该应用什么逻辑来将 startTime
和 duration
值转换为 .srt 兼容格式:
1
00:01:30,200 --> 00:01:32,201
MEGA DENG COOPER MINE, INDIA
2
00:01:37,764 --> 00:01:39,039
Watch out, watch out!
或者转换为.sub 兼容格式:
{FRAME_FROM}{FRAME_TO}This is really a two hour presentation I give to high school students,
{FRAME_FROM}{FRAME_TO}cut down to three minutes.
谁能帮我解决这个问题?
Ninh Bui 搞定了,公式如下:
introDuration - adDuration + startTime ... introDuration - adDuration + startTime + duration
这种方法允许我以两种方式直接转换为 .srt 格式(无需知道长度和 FPS):
00:00:12,500 --> 00:00:15,500
This is really a two hour presentation I give to high school students,
00:00:15,500 --> 00:00:16,500
cut down to three minutes.
和:
00:00:00,16500 --> 00:00:00,19500
And it all started one day on a plane, on my way to TED,
00:00:00,19500 --> 00:00:00,20500
seven years ago.
最佳答案
我的猜测是 json 中的时间以毫秒表示,例如1000 = 1 秒。可能有一个 maintimer,其中 startTime 表示字幕应该出现在时间轴上的时间,而 duration 可能是字幕应该保留在视野中的时间量。这个理论通过除以186000/1000 = 186秒 = 186/60 = 3.1分钟 = 3分6秒进一步得到肯定。剩下的秒数可能是掌声 ;-) 有了这些信息,您还应该能够计算出您应该将转换应用到从哪一帧到哪一帧,即您已经知道每秒的帧数是多少,所以您需要做的就是相乘使用 FPS 获取开始帧的开始时间秒数。结束帧可以通过:(startTime + duration) * fps :-)
关于json - 解析和转换 TED 演讲 JSON 字幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1955618/
语音 api 在 WinRT(如 Windows Phone 8)中是否可用。 我可以改用一些第三方语音 api 吗? 我想在我的 Windows 8/WinRT 应用程序中实现 TTS,有人有什么建
我希望将 Ted 演讲嵌入我的网站,但想要居中。 iframe 位于多个 div 中,因此我在隔离和编码必要参数时遇到了一些麻烦。 当前代码: 最佳答案 为第一个 div 尝试样式 margin:
据我了解,TED 可能不会考虑制作黑莓应用程序。我已经创建了一些框架来解析各种类型的 API/提要/服务,并且想知道是否有一种方法可以让第三方开发人员制作 TED 应用程序。我曾通过 Google 听
这个问题与this other question @ SuperUser有关. 我要下载 TED Talks以及离线观看的相应字幕,例如让我们看this short talk by Richard S
我是一名优秀的程序员,十分优秀!