asticode / go-astisub

Manipulate subtitles in GO (.srt, .ssa/.ass, .stl, .ttml, .vtt (webvtt), teletext, etc.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

convert ass subtitle contains more than one language to vtt fail

tonytony2020 opened this issue · comments

commented

cat /tmp/Armageddon.1998.ass

Title: CNXP
Original Script: lzqc
PlayResX: 384
PlayResY: 288
Timer: 100.0000

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: chs,simhei,20,&H00ffffff,&H0000ffff,&H00000000,&H80000000,1,0,0,0,90,90,0,0.00,1,2,2,2,20,20,17,1

[V4 Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
Style: eng,Arial Narrow,12,&H00ffeedd,&H00ffc286,&H00000000,&H80000000,-1,0,1,1,0,2,20,20,4,0,1

[Events]
Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:53.11,0:00:55.23,*eng,,0000,0000,0000,,This is the Earth at a time...
Dialogue: 0,0:00:55.36,0:01:00.19,*eng,,0000,0000,0000,,when the dinosaurs roamed a lush and fertile planet.
Dialogue: 0,0:01:07.58,0:01:11.03,*eng,,0000,0000,0000,,A piece of rock just six miles wide...
Dialogue: 0,0:00:53.11,0:00:55.23,*chs,,0000,0000,0000,,这是地球
Dialogue: 0,0:00:55.36,0:01:00.19,*chs,,0000,0000,0000,,那是恐龙称霸的时代 万物滋长 欣欣向荣
Dialogue: 0,0:01:07.58,0:01:11.03,*chs,,0000,0000,0000,,一块只有六里宽的石头

reproduct bug

go install github.com/asticode/go-astisub/astisub@latest
astisub convert -i /tmp/Armageddon.1998.ass -o /tmp/out.vtt

it shows
2022/12/13 21:32:07 astisub: style *eng not found while opening /tmp/Armageddon.1998.ass

How did you come up with this .ass file ? 🤔

Its content is weird :

  1. Only eng style is declared
  2. In events, styles *eng and *chs are requested but it won't match anything with the leading *
commented

I extract it from a MKV media file via
ffmpeg -hide_banner -loglevel error -y -i /tmp/Armageddon.1998.mkv -copyts -map 0:3 -an -vn -c:s copy /tmp/3.ass

BTW ffmpeg v5.1.2 extract it into WebVTT it works good as expected
ffmpeg -hide_banner -loglevel error -y -i /tmp/Armageddon.1998.mkv -copyts -map 0:3 -an -vn /tmp/3.vtt

both IINA v1.3.1(mpv 0.34.1) and VLC v3.0.17.3 parse the same Armageddon.1998.mkv subtitle stream successfully.

Could you share the WebVTT generated by ffmpeg ?

I've pushed a fix on master, could you check this fixes your issue?

Also could you share both ffmpeg's webvtt as well as astisub's webvtt to check the differences?

commented

Could you share the WebVTT generated by ffmpeg ?

its original file too long, here is first 20 lines

head -n 20 /tmp/3.vtt

WEBVTT

00:53.110 --> 00:55.230
This is the Earth at a time...

00:53.110 --> 00:55.230
这是地球

00:55.360 --> 01:00.190
when the dinosaurs roamed a lush and fertile planet.

00:55.360 --> 01:00.190
那是恐龙称霸的时代 万物滋长 欣欣向荣

01:07.580 --> 01:11.030
A piece of rock just six miles wide...

01:07.580 --> 01:11.030
一块只有六里宽的石头

IINA and VLC auto merge and show the same timestamp *eng and *chs lines in view

Screenshot 2022-12-14 at 22 01 57

I've pushed a fix on master, could you check this fixes your issue?

Also could you share both ffmpeg's webvtt as well as astisub's webvtt to check the differences?

nope, it doesn't works.

I think it is a good idea that go-astisub should use above ass and vtt subtitles snippet as test sample, check it in and out data.

nope, it doesn't works.

What is going wrong?