I was having trouble watching the Théâtre du Châtelet performance of Einstein on the beach at home; my connection was stuttering and buffering, which makes listening to highly-pulsed minimalist music extremely unrewarding. Nothing like a hitch in the middle of the stream to throw you out of the zone that Glass is trying to establish. (This is a brilliant staging of this opera and you should go watch it Right Now.)
So I started casting around for a way to download the video and watch it at my convenience. (Public note: I would never redistribute the recording; this is solely to allow me to timeshift the recording such that I can watch it continuously.) I looked at the page and thought, “yeah, I could work this out, but isn’t there a better way?” I searched for a downloader for the site in question, and found it mentioned in a comment in the GitHub pages for youtube-dl.
I wasn’t 100% certain that this would work, but a quick perusal seemed to indicate that it was a nicely sophisticated Python script that ought to be able to do the job. I checked it out and tried a run; it needed a few things installed, most importantly ffmpeg. At this point I started getting a little excited, as I knew ffmpeg should technically be quite nicely able to do any re-enoding etc. that the stream might need.
A quick brew install later, I had ffmpeg, and I asked for the download (this is where we’d gotten to while I’ve been writing this post):
$ youtube_dl/__main__.py http://culturebox.francetvinfo.fr/einstein-on-the-beach-au-theatre-du-chatelet-146813 [culturebox.francetvinfo.fr] einstein-on-the-beach-au-theatre-du-chatelet-146813: Downloading webpage [culturebox.francetvinfo.fr] EV_6785: Downloading XML config [download] Destination: Einstein on the beach au Théâtre du Châtelet-EV_6785.mp4 ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers built on Jan 12 2014 20:50:55 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 [h264 @ 0x7ffb5181ac00] non-existing SPS 0 referenced in buffering period [h264 @ 0x7ffb5181ac00] non-existing SPS 15 referenced in buffering period [h264 @ 0x7ffb5181ac00] non-existing SPS 0 referenced in buffering period [h264 @ 0x7ffb5181ac00] non-existing SPS 15 referenced in buffering period [mpegts @ 0x7ffb52deb000] max_analyze_duration 5000000 reached at 5013333 microseconds [mpegts @ 0x7ffb52deb000] Could not find codec parameters for stream 2 (Unknown: none ( / 0x0015)): unknown codec Consider increasing the value for the 'analyzeduration' and 'probesize' options [mpegts @ 0x7ffb52deb000] Estimating duration from bitrate, this may be inaccurate [h264 @ 0x7ffb51f9aa00] non-existing SPS 0 referenced in buffering period [h264 @ 0x7ffb51f9aa00] non-existing SPS 15 referenced in buffering period [hls,applehttp @ 0x7ffb51815c00] max_analyze_duration 5000000 reached at 5013333 microseconds [hls,applehttp @ 0x7ffb51815c00] Could not find codec parameters for stream 2 (Unknown: none ( / 0x0015)): unknown codec Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, hls,applehttp, from 'http://ftvodhdsecz-f.akamaihd.net/i/streaming-adaptatif/evt/pf-culture/2014/01/6785-1389114600-1-,320x176-304,512x288-576,704x400-832,1280x720-2176,k.mp4.csmil/index_2_av.m3u8': Duration: 04:36:34.00, start: 0.100667, bitrate: 0 kb/s Program 0 Metadata: variant_bitrate : 0 Stream #0:0: Video: h264 (Main) ( / 0x001B), yuv420p, 704x396, 12.50 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1: Audio: aac ( / 0x000F), 48000 Hz, stereo, fltp, 102 kb/s Stream #0:2: Unknown: none ( / 0x0015) Output #0, mp4, to 'Einstein on the beach au Théâtre du Châtelet-EV_6785.mp4.part': Metadata: encoder : Lavf54.63.104 Stream #0:0: Video: h264 ( / 0x0021), yuv420p, 704x396, q=2-31, 12.50 fps, 90k tbn, 90k tbc Stream #0:1: Audio: aac ( / 0x0040), 48000 Hz, stereo, 102 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame=254997 fps=352 q=-1.0 size= 1072839kB time=02:49:59.87 bitrate= 861.6kbits/s
Son of a gun. It works.
I’m waiting for the download to complete to be sure I got the whole video, but I am pretty certain this is going to work. Way better than playing screen-capture games. We’ll see how it looks when we’re all done, but I’m quite pleased to have it at all. The download appears to be happening at about 10x realtime, so I should have it all in about 24 minutes, give or take (it’s a four-hour, or 240 minute, presentation).
Update: Sadly, does not work for PBS videos, but you can actually buy those; I can live with that.