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

High memory consumption with mpvpaper #97

Open
cr1ogen opened this issue Nov 11, 2024 · 24 comments
Open

High memory consumption with mpvpaper #97

cr1ogen opened this issue Nov 11, 2024 · 24 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@cr1ogen
Copy link

cr1ogen commented Nov 11, 2024

When I use Waypaper with mpvpaper, there is a high memory consumption with ffmpeg

241111_18-50-39

and with mpvpaper that when changing the wallpaper, the first wallpaper remains running in the background.

241111_18-52-53

@anufrievroman
Copy link
Owner

@CalfMoon would you take a look at this? I'm not very familiar with mpvpaper, but it definitely shouldn't keep running previous wallpapers.

@CalfMoon
Copy link
Contributor

CalfMoon commented Nov 12, 2024

In my computer ramusage never exceeded 400mb. which is also high but it might be because mpvpaper runs mpv in the background. Maybe 700mb is a resolution thing? how big is your monitor?
And multiple process only seemed to form when the pictures are clicked multiple times rapidly which i think is because the previous process don't get enough time to get killed. The problem seemed to slightly decrease when the value of time.sleep() was increased. Maybe that is the problem.
And I don't really know what ffmpeg is doing there.
Im not really super proficient in python, and right now I don't have much free time so I'm sorry but someone else will have to take a closer look at it.

@cr1ogen
Copy link
Author

cr1ogen commented Nov 13, 2024

Yes, I have a 4k monitor and I have no problems with the 700mb size. I was trying standalone mpvpaper and I don't get any ffmpeg logs in Bpytop like when I use it with Waypaper. I also tried changing the wallpaper with a time difference and the old one keeps working below the new one.

@anufrievroman
Copy link
Owner

It might be related to the thumbnail generation process, which should be over once you see the previews of the videos, but who knows. Could you try to click Refresh in the UI and see if that causes even more usage?

@anufrievroman
Copy link
Owner

@CalfMoon okay, I'll take a closer look before publishing it officially. But one small question, when you wrote:

subprocess.Popen(["killall", ".mpvpaper-wrapp"])

why is it ".mpvpaper-wrapp" and not just "mpvpaper" ?

@cr1ogen
Copy link
Author

cr1ogen commented Nov 14, 2024

It might be related to the thumbnail generation process, which should be over once you see the previews of the videos, but who knows. Could you try to click Refresh in the UI and see if that causes even more usage?

I clicked Refresh in the UI and it doesn't cause any more use

@anufrievroman
Copy link
Owner

anufrievroman commented Nov 14, 2024

I clicked Refresh in the UI and it doesn't cause any more use

Okay, that's a good news. Thank you

@anufrievroman
Copy link
Owner

I also can confirm that previous processes are not killed because:

.mpvpaper-wrapp: no process found

@cr1ogen
Copy link
Author

cr1ogen commented Nov 14, 2024

I clicked Refresh in the UI and it doesn't cause any more use

Okay, that's a good news. Thank you

Thank you for this great work

@CalfMoon
Copy link
Contributor

I decided to use .mpvpaper-wrapp because the opposite happened in my computer, it detected .mpvpaper-wrapp but but not mpvpaper.
I have no idea why it would be different for different systems.

@anufrievroman
Copy link
Owner

@cr1ogen hi, I reimplemented launching things in mpvpaper, if you have time, please test the current main branch, thanks

@cr1ogen
Copy link
Author

cr1ogen commented Nov 16, 2024

@cr1ogen hi, I reimplemented launching things in mpvpaper, if you have time, please test the current main branch, thanks

Hello, the mpvpaper stop button works, but now in order to change the background, I have to stop mpvpaper otherwise it does not change the background

@anufrievroman
Copy link
Owner

Does this happen for you all the time? I mean, I know there are certain situation, for example, when you set one monitor, and then All, and and then you try to set first monitor again, but it is now behind the running mpvprocess for all monitors (so it changes but it's not visible). So, you must stop (kill) all processes with Stop, and then start from the fresh layer stack. But if you only change it just for one monitor with All, it is supposed to work without Stopping.

@cr1ogen
Copy link
Author

cr1ogen commented Nov 17, 2024

Does this happen for you all the time? I mean, I know there are certain situation, for example, when you set one monitor, and then All, and and then you try to set first monitor again, but it is now behind the running mpvprocess for all monitors (so it changes but it's not visible). So, you must stop (kill) all processes with Stop, and then start from the fresh layer stack. But if you only change it just for one monitor with All, it is supposed to work without Stopping.

Yes, I only have one monitor

@anufrievroman
Copy link
Owner

I see, this is strange. Okay, I just released the version 2.4, if you have time, could you uninstall all previous versions and try with this new version? If the problem persists, a few questions:

  • What is you distribution and window manager?
  • Does the original issue with high memory consumption still exist?
  • Could you check your /tmp/ folder and tell if there are files called mpv-socket-... ? (try to delete them and restart the program).

@anufrievroman
Copy link
Owner

By the way, I could also reproduce very high CPU and memory consumption when I try to play 4k videos, but that's unfortunately how mpv plays it, nothing we can do here. For smaller videos, it's more reasonable.

@cr1ogen
Copy link
Author

cr1ogen commented Nov 17, 2024

I see, this is strange. Okay, I just released the version 2.4, if you have time, could you uninstall all previous versions and try with this new version? If the problem persists, a few questions:

* What is you distribution and window manager?

* Does the original issue with high memory consumption still exist?

* Could you check your `/tmp/` folder and tell if there are files called mpv-socket-... ? (try to delete them and restart the program).

I use Debian, mpvpaper from git and use qtile
The original issue still persistis
i have mpv-socket and when i delete, when starting program is created again

@cr1ogen
Copy link
Author

cr1ogen commented Nov 17, 2024

By the way, I could also reproduce very high CPU and memory consumption when I try to play 4k videos, but that's unfortunately how mpv plays it, nothing we can do here. For smaller videos, it's more reasonable.

ok, no problem

@anufrievroman
Copy link
Owner

I use Debian, mpvpaper from git and use qtile

But that's with Wayland, right?

So, now, beside the high resource consumption (which seems normal with mpv), the main problem that you can't just switch to the new video, you must Stop if first (essentially kill the mpvpaper process) and then choose a new one? One possible reason might be that you need socat to be installed. I thought it's everywhere by default, but please check if it's there...

@cr1ogen
Copy link
Author

cr1ogen commented Nov 18, 2024

I use Debian, mpvpaper from git and use qtile

But that's with Wayland, right?

So, now, beside the high resource consumption (which seems normal with mpv), the main problem that you can't just switch to the new video, you must Stop if first (essentially kill the mpvpaper process) and then choose a new one? One possible reason might be that you need socat to be installed. I thought it's everywhere by default, but please check if it's there...

Yes it is Wayland, I installed socat which was not installed in Debian and now I can change wallpaper without stopping mpvpaper.
Now, the high memory consumption is not due to the wallpaper, it is due to a ffmpeg process that appears when changing the background, which I don't know why it appears and if I use mpvpaper by itself, it doesn't

@anufrievroman
Copy link
Owner

Good, at least that problem is fixed.

The ffmpeg is used in waypaper only to cache images (at least explicitly), so once you see the thumbnails, there should be no ffmpeg process left. I'll try to reproduce it...

@anufrievroman
Copy link
Owner

To be honest, I couldn't really see any ffmpeg processes in my system, so it's very hard for me to say what might be wrong. If you have time, maybe you can try to see if, for example:

  1. ffmpeg processes multiply when you change the video wallpaper?
  2. Do they appear if you set a static image wallpaper with mpvpaper backend?
  3. Perhaps there are some details about these processes, like, what is the full argument that is partly hiddedn in the screenshot above?
  4. Do they appear for any kind of video?
  5. Do they appear for specific fill types? (maybe they are needed to cut the video for the monitor ratio?)

@cr1ogen
Copy link
Author

cr1ogen commented Nov 23, 2024

To be honest, I couldn't really see any ffmpeg processes in my system, so it's very hard for me to say what might be wrong. If you have time, maybe you can try to see if, for example:

1. ffmpeg processes multiply when you change the video wallpaper?

2. Do they appear if you set a static image wallpaper with mpvpaper backend?

3. Perhaps there are some details about these processes, like, what is the full argument that is partly hiddedn in the screenshot above?

4. Do they appear for any kind of video?

5. Do they appear for specific fill types? (maybe they are needed to cut the video for the monitor ratio?)
  1. Yes
  2. No
  3. ffmpeg -nostdin -loglevel error -i /tmp/magik-FVzaZqvY_WsWRdoUW_oZsstAxUEG7rEv -an -f rawvodep -y -vcodec webp -lossless 1 /tmp/magik-dR_FNwppbAePoJAutSYGQF_RE9Bm2Wjd
  4. I tried with mp4, mkv and webm and it only doesn't work with webm
  5. appears in all fillings

@anufrievroman anufrievroman added bug Something isn't working help wanted Extra attention is needed labels Dec 20, 2024
@anufrievroman
Copy link
Owner

As I still couldn't reproduce it, if someone else experiences it, please let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants