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

Synced subtitles still out-sync #48

Open
BramFr opened this issue Oct 24, 2019 · 17 comments
Open

Synced subtitles still out-sync #48

BramFr opened this issue Oct 24, 2019 · 17 comments
Labels
out-of-sync Catch-all label for still out-of-sync subtitles.

Comments

@BramFr
Copy link

BramFr commented Oct 24, 2019

Command:
subsync walking_dead_10x03.mkv -i walking_dead_10x03.srt -o walking_dead_10x03.nl.srt

Unsynced sub:

1
00:00:00,016 --> 00:00:01,936
Het begint.
- Sluit de poorten voor vanavond...

2
00:00:01,992 --> 00:00:03,868
en verdubbel de beveiliging op de muur.

3
00:00:04,356 --> 00:00:06,593
Wat voorafging in The Walking Dead.

4
00:00:07,579 --> 00:00:10,251
De mensen schijten
in hun broek van angst.

Synced Subs:

1
00:00:01,004 --> 00:00:02,404
We gaan terug.

2
00:00:06,369 --> 00:00:08,385
6u

3
00:00:08,559 --> 00:00:10,418
Uur 7

4
00:00:32,316 --> 00:00:34,156
Uur 2

It seems the original subs are complete wrong. Looks like a different episode. But after the sync its looks alot better. But still few sec out-sync

When i`ll try another file: man with a plan s03e9
Unsynced:

1
00:00:01,585 --> 00:00:03,353
Here's to the sale of our flip house.

2
00:00:03,378 --> 00:00:05,878
Much like me, it looks
good on the outside,

3
00:00:05,914 --> 00:00:07,797
but it has a questionable foundation.

Synced:

1
00:00:06,615 --> 00:00:08,383
Here's to the sale of our flip house.

2
00:00:08,408 --> 00:00:10,908
Much like me, it looks
good on the outside,

3
00:00:10,944 --> 00:00:12,827
but it has a questionable foundation.

This one is complete out-sync. The first one must start around: 00:00:02,200 --> 00:00:04,100

@smacke smacke added the duplicate This issue or pull request already exists label Nov 2, 2019
@smacke
Copy link
Owner

smacke commented Nov 2, 2019

Thanks for filing an issue. It's likely that your video contains splits / breaks in the middle -- unfortunately, this project is geared toward the common case when there's extra stuff present / missing from the beginning or end of the video. I want to extend the algorithm to handle these cases (I believe it is possible), but I'm afraid I don't have the cycles at the moment. See #10 for more details.

@smacke smacke closed this as completed Nov 2, 2019
@smacke
Copy link
Owner

smacke commented Mar 14, 2020

@BramFr since you posted, there have been a number of improvements to subsync -- I know this issue is super old, but I'd love to hear whether it's working for your case after the recent improvements, if/when you have time. The latest version can be grabbed via:

pip install --upgrade git+https://github.com/smacke/subsync@stable

If the sync still doesn't work, I would love to try to investigate further. It's now possible to build a tarball containing most of the data I need to investigate (without violating copyright), as follows:

subsync reference.mp4 -i unsynced.srt -o still-unsynced.srt --make-test-case

The resulting test archive will be named reference.mp4.${TIMESTAMP}.tar.gz and will probably be a few KiB in size. If sync is still not working and if you send it to me, I promise to do a detailed investigation!

@smacke smacke reopened this Mar 14, 2020
@smacke smacke added out-of-sync Catch-all label for still out-of-sync subtitles. and removed duplicate This issue or pull request already exists labels Mar 14, 2020
@BramFr
Copy link
Author

BramFr commented Mar 16, 2020

@smacke

Thanks for reopen this case..

After few trys ill find one:

# /usr/local/bin/subsync Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.mkv -i Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.en.srt -o Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.en2.srt --make-test-case
INFO:subsync.subsync:extracting speech segments from reference 'Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.mkv'...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2573.472/2573.472 [00:29<00:00, 87.97it/s]
INFO:subsync.subsync:...done
INFO:subsync.subsync:serializing speech...
INFO:subsync.subsync:...done
INFO:subsync.subsync:extracting speech segments from subtitles 'Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.en.srt'...
INFO:subsync.subtitle_parser:detected encoding: UTF-8
INFO:subsync.subsync:...done
INFO:subsync.subsync:computing alignments...
INFO:subsync.subsync:...done
INFO:subsync.subsync:offset seconds: -96.130
INFO:subsync.subsync:framerate scale factor: 0.959
INFO:srt:Skipped subtitle at index 1: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 2: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 3: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 4: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 5: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 6: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 7: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 8: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 9: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 10: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 11: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 12: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 13: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 14: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 15: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 16: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 17: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 18: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 19: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 20: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 21: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 22: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 23: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 24: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 25: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 26: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 27: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 28: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 29: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 30: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 31: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 32: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 33: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 34: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 35: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 36: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 37: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 38: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 39: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 40: Start time < 0 seconds
INFO:subsync.subsync:creating test archive Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.mkv.2020-03-16-12:59:19.tar.gz...

After waiting a bit tar didn't succesful.

root@docker /m/n/0/M/Season 2# ls -hal | grep tar
-rw-rw-rw-+ 1     99     99 2.6G Mar 16 14:03 Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.mkv.2020-03-16-12:59:19.tar.gz
root@docker /m/n/0/M/Season 2# ls -hal | grep tar
-rw-rw-rw-+ 1     99     99 3.8G Mar 16 14:05 Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.mkv.2020-03-16-12:59:19.tar.gz
root@docker /m/n/0/M/Season 2# 

and still growing...

@smacke
Copy link
Owner

smacke commented Mar 16, 2020

@BramFr really appreciate your taking the time to take another look! Bummer about the test archive -- not sure exactly why that's happening. Possibly a problem with shutil on some version of Python -- what does python --version give you?

@smacke
Copy link
Owner

smacke commented Mar 16, 2020

@BramFr I think I figured out the issue; creating the test archive should work now if you install from the latest branch:

pip install --upgrade git+https://github.com/smacke/subsync@latest

Please let me know if you have a chance to try to make the test case and whether it works -- would love to take a closer look if so.

@BramFr
Copy link
Author

BramFr commented Mar 16, 2020

python --version

# python --version
Python 3.7.5

@BramFr
Copy link
Author

BramFr commented Mar 16, 2020

@BramFr I think I figured out the issue; creating the test archive should work now if you install from the latest branch:

pip install --upgrade git+https://github.com/smacke/subsync@latest

Please let me know if you have a chance to try to make the test case and whether it works -- would love to take a closer look if so.

# /usr/local/bin/subsync Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.mkv -i Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.en.srt -o Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.en2.srt --make-test-case
INFO:subsync.subsync:extracting speech segments from reference 'Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.mkv'...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2573.472/2573.472 [00:29<00:00, 87.29it/s]
INFO:subsync.subsync:...done
INFO:subsync.subsync:serializing speech...
INFO:subsync.subsync:...done
INFO:subsync.subsync:extracting speech segments from subtitles 'Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.en.srt'...
INFO:subsync.subtitle_parser:detected encoding: UTF-8
INFO:subsync.subsync:...done
INFO:subsync.subsync:computing alignments...
INFO:subsync.subsync:...done
INFO:subsync.subsync:offset seconds: -96.130
INFO:subsync.subsync:framerate scale factor: 0.959
INFO:srt:Skipped subtitle at index 1: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 2: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 3: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 4: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 5: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 6: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 7: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 8: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 9: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 10: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 11: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 12: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 13: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 14: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 15: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 16: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 17: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 18: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 19: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 20: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 21: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 22: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 23: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 24: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 25: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 26: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 27: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 28: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 29: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 30: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 31: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 32: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 33: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 34: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 35: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 36: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 37: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 38: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 39: Start time < 0 seconds
INFO:srt:Skipped subtitle at index 40: Start time < 0 seconds
INFO:subsync.subsync:creating test archive Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.mkv.2020-03-16-16:09:04.tar.gz...
INFO:subsync.subsync:...done

Manifest.S02E09.iNTERNAL.1080p.WEB.H264-GHOSTS.mkv.2020-03-16-16:09:04.tar.gz

@smacke
Copy link
Owner

smacke commented Mar 16, 2020

@BramFr I think I see what is happening here. Those subtitles look like they're the 1st choice from opensubtitles.org, but they seem to be mislabeled -- perhaps they are for a different episode of that TV show. I'd love to know if these ones work, if you have a chance to try them instead. (You'll be able to see that the text content differs significantly from the ones you attached.)

manifest.s02.e09.airplane.bottles.(2020).eng.1cd.(8121898).zip

@BramFr
Copy link
Author

BramFr commented Mar 16, 2020

sorry indeed wrong test i`ll find another one. Every subtitle came from bazarr (automatic)

@smacke
Copy link
Owner

smacke commented Mar 16, 2020

Gotcha. I need to see whether I can convince SubZero / Bazarr folks to use subsync as a tool for picking out already synced subtitles out of a batch of candidates; could potentially help filter these kinds of cases where the metadata is bad. And please @BramFr no need to apologize -- it's thanks to these kinds of test cases that I can continue making improvements, so I really appreciate the time you've already spent so far.

@BramFr
Copy link
Author

BramFr commented Mar 17, 2020

i found one :)

# /usr/local/bin/subsync Man.with.a.Plan.S03E13.iNTERNAL.720p.WEB.x264-BAMBOOZLE.mkv -i Man.with.a.Plan.S03E13.iNTERNAL.720p.WEB.x264-BAMBOOZLE.en.srt -o Man.with.a.Plan.S03E13.iNTERNAL.720p.WEB.x264-BAMBOOZLE.en2.srt --make-test-case
INFO:subsync.subsync:extracting speech segments from reference 'Man.with.a.Plan.S03E13.iNTERNAL.720p.WEB.x264-BAMBOOZLE.mkv'...
100%|████████████████████████████████████████████████████████████████████▉| 1251.392/1251.416 [00:09<00:00, 133.55it/s]
INFO:subsync.subsync:...done
INFO:subsync.subsync:serializing speech...
INFO:subsync.subsync:...done
INFO:subsync.subsync:extracting speech segments from subtitles 'Man.with.a.Plan.S03E13.iNTERNAL.720p.WEB.x264-BAMBOOZLE.en.srt'...
INFO:subsync.subtitle_parser:detected encoding: ASCII
INFO:subsync.subsync:...done
INFO:subsync.subsync:computing alignments...
INFO:subsync.subsync:...done
INFO:subsync.subsync:offset seconds: 6.190
INFO:subsync.subsync:framerate scale factor: 1.000
INFO:subsync.subsync:creating test archive Man.with.a.Plan.S03E13.iNTERNAL.720p.WEB.x264-BAMBOOZLE.mkv.2020-03-17-06:52:55.tar.gz...
INFO:subsync.subsync:...done

The first 5min`s of this file "en.srt" is good. After 5min i get a intro with a black screen. After that subtile is out of sync.

This file "en2.srt" already out-of-sync from the beginning.

Man.with.a.Plan.S03E13.iNTERNAL.720p.WEB.x264-BAMBOOZLE.mkv.2020-03-17-06:52:55.tar.gz

@hboetes
Copy link

hboetes commented Mar 27, 2020

Forget about it, this srt is toast

@smacke
Copy link
Owner

smacke commented Mar 28, 2020

@BramFr unfortunately it looks like I need the exact video (and not just the speech trace) to debug, and I'm afraid I'm having trouble locating it. One workaround would be if the mkv has embedded subs -- that would serve as a good proxy. If the following command succeeds, I can debug by looking at the resulting extracted subs:

ffmpeg -i Man.with.a.Plan.S03E13.iNTERNAL.720p.WEB.x264-BAMBOOZLE.mkv -map 0:s:1 out.srt

@BramFr
Copy link
Author

BramFr commented Mar 30, 2020

@BramFr unfortunately it looks like I need the exact video (and not just the speech trace) to debug, and I'm afraid I'm having trouble locating it. One workaround would be if the mkv has embedded subs -- that would serve as a good proxy. If the following command succeeds, I can debug by looking at the resulting extracted subs:

ffmpeg -i Man.with.a.Plan.S03E13.iNTERNAL.720p.WEB.x264-BAMBOOZLE.mkv -map 0:s:1 out.srt

Stream map '0:s:1' matches no streams.

i`ll send you a mail trough gmail with the episode.

@Kitof
Copy link

Kitof commented Apr 27, 2020

I've got another exemple of out-sync. Subsync detect -0.8 offset instead of -3.840.
files.zip

@kocane
Copy link

kocane commented Jun 30, 2020

In my case, Bazarr downloads a subtitle that is actually in sync but then ffsubsync decides to unsync it by a tiny bit. Trying to figure out why. I'd like Bazarr to sync all subtitles regardless of score so I'm trying to figure out why it doesn't just leave this one alone.

The.Wire.S01E11.The.Hunt.1080p.WEB-DL.DD5.1.H.264-NTb.mkv.2020-07-01-00 33 07.tar.gz

@smacke

@BramFr
Copy link
Author

BramFr commented Jul 21, 2020

@smacke do you have a update? Do you need any more information from me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
out-of-sync Catch-all label for still out-of-sync subtitles.
Projects
None yet
Development

No branches or pull requests

5 participants