You are not logged in.

#1 2023-12-07 19:28:09

TheConfiguringNeverEnds
Member
Registered: 2021-08-06
Posts: 6

[SOLVED] Videos buffer when played from external HDD

I suppose that doesn't sound too strange when I put it like that, but let me explain.

I have an external USB HDD that I store footage on. Whenever the drive is near full (80% or so), videos played from this drive begin to hang and buffer (sometimes for several minutes at a time) mid-playback. The only thing I've been doing to remedy this is to simply move the footage to my local SSD before playing it, but this takes some time as this is a somewhat older HDD so it's still using USB 2.0. Moving 1 hour of 4K video across USB 2.0 is a nightmare, and ideally I'd like to do that only once I need the footage for editing, and only for the footage I'm actually gonna use. If I have to move every piece of footage across to my SSD just to play it smoothly and check if it's usable, then I inevitably end up wasting time moving footage I won't even use.

Since this only happens when the drive is near full, I suspected it was a fragmentation issue. The drive does use exFAT so it's certainly possible. But first I wanted to check if fragmentation was even an issue this drive was going through, so I looked around and found the fsck command. Running it on the partition in its near-full state reveals a strange result however:

$ sudo fsck -t exFAT /dev/sda1                                                                        
fsck from util-linux 2.39.2
exfatprogs version : 1.2.2
/dev/sda1: clean. directories 2509, files 17187

According to the article I found (the relevant portion talking about fsck is at the very bottom), and also this, I should expect to see something about "non-contiguous inodes" in the output if there is fragmentation, yet there is no such thing. Indeed, it even claims the partition is "clean".

Now that fragmentation's been ruled out (at least as far as I can see), I have no idea what else to try. The aforementioned article, before even mentioning fsck, suggests just backing up all the contents of the drive somewhere else, then moving them back. This is ridiculous. Even if I had a second drive to move them to (which I don't; my SSD is much smaller in capacity than my HDD and I have no other storage media to hand other than flash drives and SD cards) the round trip of moving all that 4K footage (and also some other miscellaneous things I have on there) from my old drive to the backup, and then back again, would be incredibly slow. I am aware defragmentation is slow too, but I would much rather sit through that than the snail's pace of USB 2.0. Not sure why, really.

Perhaps I haven't been thorough enough and defragging is still on the table? Any ideas?

Last edited by TheConfiguringNeverEnds (2023-12-08 13:59:45)

Offline

#2 2023-12-07 20:10:05

seth
Member
Registered: 2012-09-03
Posts: 53,405

Re: [SOLVED] Videos buffer when played from external HDD

Neither of the linked pages discusses exFat.
I'm not aware of *fat defrag tools in the posix world and neither seems SE: https://unix.stackexchange.com/question … inux-world

Now that fragmentation's been ruled out

I'd actually heavily rule it in, FAT isn't a real filesystem and *extremely* prone to fragmentation.

Moving 1 hour of 4K video across USB 2.0 is a nightmare

So, how many bps can you copy (when the drive is full) and at how many bps is the video encoded?

If you play from slow sources (typically network) you want a(n increased) cache, see eg. https://man.archlinux.org/man/extra/mpv/mpv.1.en#Cache

Offline

#3 2023-12-08 10:27:46

TheConfiguringNeverEnds
Member
Registered: 2021-08-06
Posts: 6

Re: [SOLVED] Videos buffer when played from external HDD

The --cache=yes option on mpv did do the trick, thanks for that. I suppose it's really more of a band-aid than an actual solution to the issue, but I'll take it. As for the bps of the transfer, I have no idea how to measure that. I can tell you though that these videos are encoded at 6.4 Mbps. I don't think I'll be investigating further really; the cache suggestion is working just fine.

Last edited by TheConfiguringNeverEnds (2023-12-08 10:28:01)

Offline

#4 2023-12-08 12:45:45

seth
Member
Registered: 2012-09-03
Posts: 53,405

Re: [SOLVED] Videos buffer when played from external HDD

https://wiki.archlinux.org/title/Benchmarking#dd

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB