Cannot make srt file from transcription

#36
by Tsogtpurev - opened

Hello i wanna download text and make srt file from it? But it's not working. Can you do a srt download option or webvtt is it possible thank you

Hello i wanna download text and make srt file from it? But it's not working. Can you do a srt download option or webvtt is it possible thank you

Just copy the output with timestamps into ChatGPT and ask it to change the formatting to .SRT fileformat.

Not working. It only generates. First 30 seconds. I used bard and gpt4

Try 3.5 and just click "Continue" when it stops.

Never gonna work bro. I try to make only 5 minutes of video. But it keeps stopping at 30 seconds. Used everything as you suggested. Do you know any script, tool or websites that makes srt from text files?

Just write this question to chatGPT:

Write a JS code that transforms the following input (and similar ones of any length):

[00:00.000 -> 00:00.960] You're not on the list.
[00:00.960 -> 00:02.040] Okay, listen to me.
[00:02.040 -> 00:03.040] My name is Nellie LaRoy.

Into the SRT subtitles format.

ChatGPT reply something like this. Use it, this code working.
Screenshot from 2023-06-10 13-49-46.png

I rushed it, and as a result, the format is incorrect. We need to show chatGPT the correct subtitle format.

Working code (just change input and past it to console):


function convertToSrt(data) {
const lines = data.split('\n');
let srtOutput = '';

lines.forEach((line, index) => {
const timeRange = line.match(/[([^]]+)]/g)[0].replace(/[[]]/g, '');
const times = timeRange.split(' -> ');
const text = line.split('] ')[1];

const startTime = convertToSrtTimeFormat(times[0]);
const endTime = convertToSrtTimeFormat(times[1]);

srtOutput += `${index + 1}\n${startTime} --> ${endTime}\n${text}\n\n`;

});

return srtOutput;
}

function convertToSrtTimeFormat(time) {
const parts = time.split(':');
const minutes = parts[0];
const secondsAndMillis = parts[1].split('.');

// Assuming no hours in input, converting minutes to hours
const hours = Math.floor(minutes / 60);
const remainingMinutes = minutes % 60;

return ${pad(hours)}:${pad(remainingMinutes)}:${pad(secondsAndMillis[0])},${pad(secondsAndMillis[1], 3)};
}

function pad(number, length = 2) {
return number.toString().padStart(length, '0');
}

const input = [00:00.000 -> 00:00.960] You're not on the list. [00:00.960 -> 00:02.040] Okay, listen to me. [00:02.040 -> 00:03.040] My name is Nellie LaRoy.;

console.log(convertToSrt(input));

Also (with the help of ChatGPT), I created a simple conversion page to avoid messing around with JavaScript code.

http://whisper-to-srt.surge.sh/
Screenshot from 2023-06-10 14-32-13.png

An alternative, if you don't care of minor issues and need a basically available transcription service, try this service I am developing: https://www.amazingwhisper.com

http://whisper-to-srt.surge.sh/ not working. It says undefined

Sign up or log in to comment