4 ms·
> Let's say you've been playing a video on YouTube. You missed the last few seconds of dialog, so you scrub back a few seconds. Have you noticed that it doesn't
by Wowfunhappy 7y ago
> Let's say you've been playing a video on YouTube. You missed the last few seconds of dialog, so you scrub back a few seconds. Have you noticed that it doesn't instantly start playing from that timecode you just selected. It pauses for a few moments and then plays. It's already buffered those frames from the network, since you just played it, so why that pause? Because you've asked the decoder to jump to some arbitrary frame, the decoder has to redo all the calculations - starting from the nearest I-frames and adding up the motion vector deltas to the frame you're on - and this is computationally expensive, and hence the brief pause.
Uh, is that actually what's going on there? Because for some reason, seeking is basically instant when I'm playing locally-saved videos, including ones I downloaded directly from Youtube and didn't re-encode.
Actually, this is one of the reasons why I download videos before watching them, instead of using the normal Youtube player.
- sand500 7y agoIt might also be because youtube uses DASH?
- sp332 7y agoYeah. VLC for example doesn't have a frame-by-frame backward seek, because they argue it would blow up the memory consumption to keep all those frames around just in case you want to jump backward. And since videos are mostly hardware-decoded on the GPU these days, you'd be wasting all that memory in your VRAM. Here's one of many threads where Jean-Baptiste Kempf addresses the feature request. https://forum.videolan.org/viewtopic.php?p=390778&sid=1a571d0ef612114307fdd41229a6278f#p390778 https://forum.videolan.org/viewtopic.php?p=390778&sid=1a571d... The amount of pausing is going to vary a lot by video. If you have an I-frame followed by 250 P-frames, there will probably be a noticeable pause.
- Wowfunhappy 7y agoIt has been a long time since I used VLC—I generally use mpv on Windows and QuickTime X on Mac because I like their minimal UIs—but I remember it being instant too! Side note, using VRAM to make seeking instantaneous seems to me like a perfectly good use of resources, at least if my device has the VRAM to spare. On my desktop, I have a 1080 Ti, and it mostly sits idle when I'm watching a video...
- rossy 7y agoFor what it's worth, mpv lets you choose which style of seeking you want with the seekbarkeyframes OSC option. Leave it on (the default) and mpv will seek to the nearest keyframe when you click on the seekbar. Switch it off, and mpv will seek to the most recent prior keyframe and silently decode to the exact point you clicked on, so you should get that pause as mentioned in the article. Depending on how quickly your computer can decode video, it should still be pretty fast.
- Avamander 7y agoA counterexample, using VRAM on my desktop's Intel's iGPU seems like a waste of VRAM when it already barely manages to decode 1080p. It heavily depends if it's worth, and given most of the machines are on the lower end of performance the choice is sane right now.
- Wowfunhappy 7y agoYeah, that's why it ought to depend on how many resources are available.
- Jaruzel 7y agoYou may want to revisit VLC. It now has the option for you to run it with with minimal UI or even with no UI at all (just a video frame), and if you are brave enough you can also design a custom UI for it. The only thing I really don't like about VLC is the traffic cone icon, but I get that's their brand so I have to live with it.
- StavrosK 7y agoI'm another mpv user and I switched from VLC to mpv just because mpv is plain better than VLC. VLC would give me some slowdowns and would hang sometimes, whereas mpv has always played everything perfectly.
- stockavuryah 7y agoBut VLC has many many more options and possibilities, if you need it.
- userbinator 7y agoOn the other hand, VLC serves as a gentle reminder (or introduction) of how video compression works, every time you seek. ;-)
- gsich 7y agoIf it's not used otherwise it's not "wasted".
- osrec 7y agoYeah, I see whole bunch of additional network activity, suggesting that they redownloading something.
- wlesieutre 7y agoI mean, I only have 32 GB of RAM. Wouldn't want to waste any of that on letting videos rewind.
- mbell 7y ago1 minute of uncompressed 8bit 1080p60 video is ~20.86GB. Unless you also plan to recompress into jpg or something frame by frame your 32GB of RAM won't last long.
- Dylan16807 7y agoThe replacement for network activity is obviously the compressed format. So it's more like 50-100MB, and the vast majority of the time the disk can fit the playing video.
- vortico 7y agoWhen you click on Youtube's timeline, it seeks to the nearest I frame, not to the exact frame, so it avoids the problem altogether.
- cornstalks 7y agoIt depends on the player/platform, but generally the YouTube player does not avoid the problem altogether. There's more that goes into this, but you can experimentally verify this by playing with the seek bar in the browser. For me (on Chrome), it does a pretty good job at seeking to the time I requested, not to the nearest IDR-frame (which are usually a few seconds apart).
- cbhl 7y agoAnother "it doesn't instantly start playing from that timecode you just selected" is to jump to a nearby I-frame, and just start playback from there, instead of going exactly to the selected timecode. (How well this works depends on how frequent the I-frames are in your downloaded file. In the 90s it wasn't uncommon for I-frames to be minutes apart, but less so now.)
- jlawson 7y agoI've noticed my video player does this, but only when using the "5 seconds forward/back" arrow key commands. Tap the left arrow and you end up skipping back to the same moment over and over, even if you wait a bit. Interestingly, YouTube doesn't display this behavior. I find it kind of annoying, to be honest. Sometimes there are reasons I want to go exactly the same duration back/forward, every time.
- Mirioron 7y agoYou can even go forward and backward frame by frame on YouTube with the . and , keys.
- _bxg1 7y agoIt would also presumably have to load that full frame over the network, so maybe that's part of the difference.
- Wowfunhappy 7y agoThis is what I've always assumed was happening—but it's annoying! If I'm seeking backwards that means the frame has already been played once. Don't throw it away so quickly!
- _bxg1 7y agoWhat the article suggests is that it didn't throw away the frame, it simply never had the complete frame that you're seeking to because it was in-between full frames.
- Wowfunhappy 7y agoWhich should also happen if the video is being played locally, which is why I was confused. Either Youtube caches the video data, in which case seeking should be as fast as offline players, or Youtube discards the data, in which case it has to be downloaded again. It certainly seems to me like Youtube is discarding the data. I wish they didn't do that.
- deleted 7y ago[deleted]