6

I prefer streaming Youtube videos via mpv,

mpv https://www.youtube.com/watch?v=<video-id>

However, for long videos sometimes the audio breaks down in the middle, leaving error messages like

[ffmpeg] tls: Error in the pull function.

Restarting the video is starting it from the beginning. How can I either directly in the command line start from, let's say, minute 30, or alternatively jump in the mpv interface to minute 30 without pressing 30 times the up button (which also has issues if done too fast)?

I haven't found an answer related to that issue in the man page. Is it possible at all?

Also alternative suggestions for streaming are welcome.

1

2 Answers 2

4

Get a decent cache with youtube-dl (to avoid the issue in the first place)

youtube-dl.py -q -f "(137/136)+(141/140)" "$URL"

Play the cache with any player (ffplay, vlc, omxplayer, c2play, mpv, etc) If you still want to seek;

ffplay -ss 30:00 *.mp4

.

vlc --start-time=1800 *.mp4

.

omxplayer --pos 00:30:00 *.mp4

.

c2play --time 00:30:00.00 *.mp4

.

mpv --start=30:00 *.mp4
6
  • What is the -f "(137/136)+(141/140)" format option for youtube-dl doing? Could you elaborate on that part?
    – jjdb
    May 31, 2017 at 6:07
  • @jjdb the man/help page will tell you all about -f but but basically its selecting the mp4 format from the youtube API. ( see "Comparison of YouTube media encoding options " en.wikipedia.org/wiki/YouTube#Quality_and_formats ) May 31, 2017 at 20:35
  • Still, the code is cryptic to me. And also: As far as I understand it, your proposal essentially involves a download that has to be removed later. So it is not actually a streaming solution, is it?
    – jjdb
    Jun 2, 2017 at 5:26
  • @jjdb clearly my answer offers both options, obviously if streaming is unreliable a more stable cache can be used and can be scripted to automatically remove the file when done. Jun 2, 2017 at 20:10
  • Well, it is not really a streaming solution, as I have to wait for the whole video to be downloaded in order to be able to play it correctly: with mpv, audio does not work properly.
    – jjdb
    Jun 2, 2017 at 21:34
4
+50

You can use --start=MM:SS to start your video at MM minutes SS seconds.

For example:

mpv --start=45:00 'https://www.youtube.com/watch?v=<video-id>'

Will start the video at 45 minutes.

4
  • I've tried the command, but my connection is lousy at the moment, so it didn't work. I'll try later again. So far it works fine for say 1 minute into the video, but 20 or so is too much already. [cache] Cache is not responding - slow/stuck network connection? is the error message
    – jjdb
    May 31, 2017 at 17:47
  • In this case you might want to first download the video with a tool like youtube-dl for example, then play it with mpv at the wanted location.
    – bew
    May 31, 2017 at 18:07
  • Do you know of another way to increase the cache size, or to improve cache handling?
    – jjdb
    Jun 2, 2017 at 5:24
  • 1
    You can change the cache size with --cache and some other options (see the man page)
    – bew
    Jun 4, 2017 at 10:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .