Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Poodmund
Copy link

@Poodmund Poodmund commented Feb 19, 2025

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
Copy link

SimonGZ commented Feb 22, 2025

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 Bug Fix Non-breaking change which fixes an issue label Feb 22, 2025
Copy link
Member

@WizardCM WizardCM left a comment

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Non-breaking change which fixes an issue 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
3 participants