This might not be possible at all but I can't get my head around it, not really mathematically minded.
A 3D printer spool obviously depletes as it is used. Knowing the diameter of the filament, the speed of the extruder, the width of the spool, and the diameter of the core. Could you determine the remaining filament based on the time it takes to do a 360 rotation at the core?