ASS in JSON umwandeln
Oder Untertiteltext einfügen
Was diese Konvertierung ändert
1 Sache entfällt oder braucht eine Entscheidung
- Formatspezifischer Inhalt
Inhalt, den das Quellformat außerhalb seiner Blöcke führt (Nicht-Block-Abschnitte, Kopftext, Einstellungen pro Block, auskommentierte Ereignisse) — das Zielformat hat keinen Platz dafür
Diese Liste stammt aus der Fähigkeitsmatrix für diese beiden Formate, nicht aus der konkreten Datei, die Sie geladen haben. Eine bestimmte Datei kann mehr verlieren, wenn sie Merkmale nutzt, die das Format erlaubt, die Matrix aber nicht modelliert.
Diese Seite konvertiert ASS in JSON. Datei hineinziehen – oder Text einfügen – und Sie erhalten die JSON-Fassung zurück. Die Konvertierung läuft vollständig in Ihrem Browser, nichts wird hochgeladen, kein Konto ist nötig.
Die beiden Formate speichern nicht dasselbe: Formatspezifische Inhalte haben in JSON keinen Platz – der übrige `[Script Info]`-Block, `Comment:`-Zeilen und eingebettete Schriften oder Grafiken. Die Stiltabelle dagegen kommt mit allen Spalten mit, ebenso Positionen und Karaoke-Marken. Die Liste oben stammt aus dem, was die Formate ausdrücken können, nicht aus Ihrer Datei.
Eine Datei oder eine ganze Staffel: Die Warteschlange arbeitet der Reihe nach, und die Ergebnisse kommen als ein ZIP-Archiv.
Beispiele
Eine typische ASS-Datei, konvertiert nach JSON
Eingabe
[Script Info]
Title: Example
ScriptType: v4.00+
WrapStyle: 0
[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: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1
Style: Title,Arial,36,&H0000FFFF,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:01.00,0:00:04.00,Default,,0,0,0,,Hello there.
Dialogue: 0,0:00:05.00,0:00:08.50,Default,,0,0,0,,{\i1}Italic{\i0} and {\b1}bold{\b0} text.
Dialogue: 0,0:00:09.00,0:00:12.00,Title,,0,0,0,,{\pos(320,240)}Positioned
Dialogue: 0,0:00:13.00,0:00:16.00,Default,,0,0,0,,{\k50}ka{\k30}ra{\k20}o{\k10}ke
Dialogue: 0,0:00:17.00,0:00:20.00,Default,,0,0,0,,Line one\NLine two
Dialogue: 1,0:00:21.00,0:00:24.00,Default,,0,0,0,,{\an7}Top left
Ausgabe
{
"version": 1,
"title": "Example",
"styles": {
"Default": {
"name": "Default",
"Name": "Default",
"Fontname": "Arial",
"Fontsize": "20",
"PrimaryColour": "&H00FFFFFF",
"SecondaryColour": "&H000000FF",
"OutlineColour": "&H00000000",
"BackColour": "&H00000000",
"Bold": "0",
"Italic": "0",
"Underline": "0",
"StrikeOut": "0",
"ScaleX": "100",
"ScaleY": "100",
"Spacing": "0",
"Angle": "0",
"BorderStyle": "1",
"Outline": "2",
"Shadow": "2",
"Alignment": "2",
"MarginL": "10",
"MarginR": "10",
"MarginV": "10",
"Encoding": "1",
"fontFamily": "Arial",
"fontSize": 20,
"primaryColor": "#ffffff",
"outlineColor": "#000000",
"bold": false,
"italic": false
},
"Title": {
"name": "Title",
"Name": "Title",
"Fontname": "Arial",
"Fontsize": "36",
"PrimaryColour": "&H0000FFFF",
"SecondaryColour": "&H000000FF",
"OutlineColour": "&H00000000",
"BackColour": "&H00000000",
"Bold": "-1",
"Italic": "0",
"Underline": "0",
"StrikeOut": "0",
"ScaleX": "100",
"ScaleY": "100",
"Spacing": "0",
"Angle": "0",
"BorderStyle": "1",
"Outline": "2",
"Shadow": "2",
"Alignment": "2",
"MarginL": "10",
"MarginR": "10",
"MarginV": "10",
"Encoding": "1",
"fontFamily": "Arial",
"fontSize": 36,
"primaryColor": "#ffff00",
"outlineColor": "#000000",
"bold": true,
"italic": false
}
},
"cues": [
{
"start": 1000,
"end": 4000,
"lines": [
"Hello there."
],
"style": "Default"
},
{
"start": 5000,
"end": 8500,
"lines": [
{
"text": "Italic and bold text.",
"tags": [
{
"kind": "italic",
"start": 0,
"end": 6
},
{
"kind": "bold",
"start": 11,
"end": 15
}
]
}
],
"style": "Default"
},
{
"start": 9000,
"end": 12000,
"lines": [
"Positioned"
],
"style": "Title",
"position": {
"x": 320,
"y": 240
}
},
{
"start": 13000,
"end": 16000,
"lines": [
{
"text": "karaoke",
"tags": [
{
"kind": "karaoke",
"start": 0,
"end": 2,
"value": "50"
},
{
"kind": "karaoke",
"start": 2,
"end": 4,
"value": "30"
},
{
"kind": "karaoke",
"start": 4,
"end": 5,
"value": "20"
},
{
"kind": "karaoke",
"start": 5,
"end": 7,
"value": "10"
}
]
}
],
"style": "Default"
},
{
"start": 17000,
"end": 20000,
"lines": [
"Line one",
"Line two"
],
"style": "Default"
},
{
"start": 21000,
"end": 24000,
"lines": [
"Top left"
],
"style": "Default"
}
]
}
In dieser Ausgabe gehen verloren: formatspezifische Inhalte. Alles andere stimmt Zeile für Zeile überein.
Dieselbe Konvertierung mit ungewöhnlicher Eingabe
Eingabe
[Script Info]
; 一份真实的脏文件:BOM + CRLF + 认不出的覆写码 + Comment + 坏时间码
Title: Dirty sample
ScriptType: v4.00+
[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: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,1,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1
[Fonts]
fontname: Arial
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Comment: 0,0:00:00.00,0:00:01.00,Default,,0,0,0,,这是一条注释,不该变成字幕
Dialogue: 0,0:00:01.00,0:00:04.00,Default,,0,0,0,,Hello, world
Dialogue: 0,0:00:05.00,0:00:08.00,Default,,0,0,0,,{\fad(300,300)}Unmodelled override
Dialogue: 0,0:00:09.00,0:00:12.00,Default,,0,0,0,,{\an7\pos(320,240)}Both, wrong order
Dialogue: 0,0:00:13.00,0:00:16.5,Default,,0,0,0,,One decimal centisecond
Dialogue: 0,0:00:17.00,0:00:20.00,Default,,0,0,0,,Soft\nbreak
Dialogue: 0,0:00:xx.00,0:00:24.00,Default,,0,0,0,,Broken timecodeAusgabe
{
"version": 1,
"title": "Dirty sample",
"styles": {
"Default": {
"name": "Default",
"Name": "Default",
"Fontname": "Arial",
"Fontsize": "20",
"PrimaryColour": "&H00FFFFFF",
"SecondaryColour": "&H000000FF",
"OutlineColour": "&H00000000",
"BackColour": "&H00000000",
"Bold": "1",
"Italic": "0",
"Underline": "0",
"StrikeOut": "0",
"ScaleX": "100",
"ScaleY": "100",
"Spacing": "0",
"Angle": "0",
"BorderStyle": "1",
"Outline": "2",
"Shadow": "2",
"Alignment": "2",
"MarginL": "10",
"MarginR": "10",
"MarginV": "10",
"Encoding": "1",
"fontFamily": "Arial",
"fontSize": 20,
"primaryColor": "#ffffff",
"outlineColor": "#000000",
"bold": true,
"italic": false
}
},
"cues": [
{
"start": 1000,
"end": 4000,
"lines": [
"Hello, world"
],
"style": "Default"
},
{
"start": 5000,
"end": 8000,
"lines": [
"{\\fad(300,300)}Unmodelled override"
],
"style": "Default"
},
{
"start": 9000,
"end": 12000,
"lines": [
"Both, wrong order"
],
"style": "Default",
"position": {
"x": 320,
"y": 240
}
},
{
"start": 13000,
"end": 16500,
"lines": [
"One decimal centisecond"
],
"style": "Default"
},
{
"start": 17000,
"end": 20000,
"lines": [
"Soft",
"break"
],
"style": "Default"
}
]
}
So sehen echte Skripte aus – gemischte Zeilenenden, Override-Codes, eingebettete Schriften. Vergleichen Sie mit dem sauberen Beispiel oben.
Häufige Fragen
Was passiert mit den [Script Info]-Abschnitten von ASS, Comment-Zeilen und eingebetteten Schriften in JSON?
Mehr bleibt erhalten als erwartet: der Titel und die ganze ASS-Stiltabelle – jede Spalte, auch die nicht modellierten, plus geparste Schrift, Größe, Farbe und Fett/Kursiv. Keinen Platz hat der Rest von `[Script Info]`, Nicht-`Dialogue:`-Events und alles in `[Fonts]` oder `[Graphics]`.
Wie sieht die JSON-Ausgabe aus, wenn aus ASS JSON wird?
Wie JSON: ein Array von Blockobjekten, jedes mit eigenem `id`, `start` und `end`. Jeder ASS-Block wird ein JSON-Block, in derselben Reihenfolge und mit demselben Text.
Sind die ASS-Zeitangaben in der JSON-Datei exakt?
Ja, auf die Millisekunde. ASS schreibt `0:00:04.13`, JSON denselben Moment als `4130`; nichts wird gerundet oder verschoben, und ein Block, der 2,9 Sekunden sichtbar war, bleibt es.
Wie kommt ein zweizeiliger ASS-Block in JSON heraus?
Als zwei Einträge im `lines`-Array des Blocks. Beide ASS-Zeilen gehören in der JSON-Ausgabe weiterhin zu einem Untertitel.
Was geht bei ASS nach JSON verloren?
Formatspezifische Inhalte: der übrige `[Script Info]`-Block, `Comment:`, `Picture:` und `Sound:`, eingebettete Schriften und Grafiken. Stiltabelle, Titel, Text, Zeitachse und Karaoke-Marken kommen dagegen an.
Warum ist die JSON-Ausgabe von ASS so ausführlich?
Weil das Schema die Stiltabelle mit jeder Spalte übernimmt, auch den nicht modellierten, und zusätzlich die geparsten Felder `fontFamily`, `fontSize`, `primaryColor` und die Fett-/Kursiv-Flags liefert. Damit bleibt das ASS-Styling maschinenlesbar.