I'm using youtube-dl to download a live stream and I'd like to be able to limit the time of the download, closing the connection once that time has elapsed. Is there a built in way to close the connection and save the file? I don't see anything in on the manpage but maybe I'm missing something. I'm using Ubuntu 14.04. Thanks.
1 Answer
Hack-around solution: Use two terminal sessions, one for youtube-dl, and the other for sleep followed by sending SIGINT to youtube-dl.
Ex:
Terminal 1:
youtube-dl <url>
Terminal 2:
sleep 300; kill -SIGINT $(pgrep youtube-dl)
Specifically, SIGINT is the signal sent by ctrl+c, so this simulates ctrl+c'ing the youtube-dl process after the elapsed time.