Skip to content

deadmau5archive/patrec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Patreon Recorder

Record

Prerequisites
A stable internet connection, a patreon subscription, Google Chrome, sufficient storage space

Setup
Extract this zip. Set up a new chrome profile (this is not required but makes things easier). Set the downloads folder in settings to where you want your recording to be saved. Go to manage extensions, toggle developer mode, click Load unpacked. Select the ext folder. The Patreon Recorder extension should now appear in the list.

Record
Navigate to patreon.com. You will notice a new REC Button in the top right. Navigate to the stream you want to record, and hit REC. The script is now recording. You can also see some debug info in the top right panel. Every 60 seconds, a video chunk will be automatically downloaded (just like when you download a file, i.e. it goes to the downloads folder we specified earlier). You can leave this running, and you can even minimize the window or mute the stream. Do not change the window size however, always leave it maximised. This ensures the best possible recording quality. If you make your window smaller, WebRTC actually adapts your stream quality to a lower resolution. These resolution changes do not break the recording, but you do compromise on video quality.

Autorecord

You can have the extension wait and repeatedly check for a new stream and if it finds one have it auto-start recording.
To do this, go to the creators page (patreon.com/cw/creatorname) whose stream you wish to record.
You can now, provided the extension is enabled, see a little panel at the top. Enter your desired re-check interval for new streams in seconds (default is 60, please do not overdo this and get yourself blocked by cloudflare for request-spamming!) and then click start. The script now repeatedly queries patreons ajax API which it also uses to load in content when you browse the page normally to check whether a stream has been started (it does not check all recent posts – in fact it pretty much only checks the first thing that appears on the page. This is due to patreons API design, and I don't want to fire off more than one request per checking interval. But streams that are currently live always show up there... at least I think they do)

Flow
If a stream is found, your browser tab is redirected to the stream page and the recorder automatically starts recording. Once the stream ends, it wraps up the recording and goes back to it's observing duties. Meaning, once you clicked start once, this is a complete and indefinite hands-off operation.

Stitch

Prerequisites
Python 3, ffmpeg

After recording
After recording, you need to stitch together all your recorded chunks. You do this by first binary-concatenating all the files (you can do this with merge.py, or however you want) and then running ffmpeg on that merged file with streamcopy to fixup seek index cues, segment durations, etc.

Files
The recorder saves all chunks in this format:
wrtc-TIMESTAMP-INDEX.webm
where

  • TIMESTAMP is the unixtime start timestamp of the recording. it is the same for all chunks belonging to the same recording, and unique per recording.
  • INDEX is the ordinal number identifying the chunk (starting at 0, ascending)

merge.py
Place the merge.py script in the folder where your recorded chunks are saved.
Run this command:
python3 merge.py TIMESTAMP
where TIMESTAMP is the timestamp of the stream you want to process.
This results in a TIMESTAMP-merge.webm file being generated (which is the binary concatenation of all recording chunks)

ffmpeg
If you try to play back the merged file, you'll see it works, but the seek bar is missing. This is because the video data is live-recorded and there is no proper timecode data (in simple terms). We can fix this by running it through ffmpeg with the following command (no re-encode necessary):
ffmpeg -i merge.webm -c copy out.webm
where

  • merge.webm is the merged file we created earlier
  • out.webm is the output file

About

Patreon WebRTC recorder

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors