Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I use the "Take time from current file" option in Import plain text? #8946

Open
Faxanadus opened this issue Oct 25, 2024 · 9 comments

Comments

@Faxanadus
Copy link

Faxanadus commented Oct 25, 2024

I don't understand how to format the text file so Subtitle Edit can extract the timestamps.

image

Whatever I try, the program just has a - for Start time, End time, and Duration:

image

@darnn
Copy link

darnn commented Oct 26, 2024

I only just tried it myself, so feel free to take this with a grain of salt, but: Take time from current file overrides all the other settings. What it does is, if you have a subtitle file open and then use Import plain text, if you check Take time from current file, it will do as it says, and use the timecodes from the file that's currently open with the text you've imported. Presumably you don't have a file open when you're doing this, or the file you do have is already one with no timecodes. Try this while having a file with timecodes open first.
Conversely, if you uncheck Take time from current file, Generate time codes goes into effect, with all its specific settings. Then you'll get a file with automatically generated timecodes.

It would also be helpful if you attached a sample of what you're trying to import.

@Faxanadus
Copy link
Author

Faxanadus commented Oct 26, 2024

Ah I see, I was hoping I could get the timecodes and text from just one file, with the timecodes before the start of each line, something like this:

00:01:06.460 --> 00:01:09.983 Hello! Here is text line 1

00:01:09.983 --> 00:01:20.682 Here's the next line.

00:01:20.682 --> 00:01:27.190 This is the third line

But it's not too much effort just to create another file and reformat it with just the timecodes I guess.

@darnn
Copy link

darnn commented Oct 26, 2024

It looks like what you have there is some strange form of srt file. I think the simplest solution here is, using your text editor of choice which supports regular expressions (I use EditPad), to perform the following search and replace operation:
Replace:
(\d\d:\d\d:\d\d.\d\d\d --> \d\d:\d\d:\d\d.\d\d\d)
With:
\1\r\n
(Depending on the regex flavor, of course, but I assume you get the idea.)

The result will be this:

00:01:06.460 --> 00:01:09.983
Hello! Here is text line 1

00:01:09.983 --> 00:01:20.682
Here's the next line.

00:01:20.682 --> 00:01:27.190
This is the third line

And you can just save that as a text file and simply open it in Subtitle Edit, without having to import it.

@Faxanadus
Copy link
Author

That works, thanks!

@Vioguy
Copy link

Vioguy commented Nov 12, 2024

Wouldn't it be nice if it had an option to create timestamps from scratch by using the waveform of the video and comparing it to your finished text? I think only YouTube uses this technology at an advanced level. I need it for copyright material so YouTube is not a choice. I've contacted several companies that use AI and they all say they can't do it.

@darnn
Copy link

darnn commented Nov 12, 2024

The best you can do for free is use some flavor of Whisper, and then run the results, along with your finished text, through this:
https://github.com/EtienneAb3d/WhisperTimeSync
For your purposes you only need to run the jar file per the instructions there:
https://github.com/EtienneAb3d/WhisperTimeSync/blob/main/distrib/WhisperTimeSync.jar

@Vioguy
Copy link

Vioguy commented Nov 12, 2024

The best you can do for free is use some flavor of Whisper, and then run the results, along with your finished text, through this: https://github.com/EtienneAb3d/WhisperTimeSync For your purposes you only need to run the jar file per the instructions there: https://github.com/EtienneAb3d/WhisperTimeSync/blob/main/distrib/WhisperTimeSync.jar

So I guess there are some options out there but you need to get into the code/python, etc. Frankly, I will need to take some time to familiarize myself with it. Do you request these prompts through the Google Colab workspace?

@darnn
Copy link

darnn commented Nov 13, 2024

No, no. You can use Whisper in Subtitle Edit and get a file with somewhat accurate timing (or at least better than nothing). That doesn't require interacting with Python directly. Then you need to download the above jar file and run it from the command line as described in this step:
https://github.com/EtienneAb3d/WhisperTimeSync#synchronize
After having prepared the necessary files, which is to say the subtitle file created by Whisper, and a text file with your finished text. If you've done everything correctly, you should get a new file where the finished text corresponds to the timing. You'll still have to go over it, at least in a few places, to make sure it did it properly, but I've had good results with it so far.
Also, you may get an error if the files you're trying to merge are too large (i.e., in my experience, more than 900 subtitles or so). Just split them up into chunks and run the command on each chunk, and later combine them again in Subtitle Edit.

@Vioguy
Copy link

Vioguy commented Nov 13, 2024

No, no. You can use Whisper in Subtitle Edit and get a file with somewhat accurate timing (or at least better than nothing). That doesn't require interacting with Python directly(...)

Thanks for the details. Will give it a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants