I watch YouTube videos by piping URLs to mpv. Sometimes I would like to keep the video file after having watching it; just like if I had downloaded it with youtube-dl. I was wondering if there is a mpv option I am unaware of to do that (before writing my own script).

I tried to mess around with mpv cache option but the cache file does not correspond to the video I would get with youtube-dl. I also tried to force the output within ytdl-raw-option but mpv stays in streaming mode and saves only the cache file.

1 Answer 1


This should work:

youtube-dl -o - "$URL" | tee /tmp/stream.raw | mpv -
  • I was looking for a mpv option/config, nice one liner however. Such an option may not exist.
    – user413007
    Jun 24, 2020 at 13:19

You must log in to answer this question.