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

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

Closed
guusguusguus opened this issue May 10, 2020 · 13 comments · Fixed by #3206 · May be fixed by #11881
Closed

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

guusguusguus opened this issue May 10, 2020 · 13 comments · Fixed by #3206 · May be fixed by #11881
Assignees
Labels
Confirmed This bug report has been confirmed by project members

Comments

@guusguusguus
Copy link

guusguusguus commented May 10, 2020

Platform

Operating system and version: Windows 10, Pro 64-bit
OBS Studio version: 25.0.8

Expected Behavior

Play video starting with first frame

Current Behavior

First plays last frame and then starts playing from first frame

Steps to Reproduce

Add 'Media source'
Select a local video file (tested with quicktime and transparency and also h264 mp4) 
Configure playback with the following settings:
 [ ] loop
 [x]  restart playback when source becomes active
 [x] or [ ] use hardware enc..
 [ ] show noth...
 [x] or [ ] close file when in...

 Switch between scenes and the problem appears most of the time, problem is most consistent around lower framerates (25 fps) bu still noticeable around higher framerates (50 fps)

Additional information

I have a media source with a quicktime video with alpha enabled. When i start the scene with this media source it first shows the last frame of the video and then starts playing the video from the first frame. I have tested it with exporting the video with the last frame fully transparent and this solves the issue but it makes it impossible to end the video on the last frame.

i have also tested it without using transparency (a h264 mp4 file) and it has the same problem

problem persists on older versions (have tested it al the way back to version 16)

I have also been testing with framerates and the problem was most persistent with lower framerates (around 25 fps) and less persistent with higher framerates (around 50 fps) but the problem never really disappeared. the source material for the test was 25 fps

i started a post on the forum:
https://obsproject.com/forum/threads/last-frame-of-media-source-flashes-before-starting-video-playback.121882/

somebody confirms that the problem is also on the linux versions

i have been using the windows version (32 and 64 bit versions)

this is the output of the log file:

2020-05-10 00-55-14.txt

@guusguusguus guusguusguus changed the title Last frame of media source flashes before starting video playback [BUG] Last frame of media source flashes before starting video playback May 10, 2020
@RytoEX
Copy link
Member

RytoEX commented May 10, 2020

Please don't delete the issue template. Please edit your issue to use the template.

@therentabrain
Copy link

Workaround fwiw: I had this problem when going from one video file scene to another. I was able to avoid the flash by adding a full black screen jpg source under the first video. I also changed the first video from internal player to VLC. The second one is the internal player. I don't even remember what inspired this idea, or which one worked, but I hope something here helps.

@notr1ch notr1ch added the Confirmed This bug report has been confirmed by project members label Jun 10, 2020
@notr1ch notr1ch self-assigned this Jun 10, 2020
@chamberlago
Copy link

I seem to be having this issue again with 26.1.1

@tdp4
Copy link

tdp4 commented Apr 26, 2021

I can confirm this is also happening to me on 26.1.1.

@SimonGZ
Copy link

SimonGZ commented Feb 25, 2022

Noting that this continues to be a problem in OBS 27.2.1 on Mac. This old forum post does a really nice job of visualizing the issue: https://obsproject.com/forum/threads/media-source-rendering-the-last-frame-at-the-beginning.110180/

@therentabrain
Copy link

I don't even understand my own workaround above.
The one I use now is to put a very short black screen video file as the top item in the scene. When I switch to the scene, it plays the black frames on top and then that video stops, letting the thing underneath show through.

@DrewSunn
Copy link

Problem persists on 28.0.1

@tomica00
Copy link

Problem persists on 29.1.3
It's really annoying.

@1030
Copy link

1030 commented Jan 31, 2025

Problem still persists in 2025. I have many projects halted due to this, any help would be appreciated. How do we escalate?

@therentabrain
Copy link

therentabrain commented Feb 2, 2025

If I were still dealing with this, here's what I'd try as workaround now:
use the Advanced Scene Switcher extension plugin
Things I'd try...
Macro 1:
On scene change, reset all media players to no media (empty)

Macro 2:
On scene change, if the new scene is the one that should be playing media, then set the media source and immediately play it.

If that doesn't work, then you could also put a cover image, or even a text box with a solid background, over the video and use Advanced Scene Switcher to turn it visible in macro 1, and hide it after 100 milliseconds or something in macro 2.

And a third idea:
Would it hide the trouble frame if you set up a 500ms fade-in as the "Show" transition for the video control? Then instead of having a cover-up object, you could tell Macro 2 to make the video itself appear, and perhaps the fade-in would hide the problem.

Oh here's a variation:
Do #3 using a very short blank solid video as a stinger. The advantage here is that it can pop in, rather than fade in, and the audio won't be affected. I think #3 might cause the audio to fade in.

I haven't had to deal with this issue in a while but I thought these might be good ideas. :)

@tomica00
Copy link

tomica00 commented Feb 2, 2025

I'm still using 29.1.3 but now the problem seems to have resolved itself. :S Maybe the problem was with Windows, and after an update it started working normally. I don't know.

On the stinger idea, I don't know if that would work, since a stinger is also just a cut with an overlay.
If that doesn't work, maybe try a custom Luma Wipe (there's a way to add custom wipe PNGs, see here), but use a blank white image and set softness to 0. That will look like a cut with a small delay, but it should trigger the playout at the very beginning.

@SimonGZ
Copy link

SimonGZ commented Feb 4, 2025

I'm on macOS with OBS 31.0.1 and the problem remains.

I just tried some of @therentabrain's proposed workarounds (thank you for typing them out). Using Advanced Scene Switcher and setting it to blank out the file path and hide the scene item visibility, then restoring the scene item visibility and source settings does help but it's not a great solution for me. It removes the most obvious part of the painful flicker where you see the last frame of the media, but there's still a flicker as the video is now loaded in after a slightly longer delay. And of course there's now a lot of setup required in advanced scene switcher.

Thinking through this problem, I think what's really desired here is that when returning to a scene with a media source set to restart after played (but not set to loop), OBS should have the first frame of the media source preloaded and ready to go, rather than the last frame or no frames.

@Poodmund
Copy link

Poodmund commented Feb 19, 2025

I've had a bash at resolving this and it seems to be working in my debug build. I have absolutely no idea on the ramifications of what I've done however, so anyone who could review would be greatly appreciated: Poodmund@4986749.
https://www.youtube.com/watch?v=gjyV74gqOFI

Poodmund added a commit to Poodmund/obs-studio that referenced this issue Feb 19, 2025
When a video source is activated it appears that the last cached frame is shown before the video playback is restarted. This should resolve the issues obsproject#2906 and obsproject#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. This commit seems to fix this, shown here: https://www.youtube.com/watch?v=gjyV74gqOFI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmed This bug report has been confirmed by project members
Projects
None yet