Can't Download the Online Course? HLS Unpack + Local Whisper Batch Subs
A first-person walkthrough: pair an LLM assistant with DevTools to archive entitled HLS streams to MP4, then batch-transcribe on CPU with faster-whisper into SRT and TXT—pitfalls, pinned deps, reusable prompts.

Corporate training videos that only play in the browser are awkward to keep offline—and worse to search later. I had a set of courses I was already entitled to retain, and I wanted a local archive: MP4 files plus searchable transcripts. There was no download button. The player used ordinary HLS (an m3u8 playlist, .ts segments, often AES-128). I did not treat that as a crack. I paired with a local LLM assistant and reverse-engineered the playback pipeline together—so I could archive what I already had the right to keep.
This write-up has two halves: A. using an LLM assistant to map any HLS site’s download path, and B. batch local speech-to-text with faster-whisper into SRT + TXT. Domains, keys, and course names below are placeholders. Use this only for content you are allowed to keep offline. Do not use it to punch through paywalls.

Mental model first#
When a browser plays HLS, roughly:
- The player fetches an m3u8 playlist;
- The playlist lists
.tssegments (sometimes nested by quality); - If you see
#EXT-X-KEY, segments are usually AES-128 encrypted, and the player decrypts with a key from the current session; - A single MP4 is: a usable playlist + key →
ffmpegpulls segments, decrypts, and remuxes.

The LLM assistant’s job is not “one-click download.” It reads Network/Console dumps with you, rewrites playlists for offline use, and debugs ffmpeg errors. You still sign in, confirm entitlement, and run the final commands.
Part A — Download HLS with an LLM assistant#
1. Find m3u8 / .ts in DevTools#
Chrome: F12 → Network, filter m3u8, then ts. Play for a bit so requests appear.
Short clips sometimes never land in disk cache, and Network can miss them. In Console:
performance.getEntriesByType('resource')
.map(e => e.name)
.filter(u => /m3u8|\.ts(\?|$)/i.test(u))Paste the URL list to the assistant and ask it to dedupe by media id (the same play session often repeats noisy index0.ts entries).
Placeholder CDN shapes:
https://cdn.example.com/.../media/{id}_sharp/{id}_1/index.m3u8
https://cdn.example.com/.../media/{id}_sharp/{id}_1/index0.ts
https://cdn.example.com/.../media/{id}_sharp/{id}_1/index1.ts2. When the ticketed API m3u8 returns 422#
Many corporate LMS players mint a short-lived ticket, then fetch m3u8 from an API. Wrong headers or an expired ticket → 422. We burned time chasing that path. The more reliable artifact was often the CDN “sharp” / variant playlist that already lists relative or absolute .ts URLs.
Practical rules:
- Confirm the browser can still play right now (session key still valid);
- Prefer the playlist that already expands to segments;
- Tickets rotate—keep the download window short.
3. Localize the playlist: key on disk + rewrite EXT-X-KEY#
A typical playlist snippet:
#EXTM3U
#EXT-X-KEY:METHOD=AES-128,URI="https://cdn.example.com/.../key",IV=0x0123456789abcdef0123456789abcdef
#EXTINF:4.000,
index0.ts
#EXTINF:4.000,
index1.tsSteps:
- From the same logged-in playback session, download the key to
key.binin your work folder (this tutorial never pastes a real key hex); - Copy to
playlist-local.m3u8, setURI="key.bin", keep the original IV; - Keep
.tspaths relative, or rewrite to reachable absolute URLs.
Example layout:
Downloads\course-video\
playlist1-local.m3u8
key1.bin
course-01.mp4 ← output4. Decode with ffmpeg#
On my Windows box ffmpeg lived under the user Local\ffmpeg\bin. Example:
ffmpeg -y `
-allowed_extensions ALL `
-protocol_whitelist "file,http,https,tcp,tls,crypto" `
-i "playlist-local.m3u8" `
-c copy "course-01.mp4"-c copy remuxes without re-encode. We reused the same AES-128 localize-and-ffmpeg pattern across the course set; one episode was about 9:51 at 1280×720.
5. Pitfalls we hit (anonymized)#
Symptom | Fix |
|---|---|
| Add |
Incomplete MP4 / missing moov | Delete partial output and restart with a complete playlist |
Short Part missing from Cache_Data | Use Console |
Duplicate | Dedupe by media id |
Ticketed API m3u8 always 422 | Prefer CDN expanded variant playlist |
6. General recipe for any site#

- Confirm you may keep the content offline;
- Play a short stretch in-browser so the session is live;
- Capture a usable m3u8 (prefer one that lists
.ts); - If
#EXT-X-KEYexists, savekey.bin, rewrite URI locally, keep IV; ffmpeg+ whitelist +-c copy→ MP4;- Smoke-test playback, then transcribe.
Part B — Local batch speech-to-text with faster-whisper#
Download is only half. I also wanted one timed subtitle file and one plain transcript per video, without uploading media to a cloud ASR (installing deps and the first model pull still need network once).

Background and outcomes#
Item | This run |
|---|---|
Input | 12 MP4s, ~419 minutes total |
Mix | 9 English + 3 Chinese courses |
Output | Matching |
Where | Local CPU inference |
Model | Multilingual Whisper small (CTranslate2 / faster-whisper) |
Tools |
|
Quality bar | ASR draft — needs human proofreading |
Note | No |
1. Inspect streams with FFprobe#
ffprobe -v error `
-show_entries "format=duration:stream=index,codec_type,codec_name" `
-of json "course-01.mp4"All 12 had video + audio; no separate subtitle stream. Some English captions were burned into the picture, so we chose ASR.
Decision tree:
- Separate subtitle track → try extract first;
- Burned-in only → OCR or ASR;
- No captions → ASR draft.
2. Pin the environment#
Python 3.12, faster-whisper==1.2.1, av==16.1.0:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install "faster-whisper==1.2.1" "av==16.1.0" opencc-python-reimplementedYou can pre-download the model directory and pass that path to WhisperModel.
3. Core parameters (exactly this run)#
model = WhisperModel(
model_path,
device="cpu",
compute_type="int8",
cpu_threads=8,
)
segments, info = model.transcribe(
video_path,
beam_size=5,
vad_filter=True,
condition_on_previous_text=False,
)device="cpu": no GPU this time;compute_type="int8": lighter CPU footprint;cpu_threads=8(some parallel long jobs used 4);beam_size=5,vad_filter=True,condition_on_previous_text=False;- no
language=→ auto-detect matched the course languages; - no
initial_prompt.
We passed MP4 paths straight into faster-whisper; PyAV decoded audio—no intermediate WAV export. Load the model once per process, then walk that process’s video list.
4. One recognition pass → SRT + TXT#
1
00:00:00,140 --> 00:00:14,580
Dear colleagues. Hello everyone.Dear colleagues. Hello everyone.Chinese text went through OpenCC t2s (Simplified). Files used utf-8-sig for friendlier Windows editors.
Write course-01.srt.part / course-01.txt.part first, then rename. The script skips a video if either .srt or .txt already exists—if only one is present, inspect before re-running.
Scrubbed examples live in files/transcribe.example.py and files/verify.example.py (edit ROOT / MODEL_DIR).
5. Compatibility: PyAV version clash#
First failure:
TypeError: open() got an unexpected keyword argument 'metadata_errors'faster-whisper called av.open(..., metadata_errors="ignore"), but PyAV 19.x rejected that kwarg. Pinning av==16.1.0 fixed decoding. Lesson for the FAQ: match versions, then prove one audio decode works—do not assume every future release shares the same bug.
6. How we verified#
For each of the 12 videos we checked:
- Matching
.srtand.txtexist; - Neither is empty;
- Cue indices and timestamp format look right;
- Cue times are valid and ordered;
- Last cue is not wildly past media duration.
All 12 passed those structural checks. That does not mean every word is correct. Spot checks found Chinese homophone mistakes (a brand name heard as a near-sounding word)—fix with context. Names, numbers, and jargon still need the original video.
Reusable prompts#
These are for a local-capable coding agent or a proofreading assistant—not Whisper’s initial_prompt.
1. Batch transcription task#
Short original ask: “Generate a separate subtitle document for every video in this folder.” A tighter brief:
Please process every MP4 under the current folder (including subfolders).
Requirements:
1. Inspect duration, audio tracks, and whether a separate subtitle stream exists.
2. Run a local speech model on the audio; auto-detect Chinese or English.
3. For each video, write a same-named SRT and TXT next to the source file.
4. Convert Chinese output to Simplified Chinese.
5. Do not overwrite existing subtitle/transcript files; report conflicts first.
6. Verify outputs exist and cue timelines look valid.
7. Spot-check for proper nouns and unclear audio; flag human review items.
8. Report the model, key parameters, and process you used.Whether an assistant can execute this depends on its tools and permissions.
2. Proofread a transcript#
Proofread the ASR draft below. Fix clear typos, homophones, punctuation,
and sentence breaks using context.
Rules:
1. Keep the speaker’s meaning; do not invent claims that were not said.
2. Correct brand/product names only when context is clear; otherwise mark [to verify].
3. Mark uncertain names, numbers, and jargon as [to verify] — do not guess.
4. If the input is SRT, keep indices and timestamps; edit cue text only.
5. List important edits and items that still need a human.
Transcript:
【paste text or SRT】Handle internal material only in environments your organization allows.
3. Ask an assistant to draft a tutorial#
Using the processing notes below, write a beginner tutorial:
“How to batch-generate subtitles and transcripts locally.”
Requirements:
1. Cover setup, inspect video, recognize audio, export SRT/TXT,
verify/proofread, and FAQ — in that order.
2. Separate parameters we actually used from optional optimizations.
3. Explain why ASR drafts still need humans.
4. Do not invent runtime, accuracy %, or steps we did not run.
5. Include copy-paste commands and AI-assistant task prompts.
Notes:
【paste the technical flow and parameters】Closing#
One sentence: HLS you can play—and are allowed to archive—can become a local MP4; local Whisper turns that into a searchable draft. ASR saves “typing from scratch,” not proofreading. Keeping keys, tickets, and course media inside your own machine and policy boundary matters more than chasing a magic one-click tool.
Related articles

I Use a Mac to Control a Windows PC on My LAN
I sit at a Mac and use Moonlight to reach a Windows desktop on the LAN. This is how I pick a tool, install Sunshine, pair again, and what I checked after a reinstall when the host went offline and pairing returned 409. I have not confirmed that desktop streaming already worked this time.

How I Use AI on a Mac to Develop Fully Offline Windows Host Software
My working setup: the Mac goes online over Wi-Fi, and Codex / Claude Code run on the Mac. Windows holds the project, talks to devices, and runs the builds, with no Internet egress, talking to the Mac only over a LAN. This tutorial explains the design and includes deployment prompts I can give directly to an AI.

I Used AI to Automatically Save 16TB of English Resources to My Baidu Netdisk
I used AI to select 281,000 English-learning files from 886,000 files, organize 15.95TB by category and difficulty, and automatically save them to my Baidu Netdisk, with read-back checks, reconciliation, and cleanup.
Comments
No comments yet — be the first to leave one.