Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge memory usage even on small files #3

Closed
devenreilly opened this issue Apr 29, 2022 · 7 comments
Closed

Huge memory usage even on small files #3

devenreilly opened this issue Apr 29, 2022 · 7 comments
Labels

Comments

@devenreilly
Copy link

devenreilly commented Apr 29, 2022

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

@PaulleDemon
Copy link
Owner

@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

@CrimsonKnee
Copy link

CrimsonKnee commented Apr 30, 2022

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.

@PaulleDemon PaulleDemon added the help wanted Extra attention is needed label Apr 30, 2022
@PaulleDemon
Copy link
Owner

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

@PaulleDemon
Copy link
Owner

PaulleDemon commented Apr 30, 2022

@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.

@PaulleDemon
Copy link
Owner

@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

@PaulleDemon PaulleDemon added Fixed and removed help wanted Extra attention is needed labels May 2, 2022
@CrimsonKnee
Copy link

CrimsonKnee commented May 2, 2022

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.

@PaulleDemon
Copy link
Owner

PaulleDemon commented May 2, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants