ggarra13 / mrv2

Professional player and review tool for vfx, animation and computer graphics.
https://mrv2.sourceforge.io
BSD 3-Clause "New" or "Revised" License
197 stars 14 forks source link

Paused video is using %30 cpu of 24 threads constantly #166

Closed gerroon closed 8 months ago

gerroon commented 9 months ago

Please see the video. I paused the video, and you can see the activity

2 64 bits - v0.9.3 - Built Dec  6 2023 03:01:22
With msvc 1929
(C) 2022-Present Film Aura, LLC.
Gonzalo Garramuño & others

https://github.com/ggarra13/mrv2/assets/8519469/9e359310-407f-472b-8df6-d923143d08c2

ggarra13 commented 9 months ago

I cannot reproduce the problem.

Some questions:

1) Is it a video or a sequence? Do you have multiple clips loaded or just the one? With audio or without? 2) Resolution and bit depth of the clip? 3) Any chance you can upload the clip or portion of it privately (send a link to me at ggarra13@gmail.com)? 4) Also, I forgot, how are your Settings (F9 by default) set (Cache in Gb? etc). If your cache is too big, the movie will continue getting cached (and thus have a number of threads running) even if you stop it.

gerroon commented 9 months ago

I can upload the movie (downloaded from youtube) if you have a drive or a space for like 155mb

ggarra13 commented 9 months ago

I have the disk space. Feel free to upload it as long as you have the rights to it.

ggarra13 commented 9 months ago

@gerroon I did not get your email. Were you able to solve your issue?

gerroon commented 9 months ago

I do not have that much of email space unfortunately, I need a drop in url, I would be more than hhapy to send it othrwise.

ggarra13 commented 9 months ago

You should not send the actual file through email, but with a link. For example, register yourself in a drop site like https://mega.nz. Upload it there under your name. Select the file, with the right mouse button select Share Link (or similar). It will give you a long link. Copy it and paste it to an email sent to me. I will be able to access it and download it. There are similar services like dropbox or wetransfer, but I am not familiar with those. Do some Googling or ChatGPTing for more detailed help.

ggarra13 commented 9 months ago

BTW... How could you tell it was using 24 Threads? Task Manager does not show the thread count.

gerroon commented 8 months ago

https://ufile.io/lpuc072k

It always sues a lot of cpu, it also uses half the cpus whensaving a frame.

ggarra13 commented 8 months ago

I could not reproduce your issue, neither when stopping the frame nor when saving. Here's my cpu/memory/gpu usage when stopping a frame. I have 32GB of RAM, so my cache is set to 15GB. I show my settings in the video. You may need to adjust them as needed. Give me your computer specs (CPU, GPU, etc) and the Cache you are using in Settings (F9 by default).

https://mega.nz/file/KSIElSYK#nu_mYApFR0gj-zVkAwOARzUn8CqYe-nsvAcTtGPEq2I

P.S. I tried uploading the clip directly into github and while it loaded it properly and recognized it as a movie file, it would not play it right.

P.S.2. I also would like to know how you detected it was using 24 CPUs, as I don't know that about Windows.

gerroon commented 8 months ago

Interesting, whenever I open this video it starts using most of my cpus sometime after I open it. It does not happen right away but takes couple minutes. After like 5-10 mis it tames a bit, but the usage goes up when I am saving frames.

I load the video from SSD drive so load speed should be pretty good.

I have been using MRV for a long time, never had this type of high CPU usage. I will investigate the issue more.

My cache memory is already set very high. MrV2 is using like 27GB when this video is opened in it.

image

gerroon commented 8 months ago

Here I just tested it again, the cpu usage spiked after 5 mins. It has been stable using like %40+ CPUs for 5 mins and no playback is happening.

Btw I did not say it was using 24 threads, I said it was using some percentage of those 24 threads. Process Hacker is showing the percentage of total threads. Here it is using over %40.

https://github.com/ggarra13/mrv2/assets/8519469/30f2c96f-fb94-44ff-91f1-7ecbd390741b

ggarra13 commented 8 months ago

Some things for you to try to find the problem:

1) Try to set the cache in Gb to 0 only and use Read Ahead/Read Behind instead. Set Read Behind to a small number like 0.4 and Read Ahead to your heart's content (try something like 10 seconds). I modified the Read Behind setting on recent versions to scrub 4K videos better but that may have increased the thread usage.

I have been using MRV for a long have been using MRV for a long time, never had this type of high CPU usage

2) If you remember and have time to check, try to locate the version that did not exhibit the problem. Look them up in sourceforge or in github releases. That will help a LOT if you locate a version that does not have the problem. 3) I am not sure how much I trust the cpu, processes and thread usage in Process Hacker, to be honest. In my WinPro 11 system, it shows NT Kernel usage at 297 threads, explorer using 207 threads and the mrv2 executable as a child process of explorer.exe. Can you check the cpu/memory usage with Task Manager instead? 4) Does the actual thread/memory usage effect actually something on mrv2 (slow playback, going into swap space, etc)?

gerroon commented 8 months ago

Hi I will take a look at those.

4.) It definitely uses that many cores because my PC fans are going nuts when that happens.

ggarra13 commented 8 months ago

I was able to reproduce the issue on Linux too, so it is probably an issue common to all platforms. I will end up pushing the release of v1.0 until the issue can be addressed. I will be checking all versions previous versions until I find the problem.

gerroon commented 8 months ago

Hey thanks for being persistent about this issue. I know it was not easy to hit the bug right away.

ggarra13 commented 8 months ago

Okay. I have some clue of what might be happening. The resampling function from 48100 5:1 to 44100 Hz Stereo is sometimes misbehaving. I am now investigating if it is a misuse on Darby and mine part of the same or an FFmpeg bug in v6.0. On the meantime, I tested the original mrViewer and, at least with a good machine like yours, you can play it (I know, mrViewer's GUI sucks, but oh well...). Hopefully I'll have some news later this week.

ggarra13 commented 8 months ago

First, the issue on Linux. The pre-built binaries built on Rocky Linux 8.8 exhibit memory leaks when run on my Ubuntu 22.04.3 LTS box. If I run it on a Rocky Linux box, there's no leak. When I compile and run it on Ubuntu 22.04.3 LTS box, there's also no memory leak.

When I run it under a legal version of Windows 11 Pro, I also do not get any leaks or bad cpu usage.

Do not take the following the wrong way, just be honest when answering:

1) I understand that if you are coming from a non-developed country like mine you sometimes have to sacrifice paying for software to get the best hardware. Hopefully, you will learn that hurts software developers, as I learnt the hard way too.

2) You uploaded it to a service that does not keep the download anonymous, forcing me to enter a password. I used google chrome to generate a password. Please change to a service that does not require a password for downloading.

3) You sent me a portion of a movie file for the, I believe, one of the Star Wars tv series. Since you mention you downloaded it from youtube, and the movie name was imp.mkv.mov, it lead me to believe you used something like the latest version of youtube-dl, instead of subscribing to the YouTube Premium service to download the full movie/clips as that tool downloads the audio and video separately and then merges it. Technically, the metadata mentioned had HDR support (which mrv2 still does not read or handle) and it said, the handler name ISO Media file produced by Google Inc, so I could not verify its autenticity. Currently, the major studios are now they no longer are providing free trailers to download (which I think it is a mistake as it is a way to promote their movies, not steal them -- so everybody should win).

4) You mentioned you were using mrv2 v0.9.3, but the screen capture you showed of the Settings Panel, does not look like this:

image

and instead has the Read Behind is misaligned, which leads me to believe either your file associations are wrong and you are using an older version or something else is amiss.