Would it be possible to capture video by using headless browser and rendering the video element & audio to file? Of course, this will induce some quality loss if encoded to lossy format again. But would effectively be "legal" as the tool would run the youtube's "DRM" and be not distinct from normal browser in any way. I guess the headless browser could maybe perhaps just download the stream to disk as well.