ripping - beyond live

notes

download

open the stream in your browser and wait for it to load. next, open the wvg extension and click decrypt to get the key. it should look something like this:

d7939acfe3bf49fcb80886c2c0fa048a:7e034545f141ef42e4024b7effcc3947

copy the mpd url and key from wvg and use them in the following command to begin downloading.

n-m3u8dl-re <url> --key <key> --no-log --auto-select -mt --use-shaka-packager --live-real-time-merge --live-pipe-mux --live-keep-segments false --write-meta-json false --save-name stream

when the stream has finished, click ctrl+c to exit n-m3u8dl-re.

fix subtitles

subtitles sometimes come with mistimed lines at the beginning. for example this file had 18 lines that were mistimed before the rest of the correctly timed lines:

18
00:34:32,033 --> 00:34:34,224
<SHOW WHAT I HAVE>

19
00:28:51,438 --> 00:28:56,591
Let's say hello. Two, three!

if the mistimed subtitles aren't important you could just delete them, but in most cases you should re-time them manually. you can do this with a video player and a text editor, or a dedicated subtitling program such as aegisub. I suggest making a back up before doing any editing.

sync subtitles

subtitles will also come with sync issues, meaning they don't line up with the audio in the muxed file. this can be fixed by finding the offset between a subtitle and it's corresponding spoken line. vcr/cinematic segments are generally best for this as they are subbed before the stream and will always be timed correctly. if there aren't any of these segments then just use the very first subtitle.

for example, if the chosen subtitle is at 00:13:00 and the corresponding line is spoken at 00:15:30, then the subtitles need to be offset by 2:30. you can slot your offset into the following command, which also sets the subtitle language metadata and muxes them into the mkv:

ffmpeg -i stream.ts -itsoffset 00:00:00 -i <lang>.srt -metadata:s:s:0 language=<lang> -c copy mux.mkv

note: if the subtitle starts after the spoken line, prefix the time stamp with -.

trim

streams begin and end with a short waiting room period. these are unnecessary and can be removed to reduce file size.

open the muxed file, find your desired start and end times, then slot them into the following command:

ffmpeg -i mux.mkv -ss 00:00:00 -to 00:00:00 -c copy trimmed.mkv