Notes
Notes - notes.io |
<!-- saved from url=(0041)https://www.yash.info/aws-srt-creator.htm -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
Amazon Transcribe to SRT Converter
</title>
<style>
* {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
}
a:link,
a:visited {
color: blue;
}
</style>
<script>
function convert(seconds){
var to_return = [];
var secs = seconds * 100;
var mili = secs%100;
secs = secs/100;
var min = seconds/60;
var sec = seconds%60;
return [min, sec, mili];
}
function createSRT() {
// our object is data;
var data = JSON.parse(document.getElementById("txt").value);
var current_speaker = data["results"]["speaker_labels"]["segments"][0]["speaker_label"];
var statement = "";
var i = 0;
var total = Object.keys(data["results"]["items"]).length;
var t = 0;
var srtWrite = document.getElementById("srt");
var list_csv = [];
var headers = ["Word", "Start Time", "End Time", "Confidence"];
for(speaker of data["results"]["speaker_labels"]["segments"]){
var start_time_temp = parseFloat(speaker["start_time"]);
var end_time_temp = parseFloat(speaker["end_time"]);
if(statement == ""){
statement = statement + speaker["speaker_label"] + " : ";
}
var path = data["results"]["items"];
while(i<total){
var temp_lis = [];
var x = data["results"]["items"][i];
if(!("start_time" in x)){
statement = statement + String(x["alternatives"][0]["content"]);
}
else{
var y = parseFloat(x["start_time"]);
if(y<end_time_temp){
statement = statement +" "+ String(x["alternatives"][0]["content"]);
temp_lis.push(x["alternatives"][0]["content"]);
temp_lis.push(convert(parseFloat(x["start_time"])));
temp_lis.push(convert(parseFloat(x["end_time"])));
temp_lis.push(parseFloat(x["alternatives"][0]["confidence"]));
list_csv.push(temp_lis)
}
else{
srtWrite.value += statement + "n";
statement = "";
t=t+1;
break;
}
}
i = i+1
}
}
}
function formatTime(t) {
a = t.split(".");
var date = new Date(null);
date.setSeconds(a[0]); // specify value for SECONDS here
var result = date.toISOString().substr(11, 8);
return result + "," + a[1];
}
</script>
<style>.hiclass {background-color:rgb(51, 144, 255); color: white}</style></head>
<body>
<div style="text-align: center;">
<h1>Convert Amazon Transcribe JSON to SRT</h1>
This page lets you create subtitles in SRT format from the JSON output of Amazon Transscribe API. The page is standalone
and uses vanilla JavaScript.
<br> New sentence is created when a period is encountered. Paste the Amazon Transcribe JSON below
<br>
<br>
<textarea id="txt" style="width: 800px; height: 300px; border: 1px solid black;"></textarea>
<br>
<br>
<input type="checkbox" id="word-break" checked="checked"> Break after <input type="text" size="2" value="10" id="words"> words <input type="button" value="Create SRT" style="width: 120px;" onclick="createSRT()">
<br>
<br>
<textarea id="srt" style="width: 800px; height: 500px; border: 1px solid black;"></textarea>
<br>
<br> Created by
<a href="http://www.yash.info/blog" target="_blank">Yash</a>. Also check out <a href="https://www.hexavault.com/" target="_blank">HexaVault</a> and <a href="https://www.uconomix.com/Products/uMark/Default.aspx" target="_blank">uMark</a>.
<br><br>
</div>
</body></html>
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team