Closed devenreilly closed 2 years ago
@devenreilly can you let me know how you tested the memory size? Cause when I tested for a file of 37.1Mb I get a memory size of less than an Mb, this, of course, would depend on the duration of the video, which was about 14 seconds in my case.
Can you specify the duration of the video and how you tested the memory size so I can take a look? Thank you
I can report the same issue. On a 15 second, 1.9 Mb mp4, I was having my app pulling over 3 Gb of memory. I checked by looking at the memory usage in Task Manager.
will work on this issue, Currently, I have two ideas, one is to read the frames directly from the disk and display the frames, the second is to allow users to define a set memory size beyond which the frames start popping from the beginning of the list.
If anyone has any other ideas or wants to contribute please let me know. Thank you
@CrimsonKnee @devenreilly Thank you for the report, I have found the solution, and will try to update within 48 hrs, Thank you for your patience.
If you are in immediate need of the library you can use the code from the resoucereducer branch. Do note that it's not complete yet. It can only play video as of now without eating up your memory, will add the ability to seek frames, and play frames at the correct frame rate soon.
@CrimsonKnee and @devenreilly The library has been successfully updated, Now even for large video files such as 1.5 GB it takes up less than 100Mb of memory. I would be glad if you can test the latest version 2.0.0 - https://pypi.org/project/tkvideoplayer/
If you find any issues please inform me under the same thread, if you find none just let me know so that I can close the issue
The memory usage is fixed for me with 2.0.0 Used approximately 100 Mb for the same file I reported with. A side note though, I'd hoped this would help with the slowness of playback for full screen videos, but I'm guessing that's more of a fundamental issue with tkinter than anything.
@CrimsonKnee Thank you for taking the time to test the updated version. The new implementation eliminates the need for frames to be stored in the memory, This time we are directly reading it from the disk and displaying it as we read it, So I am guessing that even the disk read speed affects the playback speed.
If you have any ideas to improve let me know. I'll try to add it.
I am using python3.9 on OSX 12.0.1 Monterey. Tcl/Tk 8.6. Loading even a small 8.0Mb file results in over a GB of memory allocated