Skip to content

obs-ffmpeg: Fix bug with last frame showing on video restart - #11881

Open
Poodmund wants to merge 2 commits into
obsproject:masterfrom
Poodmund:obs-ffmpeg-video-restart-bug-fix
Open

Poodmund wants to merge 2 commits into
obsproject:masterfrom
Poodmund:obs-ffmpeg-video-restart-bug-fix

Conversation

@Poodmund

@Poodmund Poodmund commented Feb 19, 2025 •

Copy link
Copy Markdown

Description

When a video source is activated it appears that the last cached frame is shown before the video playback is restarted. This commit should resolve the issues #2906 and #4667. This issue occurs mainly when the the video source properties have "Show nothing when playback ends" unticked as the video will persist upon ending, then if you deactivate and reactivate the source, you'll see the last frame appear before the video restarts.

The bugged state is shown here: https://www.youtube.com/watch?v=Up3L_4YepRQ
This fixed state, with the changes, is shown here: https://www.youtube.com/watch?v=gjyV74gqOFI

To reproduce the bug in OBS v31.0, add a video media source that has an obvious, and distinct final frame compared to the first frame, activate the source and play the video, when it ends, deactivate the source, activate it and restart the video. The last frame will appear as the initial frame before the video continues to play.

Motivation and Context

It should resolve #2906 and #4667

How Has This Been Tested?

I've tested this by compiling against the current master branch with the proposed changes and activated/deactivated video sources with the multiple properties ticked and unticked. See video linked in the 'Description' above.

Hardware & OS Versions: Asus ROG Maximus XI Hero MB, i9-9900KS, 32GB RAM, RTX 3070, Win11 24H2

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@SimonGZ

SimonGZ commented Feb 22, 2025

Copy link
Copy Markdown

I don't claim to know a ton about OBS pull requests and merge etiquette, but I'll comment here that as someone who has been frustrated by this bug for a long time, I've tried this change on my Mac and it's a huge improvement.

In my ideal world, the first frame would preload in some way because I can still see a fraction of a second where the scene loads and then the media source pops in a moment afterward, but this fix is much better than the current behavior. It's much less distracting now because the media source starts at the beginning rather than flashing the last frame of the video then jerking back to the beginning.

@WizardCM WizardCM added the kind/bug Categorizes issue or PR as related to a bug. label Feb 22, 2025

@WizardCM WizardCM left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash your commits (via force push), and ensure the commit description wraps correctly (check contributing guidelines).

@WizardCM WizardCM added the Seeking Testers Build artifacts on CI label Feb 23, 2025
When a video source is activated, and played, the last cached frame is
shown before the video playback is restarted. This issue occurs mainly
when the the video source properties have "Show nothing when playback
ends" unticked as the video will persist upon ending, then if you
deactivate and reactivate the source, you'll see the last frame appear
before the video restarts. This change fixes that issue so that when
a video source is activated, it plays from the first frame.
@Poodmund
Poodmund force-pushed the obs-ffmpeg-video-restart-bug-fix branch from 969e8ff to bf92f0a Compare February 23, 2025 17:34
@Poodmund
Poodmund requested a review from WizardCM February 23, 2025 18:22
@Eriknpy

Eriknpy commented Apr 25, 2025

Copy link
Copy Markdown

Can you please approve and include in the next version?

@LightningXCE

Copy link
Copy Markdown

Hi all,

This continues to be a bug on 32.1.1 - could this be looked at please?

@SimonGZ it looks like they might be waiting on some changes from you.

This branch has not been deployed

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

Labels

kind/bug Categorizes issue or PR as related to a bug. Seeking Testers Build artifacts on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Last frame of media source flashes before starting video playback

5 participants