po5 / thumbfast

High-performance on-the-fly thumbnailer script for mpv
Mozilla Public License 2.0
758 stars 34 forks source link

Add from_memory option #92

Open po5 opened 1 year ago

po5 commented 1 year ago

Tried out mpv-thumbPreview's idea of getting the memory address of a string through ffi, and using it in overlay-add.

Peak check_new_thumb went from 161 to 535 microseconds, draw from 158 to 492 microseconds.
So not helping in the speed department but not too awful either.
I've had the player crash once with it. Could be because I am constantly overwriting the value, and Lua may be getting rid of the data at the old address too quickly.
That aside, the benefit would be that we probably can't get into a situation where our data is overwritten while trying to display it?

I don't have much faith in this approach, just a curiosity.

hooke007 commented 1 year ago

Maybe it could help those dying disks?

hooke007 commented 1 year ago

I've had the player crash once with it.

Unfortunately, it would always crash in my side. Have no idea how to make it work.


Also, this version could not use direct_io Snipaste_2023-05-13_08-05-07

po5 commented 1 year ago

Maybe it could help those dying disks?

Sadly it couldn't, we still write out every thumbnail to a file, and we read it at least once.
Maybe if we switched to a spammy 1 process per thunbnail like the original thumbnail script we can use stdout to skip the disk, but then you're putting a lot more strain on whatever disk has your video.

Will fix the direct_io issue when I wake up, thanks.