Downloading an upcoming YouTube livestream when you can not be there for it is an interesting challenge. But I have found a tool that promises to be able to download a future livestream when you have the URL.
Firstly, install go.
jcartwright@jcartwright-System-Version:~$ sudo apt install golang-go
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
golang-1.21-go golang-1.21-src golang-src
Suggested packages:
bzr | brz git mercurial subversion
The following NEW packages will be installed:
golang-1.21-go golang-1.21-src golang-go golang-src
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 44.3 MB of archives.
After this operation, 219 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Once this is installed, download and install the required tool.
jcartwright@jcartwright-System-Version:~$ go install github.com/Kethsar/ytarchive@dev
go: downloading github.com/Kethsar/ytarchive v0.4.1-0.20230904222205-7faf1a697096
go: downloading github.com/mattn/go-colorable v0.1.11
go: downloading github.com/alessio/shellescape v1.4.1
go: downloading golang.org/x/net v0.0.0-20210510120150-4163338589ed
go: downloading github.com/mattn/go-isatty v0.0.14
go: downloading golang.org/x/sys v0.3.0
This will download and install the executable in the $HOME/go/bin folder, this will not be in the PATH. This may be fixed this way.
jcartwright@jcartwright-System-Version:~$ export PATH=~/go/bin:$PATH
Then this program will be ready to use. Ensure that FFmpeg is also installed, this is required to mix down the final video.
jcartwright@jcartwright-System-Version:~$ ytarchive
ytarchive 0.4.0
Enter a youtube livestream URL:
Then we may add a YouTube stream and wait for it to begin.
jcartwright@jcartwright-System-Version:~$ ytarchive
ytarchive 0.4.0
Enter a youtube livestream URL: https://www.youtube.com/watch?v=_arHuz4Q-P0
2023/11/13 08:21:48 https://www.youtube.com/watch?v=_arHuz4Q-P0 is likely a future scheduled livestream.
Would you like to wait for the scheduled start time, poll until it starts, or not wait?
wait/poll/[no]: wait
2023/11/13 08:21:53 Channel: Jonathon Hills
2023/11/13 08:21:53 Video Title: Jimmy's Birthday 🎂
Since you are going to wait for the stream, you must pre-emptively select a video quality.
There is no way to know which qualities will be available before the stream starts, so a list of all possible stream qualities will be presented.
You can use youtube-dl style selection (slash-delimited first to last preference). Default is 'best'
Available video qualities: audio_only, 144p, 240p, 360p, 480p, 720p, 720p60, 1080p, 1080p60, 1440p, 1440p60, 2160p, 2160p60, best
Enter desired video quality: 1080p
2023/11/13 08:22:09 Stream starts at 2023-11-12T23:00:00+00:00 in 5871 seconds.
2023/11/13 08:22:09 Waiting for this time to elapse...
This did work though, after the stream started, it began downloading the stream and it saved the final file.
jcartwright@jcartwright-System-Version:~$ ytarchive
ytarchive 0.4.0
Enter a youtube livestream URL: https://www.youtube.com/watch?v=_arHuz4Q-P0
2023/11/13 08:21:48 https://www.youtube.com/watch?v=_arHuz4Q-P0 is likely a future scheduled livestream.
Would you like to wait for the scheduled start time, poll until it starts, or not wait?
wait/poll/[no]: wait
2023/11/13 08:21:53 Channel: Jonathon Hills
2023/11/13 08:21:53 Video Title: Jimmy's Birthday 🎂
Since you are going to wait for the stream, you must pre-emptively select a video quality.
There is no way to know which qualities will be available before the stream starts, so a list of all possible stream qualities will be presented.
You can use youtube-dl style selection (slash-delimited first to last preference). Default is 'best'
Available video qualities: audio_only, 144p, 240p, 360p, 480p, 720p, 720p60, 1080p, 1080p60, 1440p, 1440p60, 2160p, 2160p60, best
Enter desired video quality: 1080p
2023/11/13 08:22:09 Stream starts at 2023-11-12T23:00:00+00:00 in 5871 seconds.
2023/11/13 08:22:09 Waiting for this time to elapse...
2023/11/13 10:00:16 Stream is 15 seconds late...
2023/11/13 10:00:31 Stream is 30 seconds late...
2023/11/13 10:00:47 Stream is 45 seconds late...
2023/11/13 10:01:02 Stream is 60 seconds late...
2023/11/13 10:01:18 Stream is 75 seconds late...
2023/11/13 10:01:33 Stream is 90 seconds late...
2023/11/13 10:01:49 Stream is 105 seconds late...
2023/11/13 10:02:04 Stream is 120 seconds late...
2023/11/13 10:02:19 Stream is 135 seconds late...
2023/11/13 10:02:35 Stream is 150 seconds late...
2023/11/13 10:02:50 Stream is 165 seconds late...
2023/11/13 10:03:06 Stream is 180 seconds late...
2023/11/13 10:03:21 Stream is 195 seconds late...
2023/11/13 10:03:22 Selected quality: 1080p (h264)
Video Fragments: 1671; Audio Fragments: 1671; Total Downloaded: 1.90GiB
2023/11/13 12:23:43 Download Finished
2023/11/13 12:23:43 Muxing final file...
frame=250650 fps=43212 q=-1.0 Lsize= 1997335kB time=02:19:14.98 bitrate=1958.4kbits/s speed=1.44e+03x
2023/11/13 12:23:49
Final file: /home/jcartwright/Jimmy's Birthday 🎂-_arHuz4Q-P0.mp4