Why does my computer experience CPU spikes when exporting video?

hyperfox_07
hyperfox_07 Website User Posts: 2 Just Starting Out

I am exporting H.264 1080p 24fps video, and during the first half, CPU usage stays at around 13% but spikes to 90%-100% every few seconds, slowing the whole computer down and exporting process drastically. Then, during the second half, CPU usage evens out at 100%, and everything runs more smoothly. My computer is not the best, but it takes 10 minutes to export a 3:30 minute video, which is completely unreasonable and is driving me insane. From looking at help forums, I know that the CPU and GPU work together in some way, so the exporting might be slowed down by a weak link. I just want to know if there's a possible solution to this problem.


Answers

  • Triem23
    Triem23 Moderator Moderator, Website User, Ambassador, Imerge Beta Tester, HitFilm Beta Tester Posts: 19,936 Ambassador

    Since your Screenshot shows your CPU and RAM won't have to ask full specs, but I will ask if you have a dedicated GPU, or just the Iris built into your CPU? If you do NOT have a dedicated GPU, as far as Hitfilm is concerned, you have a slow computer (the current Intel G7 Iris is only about three times the speed of the minimum spec Intel HD 5000. For comparison, my Nvidia 2060 (mobile) is over six times faster than the Iris.

    "I know that the CPU and GPU work together in some way..."

    This is incorrect. The CPU and GPU switch off in series - in general, while one is active, the other is idle. The CPU, in general, reads frames from drives, decodes video frames (this is GPU assisted for certain types of mp4), does audio mixing/effects, calculates particle physics (if any), and a few other tasks. While this happens the GPU is inactive. The GPU handles calculation and rendering of video frames. While this happens the CPU is inactive. The CPU handles writing output frames to the drive. While this happens, the GPU is inactive.

    If I had to guess, based on your use graph, I'd guess the beginning of your video has more layers, compositing and effects - titles, overlays, lower thirds, motions graphics, etc - while the back end of your video is more straight edited footage. That would account for the early "spikes..." Times when the GPU is comping more effects, vs just streaming frames.

    What drives are your source footage on and your output going to? You have an internal SSD and HDD. The SSD is a lot faster than an HDD. You're showing an external drive. If that's an HDD it's probably slower than the internal drive since it's shuttled through a USB bus. If an SSD that's likely slower than the internal for the same reason. Drive throughput also has an effect on things. Fortunately, 1080/24p is relatively easy (4k/60p would be 10 times the data), but drives do make a difference. HDDs are bottlenecks.

    Knowing more about your source footage will help. If your footage is from a phone or tablet it's definitely "Variable Frame Rate," (VFR) and, if it's from a screen capture - Windows Game Capture or default OBS settings - it's PROBABLY VFR. NLEs prefer "Constant Frame Rate" (CFR) footage. In brief, 24 fps CFR footage is always 24 fps. VFR "24 fps" footage is more "24, 25, 22, 20, 20, 24, 18, 25, 24, etc..." VFR footage slows things down. Basically, Hitfilm is constantly having to try and shove differing numbers of frames into a steady clock in real time, having to duplicate/skip frames "on the fly" (this can also cause other issues like audio drift). VFR issues are solved by using third party software to convert the VFR to CFR before editing.

    How long are your source clips? For a 3:30 edit this likely isn't an issue, but NLEs tend to prefer shorter source clips - a few seconds to 10-15 min - over long source clips, like 2-5 hour game sessions. You can speed up Hitfilm by using third party software to break long clips into shorter clips first (in the same step as a VFR/CFR transcode).

    Knowing more about the effects and compositing in your project would help. Some effects just take more time to render. If you have Composite Shots embedded on your Editor Timeline, pre-rendering those Comps will speed up the final render.

    "... it takes 10 minutes to export a 3:30 minute video, which is completely unreasonable..."

    Again, not necessarily. Lots of variables here including your hardware, source video format, number of effects, drives read/written to, etc. If I am doing something simple - basic video trims with minimal effects - my Ryzen 7 4800h/Nvidia 2060 (a machine significantly faster than an i71065g7) still takes about twice the video length (so a 7 minute render for a 3:30 video). Once things get complex - layered up animations, 3D models, particles, etc...) it's not uncommon to take 10 minutes to render a 30 second shot. I once had a 30 second shot take 48 hours to render, although that was an extreme example. Still, 10 minutes to render a 3:30 Timeline doesn't seem unreasonable.

  • hyperfox_07
    hyperfox_07 Website User Posts: 2 Just Starting Out
    I'm not exactly familiar with how CPUs and GPUs are laid out, but in the Task Manager GPU screen, GPU 0 says "Intel(R) Iris(R) Plus Graphics." GPU 1 is labeled "NVIDIA GeForce MX250." On GPU 1, there is an extra graph that GPU 0 does not have called "Dedicated GPU Memory Usage." I assume this is what you mean by dedicated GPU.
  • triforcefx
    triforcefx United StatesModerator, Website User Posts: 1,271 Moderator

    I’m surprised they bothered to put that MX250 in your system. Other than dedicated vRAM, the improvement over the Iris Plus graphics appears marginal at best.

    Without knowing the type of video you’re making (answering Triem’s questions above), we can’t know if there’s anything you can do to help performance. However, for that sort of system, having a render time that’s only about 3x the length of the output file seems about right.