issue with SRT files

Anything and everything to do with DCP-o-matic.
Carsten
Posts: 2804
Joined: Tue Apr 15, 2014 9:11 pm
Location: Germany

issue with SRT files

Post by Carsten »

Recently I began to add subtitles as SRT files arbitrarily on different windows systems. I regularly come across the problem that the sub numbering isn't recognized, means - the first subtitle line is recognized correctly, but the '2', timing, and line, is displayed as if it was part of the first line.

I tried different text encodings, e.g. in windows edit, but I don't get it to work.

e.G. I set up a basic file:

1
00:00:02,000 --> 00:00:05,000
This is the first line

2
00:00:06,000 --> 00:00:08,000
This is the second line


When I load this into DCP-o-matic, it is displayed as:

---
This is the first line
2
00:00:06,000 --> 00:00:08,000
This is the second line
---

Is that a CR/LF problem? It always seems to happen with Windows Edit. Of course I could try different editors, but that is what every windows machine has installed.


- Carsten
carl
Site Admin
Posts: 2548
Joined: Thu Nov 14, 2013 2:53 pm

Re: issue with SRT files

Post by carl »

Can you attach an example file?
Carsten
Posts: 2804
Joined: Tue Apr 15, 2014 9:11 pm
Location: Germany

Re: issue with SRT files

Post by Carsten »

I don't have one at hand now, but will supply one tomorrow when I get back to that machine. Upon loading a project with such an SRT file today, I even got a warning from DCP-o-matic about the srt file, something like 'found empty line while expecting timing or content' or something. Weird with something as simple as an SRT file. I don't have that issue when using TextEdit on my Mac.

- Carsten
Carsten
Posts: 2804
Joined: Tue Apr 15, 2014 9:11 pm
Location: Germany

Re: issue with SRT files

Post by Carsten »

Weird. Tried to fetch these files and replicate remotely. But I can't (replicate). Unfortunately, to get the DCP working quickly last evening, I replaced the single file having two lines with two files with one line each and place after each other. Now I don't have the file anymore that caused the issue. And when I create a new one, it doesn't happen anymore. Well, if it stays like that, no problem...
One of those days...

- Carsten
carl
Site Admin
Posts: 2548
Joined: Thu Nov 14, 2013 2:53 pm

Re: issue with SRT files

Post by carl »

Were you using the same OS in each case?
Carsten
Posts: 2804
Joined: Tue Apr 15, 2014 9:11 pm
Location: Germany

Re: issue with SRT files

Post by Carsten »

Yes, WIN7. Maybe the cause was that I reused an existing (simple) text file that was sitting on the desktop as a means to quickly open notepad. Then edited and saved to a new name. Maybe there was 'something in it'... It originated in notepad as well, though.


BTW - I know we had a discussion about updating content changes before/when creating the DCP, but can't find it in Mantis - this was one of those cases, I had the text editor open to make changes to the srt file, but had to reopen DCP-o-matic and load the project in order to reflect the changes. Right-Click 'Analyze' didn't do it. This is 2.12.10. Would it be possible to check the file for changes simply when you select it in the content list, and if changed, reload and reanalyze it?

- Carsten
Carsten
Posts: 2804
Joined: Tue Apr 15, 2014 9:11 pm
Location: Germany

Re: issue with SRT files

Post by Carsten »

Okay, while I couldn't replicate the issues myself, someone else contacted me privately, and it looks as if he came across the same or similar issue with one of his files (see attached error screenshot).
Bildschirmfoto 2018-09-16 um 15.50.39.png
While I don't understand too much about text encodings/file formats other than the need for them, the first thing I tried was to resave the file he supplied as UTF-8 from my Mac system text editor. Initially, the Save As dialog suggested UTF-16, so I suggest the file came UTF-16 encoded. That solved the problem. From what I see, UTF-8 is the preferred encoding for SRT files. I hope that some day I understand more about text encodings.

- Carsten
You do not have the required permissions to view the files attached to this post.
carl
Site Admin
Posts: 2548
Joined: Thu Nov 14, 2013 2:53 pm

Re: issue with SRT files

Post by carl »

Ah yes there's a bug with UTF16 files on Mac which was fixed in 2.13.x but the fix never made it to 2.12.x. I'll put it in there.

This is a good article on Unicode and character encodings.
carl
Site Admin
Posts: 2548
Joined: Thu Nov 14, 2013 2:53 pm

Re: issue with SRT files

Post by carl »

2.12.11 is up now with this fix.