Skip to content

Pausing Media Source video playback causes 10-12% CPU spike per-source during pause. #3235

Closed

Description

@skeletonbow

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.

https://obsproject.com/logs/Q6Zyx5vf2-IpQYry

Steps to Reproduce

  1. Add one or more H.264 movie files as OBS Media Source into a scene.
  2. Makes no difference whether you use software or hardware decoding of video, problem reproduced with both.
  3. Activate source so video is playing while looking at CPU usage in Task Manager on another monitor.
  4. Pause media playback of video using hotkey assigned to play/pause.
  5. Observe spike in CPU usage.
  6. 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

  1. skeletonbow commented on Aug 2, 2020

    @skeletonbow
    ContributorAuthor

    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.

  2. skeletonbow commented on Aug 2, 2020

    @skeletonbow
    ContributorAuthor

    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.

  3. skeletonbow commented on Aug 2, 2020

    @skeletonbow
    ContributorAuthor

    Hardware repro summary:
    System 1: AMD FX8350 CPU, Radeon HD7850 GPU
    Sysetm 2: Intel 7700HQ laptop CPU, nVidia 1050Ti GPU

  4. added
    issue/confirmed
    on Aug 2, 2020
  5. added 12 commits that reference this issue on Aug 7, 2020
    9c6431f
    a7adf35
    7784ef9
    806c19e
    a313512
    392fc7c
    8e4824e
    7b29569
    dba2adf
    994e5c0
    a68b5c4
    a3a9d97
  6. ogmkp commented on Sep 8, 2020

    @ogmkp

    Reproduced on OBS 25.0.8 and 26.0.0-rc1
    Ubuntu 20.04.

  7. PatTheMav commented on Oct 8, 2022

    @PatTheMav
    Member

    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:

    2022-10-08_OBS_playback_trace

    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.

  8. RytoEX commented on Oct 13, 2022

    @RytoEX
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions