Error: Cannot truncate time period Period { begin: 453.57, end: 457.84 } at 453.57
MegaLoler opened this issue · comments
Hi! I'm getting this error using the export function. I get it with both the binary release and installing via cargo install
.
$ ~/.cargo/bin/substudy export review umaru-1.mp4 en-1.srt jp-1.srt
Error: Cannot truncate time period Period { begin: 453.57, end: 457.84 } at 453.57
$ ~/.cargo/bin/substudy export csv umaru-1.mp4 en-1.srt jp-1.srt
Error: Cannot truncate time period Period { begin: 453.57, end: 457.84 } at 453.57
The sub files were originally .ass
files that I converted to .srt
files using this tool: https://subtitletools.com/convert-to-srt-online
This is my system: Linux macbookpro-arch 4.14.11-1-ARCH #1 SMP PREEMPT Wed Jan 3 07:02:42 UTC 2018 x86_64 GNU/Linux
If it's relevant, here is my FFmpeg version:
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.2.1 (GCC) 20171128
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-shared --enable-version3
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
If it helps, here is (what I think is) the relevant sections in the .srt
files:
106
00:07:30,520 --> 00:07:33,550
Ah, so cat videos are popular.
107
00:07:33,570 --> 00:07:37,840
Wins
1 Million Yen!
108
00:07:33,570 --> 00:07:37,840
The pet that ranks 1st
in number of views...
109
00:07:33,570 --> 00:07:37,840
Contest!
110
00:07:33,570 --> 00:07:37,840
Animal
Video
111
00:07:33,570 --> 00:07:37,840
Enter Now!
112
00:07:33,990 --> 00:07:37,850
Oh? Looks like there's a contest going
on for whoever can get the most views.
113
00:07:37,850 --> 00:07:39,890
The one million yen is mine!
There are several segments with the time period that it complains about.
It doesn't seem to be refering to any times in jp-1.srt
but here is that general area:
125
00:07:31,520 --> 00:07:33,180
猫動画が人気あるのか
126
00:07:34,960 --> 00:07:37,620
今 再生数を競う大会が開かれてるな
127
00:07:38,140 --> 00:07:39,860
100万はうまるのだよ
Fix: After manually merging the segments in en-1.srt
that started at the same time, this issue went away and everything worked as expected.
Yeah, this error was caused when substudy tried to fix the overlapping subtitles, and discovered that they had completely identical start and end times.
I should probably add a better error message for this case. Thank you for letting me know!
A more informative error message would definitely be helpful.
I think, however, that the most useful approach would be for substudy
to just save the file with a different name (with an added suffix, for example) and not fail at all.
For example, having the file videoname_453-457.mp3
and then videoname_453-457_2.mp3
.
If substudy
is meant for language learners to have an easy and streamlined way to extract audio segments, I think it is important not to make them manually edit subtitle files so there are no duplicated timestamps.
Having said that, thank you for making this tool, it is definitely a useful one
I'm running into this error now and I haven't been able to resolve it. In my case I did notice one place in one of my srt files where there was a duplicate start time. However, after I manually merged the two entries into one, I got another error message, referring to another timestamp. A better error message would be of great help :)
Thank you, everyone, for the reports!
People keep having problems with overlapping subtitles in SRT files. I need to come up with some sort of strategy for handling this.