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

[BUG] Subtitles not extracted from Twitch stream #2

Open
superbonaci opened this issue Feb 1, 2024 · 1 comment
Open

[BUG] Subtitles not extracted from Twitch stream #2

superbonaci opened this issue Feb 1, 2024 · 1 comment

Comments

@superbonaci
Copy link

Download Twitch stream https://www.twitch.tv/videos/1980035805 in ts format.

$ ts-cc-extractor -i output.ts -o sub.srt
Progress: 100%
Traceback (most recent call last):
  File "/opt/homebrew/bin/ts-cc-extractor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ts_cc_extractor/__main__.py", line 24, in main
    subs_text = extract_subtitles(f_ts, fmt=args.format)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ts_cc_extractor/extractor.py", line 93, in extract_subtitles
    scc_files = extract_scc(ts_file, **options)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ts_cc_extractor/extractor.py", line 79, in extract_scc
    handle_file(ts_file, progress_callback, cc_files, **options)
  File "/opt/homebrew/lib/python3.11/site-packages/ts_cc_extractor/media_tools/ts.py", line 2757, in handle_file
    importer.add_data(data, progress_callback)
  File "/opt/homebrew/lib/python3.11/site-packages/ts_cc_extractor/media_tools/ts.py", line 1105, in add_data
    self.observer.on_pes(packet.pid, self.pids[packet.pid])
  File "/opt/homebrew/lib/python3.11/site-packages/ts_cc_extractor/media_tools/ts.py", line 2693, in on_pes
    frames = self.h264_parser.add_pes(pes.payload, pes.pts, pes.dts)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ts_cc_extractor/media_tools/ts.py", line 1803, in add_pes
    nal_data = nal_data[0] + nal_data
               ~~~~~~~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'int' and 'bytes'

MediaInfo data:
output

@superbonaci
Copy link
Author

Video Download Helper requires to change the settings to get m2ts streams. Anyway here's a sample Transport Stream video directly from Twitch, which has subtitles in CC608 format:

Rename output.z01.zip to output.z01 and extract output.zip.

output.zip
output.z01.zip

HandBrake can extract them and either burn them into the video or save to mkv as separate track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant