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

Video support: only show gstreamer output after player is initialized #222

Closed
wants to merge 1 commit into from

Conversation

whoenig
Copy link

@whoenig whoenig commented Nov 1, 2021

When having one (or more) videos on a slide there is the following
effect:

  • First time opening this slide: 1+ video frames are black; then the
    video starts.
  • Second time opening this slide: Video seems to start on second 2 or 3
    and then suddenly jumps backwards.

It seems like this is caused by showing the video output before the
player is fully initialized. This commit only shows the output after
the video is initialized and avoid both effects.

Tested on Ubuntu 20.04 with LaTeX Beamer slides.

When having one (or more) videos on a slide there is the following
effect:

* First time opening this slide: 1+ video frames are black; then the
  video starts.
* Second time opening this slide: Video seems to start on second 2 or 3
  and then suddenly jumps backwards.

It seems like this is caused by showing the video output before the
player is fully initialized. This commit only shows the output after
the video is initialized and avoid both effects.

Tested on Ubuntu 20.04 with LaTeX Beamer slides.
@whoenig
Copy link
Author

whoenig commented Nov 1, 2021

I am not sure if this is a proper fix, or if this may cause side effects with other backends (e.g., gif). However, I feel it is easier to discuss it on a PR rather than an issue, since I already have a working workaround.

@Cimbali
Copy link
Owner

Cimbali commented Nov 1, 2021

Interesting, I’ll try to reproduce this. Does this only happen when auto-playing videos, or any videos?

Indeed you seem to be hiding the overlay in base and showing in gst_overlay, so that means it probably won’t work for the gif and vlc backends.

I suppose the missing initialization steps are in gst_player.GstOverlay.do_play() − I’m not sure that they can be put somewhere else, though. So either we’ll need to put the show() call in every specialisation’s on_play callback, or move the proper initialization of the Gst pipeline before the play calls.

@whoenig
Copy link
Author

whoenig commented Nov 1, 2021

Interesting, I’ll try to reproduce this. Does this only happen when auto-playing videos, or any videos?

I only checked it with auto-playing videos, which is my main use-case. I use LaTeX Beamer slides with multimedia and changed the pympress code to simply autoplay all videos (until #212 is fixed, I guess).

I can update the PR once you have identified a good direction, or you can also fix it directly yourself and close the PR - Pympress is a great tool; Thanks a lot for all the hard work!

@Cimbali
Copy link
Owner

Cimbali commented Nov 1, 2021

In fact I don’t see a backwards jump, but I do see the timer with an incorrect duration (0:01 instead of e.g. 0:30) for a bit, which is probably the same issue.

@Cimbali
Copy link
Owner

Cimbali commented Nov 3, 2021

@whoenig I’ve made some changes to make the Gst backend slightly more efficient. Can you see if the current master fixes your problem? Otherwise I’ve reimplemented your changes in the delay-gst-play branch in a somewhat more limited way and we can merge that.

@whoenig
Copy link
Author

whoenig commented Nov 3, 2021

Thanks! I tested the latest master as well as delay-gst-play. I didn't notice any difference in behavior between those branches. For both branches, the first issue remains very noticeably (that is, when a slide is open for the first time, i.e., when the media is lazily initialized, there is at least one fully black frame shown). The second issue is significantly reduced, although still there with some videos. I couldn't really find a correlation between video properties and the jumpy behavior. All tests are on a Ubuntu 20.04 installation on a new Laptop with i7 processor.

@Cimbali Cimbali closed this in b6e2091 Nov 4, 2021
@Cimbali
Copy link
Owner

Cimbali commented Nov 4, 2021

Great thanks for testing! The current master should fix the black-frames issue as well.

@whoenig
Copy link
Author

whoenig commented Nov 4, 2021

I can confirm that the latest master branch doesn't have those issues anymore - Thanks!

@whoenig whoenig deleted the bugfix_video_start branch November 4, 2021 12:31
smbct pushed a commit to smbct/pympress that referenced this pull request Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants