Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion arib/ts2srt.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ def run(self) -> int:
ts.OnTSPacket = self.on_ts_packet
ts.OnESPacket = self.on_es_packet

ts.Parse()
try:
ts.Parse()
finally:
# Ensure buffered subtitle data is written to disk even if parsing
# encounters errors partway through the file
if self.srt:
self.srt.finalize()

if self.pid < 0 and not self.cfg.quiet:
print(f"*** Sorry. No ARIB subtitle content was found in file: {self.cfg.infile} ***")
Expand Down