Repository navigation
Description
When a video is being played back using media source, if the video is paused the OBS CPU usage spikes up from 8% to 20% while the video remains paused, then returns to 8% usage when the video is resumed. This problem is magnified if there are multiple video sources all playing back and being paused at the same time. For example, 2 media files being played back CPU usage is still 8% during playback, but spikes to 20% with one video paused and 34% usage with both videos paused. Each additional video that is paused adds 10-12% CPU wastage as overhead. Once any video is resumed normal CPU usage is restored for that video.
Platform
Operating system and version: Windows 10/x64 (1909)
OBS Studio version: 25.0.8, and tonight's nightly build as well
Expected Behavior
When pausing media playback, CPU usage should not increase.
Current Behavior
CPU usage increased by 10-14% of total CPU usage per paused media source video on my AMD FX8350. One video paused spikes CPU up from 8% to 20%, 2 videos spikes CPU up from 20% to 34%, etc.
Steps to Reproduce
- Add one or more H.264 movie files as OBS Media Source into a scene.
- Makes no difference whether you use software or hardware decoding of video, problem reproduced with both.
- Activate source so video is playing while looking at CPU usage in Task Manager on another monitor.
- Pause media playback of video using hotkey assigned to play/pause.
- Observe spike in CPU usage.
- Repeat with 2 or more media files playing simultaneously, then pause both and observe double CPU spike.
Additional information
I have tested this with OBS 25.0.8 and with the current nightly build. The attached log file is from a run that does have plugins present however, I've tested it with and without any other plugins and scripts loaded and the problem occurs without any 3rd party code present so it's not triggered by plugins or scripts. I'd be happy to provide a log file from a test run without the 3rd party stuff loaded as well if necessary.
Also tested 25.0.8 on my nVidia 1050Ti laptop and the same problem occurs there both with software and hardware video decode so the problem does not appear to be related to hardware.
Activity
skeletonbow commentedon Aug 2, 2020
Additional data for troubleshooting added from #development Discord chat: I have tested this with and without CPU frequency scaling enabled. Presently I am using the High Performance power management plan in Windows on the desktop system (FX8350) with CPU minimum and maximum set to 100% and confirm that the frequency is not changing at any level of system activity from quite idle to all 8 cores maxed out. I rebooted the computer after making the configuration change as well to ensure it was active.
I've re-tested 25.0.8 with this configuration and still see the 12%+ CPU usage increase on pause.
skeletonbow commentedon Aug 2, 2020
Same results with MP4/H264 and MKV/H264, if I can find other videos with different container/codec combinations I'll test them if it's useful also.
skeletonbow commentedon Aug 2, 2020
Hardware repro summary:
System 1: AMD FX8350 CPU, Radeon HD7850 GPU
Sysetm 2: Intel 7700HQ laptop CPU, nVidia 1050Ti GPU
media-playback: Wait on an event when paused
deps/media-playback: media message loop rewrite
/deps/media-playback: rewrite to use queue, states
/deps/media-playback: rewrite to use queue, states
/deps/media-playback: rewrite to use queue, states
/deps/media-playback: rewrite to use queue, states
/deps/media-playback: rewrite to use queue, states
/deps/media-playback: rewrite to use queue, states
/deps/media-playback: Rewrite to use queue, states
/deps/media-playback: Rewrite to use queue, states
/deps/media-playback: Rewrite to use queue, states
deps/media-playback: Rewrite to use queue and states
deps/media-playback: Rewrite to use queue and states
ogmkp commentedon Sep 8, 2020
Reproduced on OBS 25.0.8 and 26.0.0-rc1
Ubuntu 20.04.
PatTheMav commentedon Oct 8, 2022
I just tried to reproduce this on macOS - when pausing a media source, CPU usage goes down noticeably, also visible by profiling OBS and looking at the threads spawned by FFmpeg/x264:
Pausing the media playback is clearly visible by the gap of zero CPU usage. During this gap CPU usage of the graphics thread increases however - I'm still investigating if it's a specific call that takes longer when the sources are paused vs. them playing back.
RytoEX commentedon Oct 13, 2022
I'm not seeing this on Windows 10 with OBS Studio 28.0.3. Please retest this on OBS Studio 28.0.3 (or newer). If this is still an issue, then we can consider reopening this or opening a new Issue.