Ask HN: Automated WebRTC Livestream Recording

4 points by PhilipWee ↗ HN
Hey guys, I'm trying to build an automated system to record livestreams, but I'm not sure if I am doing something completely wrong or if there's a better way of doing this

Requirements

- Hands free, runs 24/7

- Incoming stream on webpage is only in WebRTC (No m3u8, etc)

- Needs to be able to record multiple (up to 4 and hopefully more) streams at once

Notes - It doesn't have to be a chrome extension

- I'm happy to download a simple app to do this if one exists

My current process: 1. I have a seperate detection script that detects when a video starts which works fine

2. Made a chrome extension

3. Chrome extension has a content script

4. Content script injects a header script into the webpage

1. The header script wraps the `WebRTC` object in a listener proxy

2. For all `WebRTC` connections made, store the audio and video tracks

5. When audio and video track is successfully found

1. Start recording stream with `MediaRecorder`

  1. This stream gets restarted every 1hr

  2. Each stream records for 1hr 10mins

 2. On each 15s chunk

 3. Convert chunk data into base64 blob

 4. Send base64 blob via messaging to content script
6. On receiving in the content script, it forwards the data to the background script

7. The background script uploads via TUS to supabase

My current problems:

1. Several 15s chunks aren't getting uploaded

2. Some of the 15s chunks are quite laggy

3. Especially during the overlapping parts, I'm losing alot of 15s chunks

If anyone has any suggestions on improving the system, or what I'm doing wrong, etc, do let me know! I've been struggling with this for quite a while so any insights or suggestions would be greatly appreciated

0 comments

[ 2.9 ms ] story [ 12.3 ms ] thread

No comments yet.