Attract-Mode Support Forum

Attract-Mode Support => General => Topic started by: UnknownFigure on December 03, 2018, 01:09:29 PM

Title: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 03, 2018, 01:09:29 PM
I'm having serious problems with the cpu usage while displaying videos. Which video decoder should I use? dxva2 or software? Is there any bugged option I should turn off to improve cpu usage?

Just finished with the Sega collection, and I didn't notice the cpu usage. Videos start lagging after several minutes, even freezing the front end. What should I do?
Title: Re: CPU Usage 100%!! PC User
Post by: rand0m on December 03, 2018, 03:50:53 PM
1- Video decoder: Hardware is better then software but you will need to either compile AM or use XP version which comes with hardware support.
2- Videos with 30 FPS put less strain on system then videos with 60 FPS.
3- 360p likewise are better then 480p for performance
4- You can use a trigger like end navigation so video only loads when you stop scrolling the list. This might solve the problem of CPU usage increasing in consistent manner.

That said if your CPU usage keeps on increasing then it might probably be something related to layout. Try some default layout and use videos instead of snaps to ensure its not the layout.  I'm presuming you are on PC.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 04, 2018, 12:48:04 AM
How do you activate the hardware support on XP? Do you have to turn on dxva2? I'm not on the Xp operating system, but I think it'll work.

Could you explain the end navigation trigger? How do you activate this?

I'm a computer user, yes. Right now, I'm using the cosmos theme. Thanks in advance.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 04, 2018, 03:24:47 AM
Even with the default theme, the snap videos are leaving my CPU usage at 100%. To name a few things, I changed Attract Mode's main folder to simply Attract. Also I did some modifications to the theme per si, mainly replaced a system video.

Heard that conflict may appear if names have been changed or something. The front end loops searching and overloads resources.
Title: Re: CPU Usage 100%!! PC User
Post by: rand0m on December 04, 2018, 06:17:37 AM
You can download the XP hardware supported version from here> http://attractmode.org/download.html [Attract-Mode 2.5.1 (FFmpeg 3.4)]. To change video decoder go to options, General > Video Decoder. I checked and Cosmo theme is already using the trigger "Transition.EndNavigation". Going through the Cosmo thread the author suggests the following
Quote
The main menu eats video ram like crazy. To improve perfomance it's advised to disable animations or artwork. A bit of overclock can help.
System menu should work better as it doesn't have to change the 720p background with each selection, but you can disable animations and use  .jpg artworks instead of heavier .png

Changing the name of attract-mode folder might break some layouts if paths are absolute. It would be better to start fresh with the XP version and see how it effects the cpu usage with/ without videos on default layout. Have you tried running the videos in media player?
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 04, 2018, 06:53:57 AM
Thanks for the help man.

I tried the windows XP version, without changing the folder name, only adding the video, rom and emulator. Only decoding options I have are dxva2 and software. dxva2 seems to reach 100% quite fast.

Is dxva2 the name of the decoder? I've read something about having another option called mmal, but I don't have it in the XP release.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 05, 2018, 02:01:04 AM
Need some help. What do you have to do to get the mmal option for the video decoder on the Windows XP version of Attract Mode? Only got dxva2 and software.

Do I need to download anything?
Title: Re: CPU Usage 100%!! PC User
Post by: toothlessgrinn on December 05, 2018, 01:26:15 PM
this should not be happening... i mean well first is this on a home computer, is it dedicated to attract mode or what? second you might have other stuff running in the background. i spent over a year building my 4 player cab using win 7 and i have 0 issues. if your machine is dedicated to attract mode ill gladly share the info i have. (arcade,daphne,nes,snes,atari2600. is what im running.) also whats your hardware specs?
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 05, 2018, 10:22:02 PM
this should not be happening... i mean well first is this on a home computer, is it dedicated to attract mode or what? second you might have other stuff running in the background. i spent over a year building my 4 player cab using win 7 and i have 0 issues. if your machine is dedicated to attract mode ill gladly share the info i have. (arcade,daphne,nes,snes,atari2600. is what im running.) also whats your hardware specs?

Nothing running on my background, I'm a msconfig maniac. Intel Core 2 Duo E6850 (Best Dual Core on the Market), it's running pretty much everything nowadays., 4 gb of 800Mhz ddr2, a Nvidia GPU special edition OC 2GB GDDR5 and two brand new components, a SSD of 120GB, and a 2 Tetra HHD.

I suppose you're using the Windows Xp version of Attract Mode, which has the mmal option (Hardware video decoder). Problem is, I don't have that option. DO I need to download and install ffmpeg to have this option show up in the video decoder setting?

By checking the forums, several people are having the same problem. Some of them solved it without mentioning the process, others simply left the front end.
Title: Re: CPU Usage 100%!! PC User
Post by: rand0m on December 06, 2018, 06:55:30 AM
AFAIK MMAL is a Raspberry Pi specific thing so won't work on Win machine. MMAL > https://github.com/techyian/MMALSharp/wiki/What-is-MMAL%3F

Only thing which comes to mind is that videos are not properly encoded (and EmuMovies does have this problem with some system video-packs)

Title: Re: CPU Usage 100%!! PC User
Post by: toothlessgrinn on December 06, 2018, 07:21:27 AM
UnknownFigure   i sent you a pm.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 06, 2018, 08:32:47 AM
AFAIK MMAL is a Raspberry Pi specific thing so won't work on Win machine. MMAL > https://github.com/techyian/MMALSharp/wiki/What-is-MMAL%3F

Only thing which comes to mind is that videos are not properly encoded (and EmuMovies does have this problem with some system video-packs)

This doesn't make any sense. How can mmal be a specific thing for Rasp, when the XP version of Attract Mode has hardware support by ffmpeg 3.4?
Title: Re: CPU Usage 100%!! PC User
Post by: rand0m on December 07, 2018, 01:33:00 AM
The link suggests its designed for a gpu built into r-pi. Perhaps someone with both a win-pc and pi could reflect on it. I have never used pi so not familiar with that.
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 07, 2018, 02:04:38 PM
This is a known issue that on some configurations ( like mine for example ) the software video decoder tanks the CPU and the hardware decoder does not work at all.
This is what I did a while back. I reencapsulated (not reencoded) all my mp4 into the avi containers and the CPU usage went down.

I just downloaded the ffmpeg encoder and run the following batch command
Code: [Select]
for %%a in ("mp4\*.mp4") do ffmpeg -i "%%a" -map 0:0 -vcodec copy -map 0:1? -acodec copy -f avi "avi\%%~na.mp4"
This batch encapsulates all files found in the mp4 folder and saves them as avi with mp4 extension into the avi folder.

Also if you are on Windows 10 with nVidia gpu make sure you have disabled the Threaded Optimization, and set the compatibility of attract.exe to Windows 8
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 08, 2018, 10:31:17 AM
Oomek, your AM is on windows, right? Not rasp..

If so, could you explain a bit more? When you install/extract ffmpeg (From ffmpeg.org?), the folder itself contains a mp4/avi folder. So I need to transfer all my videos to those folders, and run the batch command.

Does this process take that long? Also, could you tell me how much it went down?
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 08, 2018, 10:36:11 AM
I'm on Windows 10. You just extract ffmpeg.exe make 2 folders mp4 and avi. Then you copy or move your mp4 files to the mp4 folder. Make a bat file and paste the line from my post and add "pause" in the 2nd line. So now you should have 2 folders, ffmpeg.exe and a convert.bat in the directory. Doubleclick the bat and let the magic happen.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 08, 2018, 10:40:12 AM
I'm on Windows 10. You just extract ffmpeg.exe make 2 folders mp4 and avi. Then you copy or move your mp4 files to the mp4 folder. Make a bat file and paste the line from my post and add "pause" in the 2nd line. So now you should have 2 folders, ffmpeg.exe and a convert.bat in the directory. Doubleclick the bat and let the magic happen.

I'll try this as soon as possible. Thanks!
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 08, 2018, 10:44:36 AM
It's not a problem. The only problem there is, is that we still can't find a solution for this excessive cpu consumption and we have to rely on workarounds.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 10, 2018, 11:35:06 PM
It looks like it solved the constant 100% usage, but it still reaches those limits when you're spinning the wheels, mainly due to starting each video, which results in 100% usage. Displaying the video usually takes around 80% or so.

Is this actually normal? What sort of cpu usage do you people have? My Attract Mode without videos is 50%.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 10, 2018, 11:45:29 PM
I've just been told by a few people, that their cpu usage runs between 25 and 40 while displaying videos. Something doesn't make sense here. If it's a problem with the Video Decoder (No Hardware Option), then all the people would be having the same problem. But that's not the case. Most computer users are not experiencing any problems at all, while others are.
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 11, 2018, 02:14:56 AM
If you have nvidia card disable Threaded Optimization just for attract mode in nvidia control panel. This will reduce cpu usage by 25%. Another 25% can be reduced by forcing Buffer-flipping mode to ON in nVidia Profile Inspector also just for AM. This last option will disable double/triplebuffering though, so AM will be more prone to stuttering on artwork reloading

With those 2 flags on and with mp4 in avi containers I get around 5% of CPU usage, with spikes at around 11% on reloading ( can't tell exactly as my cpu is downclocking )

And one more thing, just in case. Make sure you disabled Focus Assist in Windows 10.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 11, 2018, 03:14:38 AM
Doesn't work, Oomek. I get the same results.

Only 5% of Cpu usage?! This clearly shows something is not right here.

Oomek, is this the latest release of Attract Mode or are you using a specific version? 
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 11, 2018, 03:31:18 AM
I did my test on 2.5.1. Please make sure your nv profile has correctly bound exe in the nvidia inspector
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 11, 2018, 04:17:53 AM
I'm uploading a video showing how all that what I mentioned affects my CPU usage.

https://youtu.be/dMttc8KL-kg
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 11, 2018, 09:54:17 AM
Sadly, I get the same results.

But I've noticed a few things. The default Basic and Reflect layouts, without snaps, are at 1% of Cpu usage (Yes!). With snaps, they're around 44 to 55%. All other layouts with snaps, 100%. All this without avi containers.

So, for all the other layouts, it's 50% layout 50% snap. But here's the strange thing, Orbit is always at 100%, yet it is as simple as Basic or Reflect.

In any case, thanks for the help, Oomek. I'll either have to try another front end, or wait for the lead designer to release a build with Video Decoding by Hardware.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 12, 2018, 12:07:58 AM
I've SOOLVEEDD IT!! YEEEESSHHH! Finally! Heh!

Oomek! Forget the threaded and buffer-flipping mode! Turn those to their previous setting. Now you'll still have to do the ffmpeg process that you told me before (Thanks AGAIN!).

Execute Attract Mode, and to each display layout, including the main menu, turn off the Static Monitor Effect. On the Cosmos theme, which is very demanding, i'm getting 18 to 44%, being 44% the video reload. On any other theme, you'll get 5 to 10%.

Don't ask me why, but it works. Give it a try, please.

 
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 12, 2018, 12:29:31 AM
Great news. Could you elaborate a bit more please about that static monitor effect? I'm not entirely sure what are you referring to. You were trying default themes right?
Regarding the threaded optimizations, it should be set to off anyway for nvidia cards as it slows down the transitions and introduce more stuttering. I wanted to set this off by default, but I need to figure out how to make the nvapi.dll calls to compile under MinGW as it seems that this api is not multiplatform.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 12, 2018, 12:53:15 AM
Go to Settings section, and select Displays. Now, you'll have to do this to each display you have, even the main menu. Select the display and go to Layout Options. In here, you'll find Enable Monitor Static Effect turned on by default, turn it off.

I've been using the Cosmos theme, which is quite demanding. Cosmos theme, without snaps or boxart/cartart, is around 15 to 40% or so. Well, with snaps and boxart/cartart, it doesn't change, same cpu usage.

On the default themes, Basic, Reflect, Attract, etc.. You'll get 5 to 10% of cpu usage with snaps, same without snaps.

In terms of threaded optimizations, there is no difference for me. I tried it, and it's even worse, constant 100%. If you have several threads, I think you should leave this option to Auto.
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 12, 2018, 12:56:00 AM
On what default theme you have 100% of CPU usage with threaded optimizations set to off?
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 12, 2018, 12:57:01 AM
Mostly all of them, but Basic and Reflect seem to work fine.
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 12, 2018, 01:35:02 AM
I know what is going on here. Two things:

Static effect is also a video. Try to encapsulete the static.mp4 in AVI container (or any other mp4 that sits inside the theme folder of your choice) as it seems to be the cause of 100% CPU usage.

When you test themes make sure you distinguish two types:
- Ones that redraw on each frame and maintain 60fps
- Ones that redraw only on transitions, they redraw only at the currently played video fps

The first group is what you should focus on as it's the most affected by the threaded optimization flag set to auto.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 12, 2018, 02:04:05 AM
I didn't bother to do that, Oomek. I mean, encapsulating it is a great idea, but cpu usage increases a tiny bit (perhaps 5%) if you turn on the static effect. I just turned it off, less cpu usage. I don't really know why I should leave it on. It's supposed to be the effect you get when you don't have a certain snap of the rom per si, right?

Better to leave it off. Yea.
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 12, 2018, 02:07:43 AM
It's just a workaround until we figure out what is the cause of ffmpeg decoder consuming too much CPU on certain configurations.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 12, 2018, 02:09:47 AM
Thanks again, man. Really appreciate your help with the ffmpeg stuff.
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 15, 2018, 06:54:00 PM
Fixed in https://github.com/mickelson/attract/pull/520
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 17, 2018, 02:30:55 AM
What's this?
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 17, 2018, 02:31:33 AM
I'll have to check this out.
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 17, 2018, 02:49:37 AM
This is a fix for excessive cpu usage while playing videos.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 18, 2018, 01:40:38 AM
Oomek, could you care to explain a bit more on this?

Do I have to copy all this to my config? So by using this, we don't need to encapsulate anymore? I wanna check this with the cosmos theme.
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on December 18, 2018, 04:37:48 AM
What you see in the link is a pull request with my commit that fixes the Attract Mode high CPU usage. You don't need to do anything but just wait for the next AM iteration of course if Andrew approves, merges and recompiles AM with my fix in it.
Title: Re: CPU Usage 100%!! PC User
Post by: mgerety on December 18, 2018, 06:34:40 AM
SWEET.   I might grab the source and compile this myself if this doesn't get in a new build in the next day or so.  This issue had originally turned me off to Attract Mode, the crazy high CPU usage.   I've decided to come back because of the community and some themes designed for 240p.  If the CPU usage is under control, I'm all in.
Title: Re: CPU Usage 100%!! PC User
Post by: UnknownFigure on December 18, 2018, 08:09:33 AM
Understood. We'll have to wait and see.
Title: Re: CPU Usage 100%!! PC User
Post by: Oomek on January 01, 2019, 04:26:09 AM
The fix has been merged into master

https://github.com/mickelson/attract/commit/2ccc9597a3eb370e4fe31f249704f9ff8675f7a1
Title: Re: CPU Usage 100%!! PC User
Post by: zpaolo11x on January 01, 2019, 04:30:22 AM
The fix has been merged into master

https://github.com/mickelson/attract/commit/2ccc9597a3eb370e4fe31f249704f9ff8675f7a1

Good to know that even video playback resume issues are fixed, great work!
Title: Re: CPU Usage 100%!! PC User
Post by: TurnBasedStrategy on January 07, 2019, 10:43:58 PM
Thanks, Oomek. Really appreciate this.

Do we have to wait for another build release?