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

fix(present): bug with Qt and Windows + debug messages #377

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jeertmans
Copy link
Owner

Apparently, the "recommended* versions of Qt (i.e., Qt 6.5.1 and 6.5.2) produces errors.

I could not exactly re-produce #315, but I also have failed to get textures for frame; format: 172 textureConverter null in the output, as #315 (comment) mentioned.

After searching a bit, this feels like the faulty lines are (at least related to)

self.video_sink.videoFrameChanged.connect(
lambda frame: self.info.video_sink.setVideoFrame(frame)
)
.

I could not yet find a fix for that, but I created this PR for testing purposes... I also added quite a few debug prints, for the future.

When upgrading Qt to 6.5.3 and above, the error message disappear, but we then have the same visual issue as described in #293.

This is the logs when I comment the lines mentioned:

PS C:\Users\hexyl\Documents\GitHub\manim-slides> pdm run manim-slides BasicExample -v DEBUG
[02/27/24 16:59:48] DEBUG    No configuration file found, using default configuration.                                                                                                            __init__.py:287
                    DEBUG    Instantiating Player instance.                                                                                                                                         player.py:189
                    DEBUG    Setting window size accordingly to first presentation resolution: 1920-by-1080.                                                                                        player.py:220
                    DEBUG    Creating main window.                                                                                                                                                  player.py:230
                    DEBUG    Creating (secondary) info window.                                                                                                                                      player.py:248
                    DEBUG    Attaching callbacks                                                                                                                                                    player.py:264
                    DEBUG    Adding a custom signal handler to skip slide if `--auto-next` is used.                                                                                                 player.py:295
                    DEBUG    Loading media from url = PySide6.QtCore.QUrl('file:slides/files/BasicExample/1a71026ac89d836940b1a0fedd2e8302b359a3887ddad3b1ed1992d0ec19c514.mp4').                   player.py:411
                    DEBUG    Playing the media...                                                                                                                                                   player.py:427
[02/27/24 16:59:49] DEBUG    Signal that presentation changed.                                                                                                                                      player.py:488
                    DEBUG    Signal that slide changed.                                                                                                                                             player.py:495
                    DEBUG    Previewing next slide (if any).                                                                                                                                        player.py:503
    failed to get textures for frame; format: 172 textureConverter null
[02/27/24 16:59:55] DEBUG    [USER] Close event.                                                                                                                                                    player.py:581
                    INFO     Closing gracefully...                                                                                                                                                  player.py:517
                    DEBUG    [USER] Close event.                                                                                                                                                    player.py:581
                    INFO     Closing gracefully...                                                                                                                                                  player.py:517

If I put the lines back, the message is:

PS C:\Users\hexyl\Documents\GitHub\manim-slides> pdm run manim-slides BasicExample -v DEBUG
[02/27/24 17:02:57] DEBUG    No configuration file found, using default configuration.                                                                                                            __init__.py:287
                    DEBUG    Instantiating Player instance.                                                                                                                                         player.py:189
                    DEBUG    Setting window size accordingly to first presentation resolution: 1920-by-1080.                                                                                        player.py:220
                    DEBUG    Creating main window.                                                                                                                                                  player.py:230
                    DEBUG    Creating (secondary) info window.                                                                                                                                      player.py:248
                    DEBUG    Attaching callbacks                                                                                                                                                    player.py:262
                    DEBUG    Adding a custom signal handler to skip slide if `--auto-next` is used.                                                                                                 player.py:293
                    DEBUG    Loading media from url = PySide6.QtCore.QUrl('file:slides/files/BasicExample/1a71026ac89d836940b1a0fedd2e8302b359a3887ddad3b1ed1992d0ec19c514.mp4').                   player.py:409
                    DEBUG    Playing the media...                                                                                                                                                   player.py:425
                    DEBUG    Signal that presentation changed.                                                                                                                                      player.py:486
                    DEBUG    Signal that slide changed.                                                                                                                                             player.py:493
                    DEBUG    Previewing next slide (if any).                                                                                                                                        player.py:501
    failed to get textures for frame; format: 172 textureConverter null
[AVHWFramesContext @ 00000179046511C0] Static surface pool size exceeded.
[h264 @ 0000017904860500] get_buffer() failed
[h264 @ 0000017904860500] thread_get_buffer() failed
[h264 @ 0000017904860500] decode_slice_header error
[h264 @ 0000017904860500] no frame!
[AVHWFramesContext @ 000001791B030F40] Static surface pool size exceeded.
[h264 @ 000001790485E900] get_buffer() failed
[h264 @ 000001790485E900] thread_get_buffer() failed
[h264 @ 000001790485E900] decode_slice_header error
[h264 @ 000001790485E900] no frame!
[AVHWFramesContext @ 00000179046511C0] Static surface pool size exceeded.
[h264 @ 000001790485A500] get_buffer() failed
[h264 @ 000001790485A500] thread_get_buffer() failed
[h264 @ 000001790485A500] decode_slice_header error
[h264 @ 000001790485A500] no frame!
...
Output was truncated

Now with PySide6==6.5.3:

PS C:\Users\hexyl\Documents\GitHub\manim-slides> pdm run manim-slides BasicExample -v DEBUG
[02/27/24 17:04:42] DEBUG    No configuration file found, using default configuration.                                                                                                            __init__.py:287
[02/27/24 17:04:43] WARNING  You are using API = 'pyside6', QT_VERSION = '6.5.3', but we recommend installing 'PySide6==6.5.2', mainly to avoid flashing screens between slides, see issue         __init__.py:23
                             https://github.com/jeertmans/manim-slides/issues/293. You can do so with `pip install 'manim-slides[pyside6]'`.
[02/27/24 17:04:44] DEBUG    Instantiating Player instance.                                                                                                                                         player.py:189
                    DEBUG    Setting window size accordingly to first presentation resolution: 1920-by-1080.                                                                                        player.py:220
                    DEBUG    Creating main window.                                                                                                                                                  player.py:230
                    DEBUG    Creating (secondary) info window.                                                                                                                                      player.py:248
                    DEBUG    Attaching callbacks                                                                                                                                                    player.py:262
                    DEBUG    Adding a custom signal handler to skip slide if `--auto-next` is used.                                                                                                 player.py:293
                    DEBUG    Loading media from url = PySide6.QtCore.QUrl('file:slides/files/BasicExample/1a71026ac89d836940b1a0fedd2e8302b359a3887ddad3b1ed1992d0ec19c514.mp4').                   player.py:409
                    DEBUG    Playing the media...                                                                                                                                                   player.py:425
                    DEBUG    Signal that presentation changed.                                                                                                                                      player.py:486
                    DEBUG    Signal that slide changed.                                                                                                                                             player.py:493
                    DEBUG    Previewing next slide (if any).                                                                                                                                        player.py:501
    failed to get textures for frame; format: 172 textureConverter null
[02/27/24 17:04:48] DEBUG    [USER] Key press event <PySide6.QtGui.QKeyEvent(KeyPress, Key_Q, text="q")>.                                                                                           player.py:583
                    INFO     Closing gracefully...                                                                                                                                                  player.py:515
                    DEBUG    [USER] Close event.                                                                                                                                                    player.py:579
                    INFO     Closing gracefully...                                                                                                                                                  player.py:515
                    DEBUG    [USER] Close event.                                                                                                                                                    player.py:579
                    INFO     Closing gracefully...                                                                                                                                                  player.py:515

Apparently, the "recommended* versions of Qt (i.e., Qt 6.5.1 and 6.5.2) produces errors.

I could not exactly re-produce #315, but I also have `failed to get textures for frame; format: 172 textureConverter null` in the output, as #315 (comment) mentioned.

After searching a bit, this feels like the faulty lines are (at least related to) https://github.com/jeertmans/manim-slides/blob/1dbd2fdde58030867f15d7bf0ecede11d59d6903/manim_slides/present/player.py#L245-L247.

I could not yet find a fix for that, but I created this PR for testing purposes... I also added quite a few debug prints, for the future.

When upgrading  Qt to 6.5.3 and above, the error message disappear, but we then have the same visual issue as described in #293.
@jeertmans jeertmans added bug Something isn't working help wanted Extra attention is needed present Related to the main "present" feature labels Feb 27, 2024
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 54.54545% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 79.19%. Comparing base (1dbd2fd) to head (c817781).

Files Patch % Lines
manim_slides/present/player.py 54.54% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #377      +/-   ##
==========================================
- Coverage   79.75%   79.19%   -0.57%     
==========================================
  Files          22       22              
  Lines        1803     1836      +33     
==========================================
+ Hits         1438     1454      +16     
- Misses        365      382      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jeertmans jeertmans added the windows Windows related label Mar 4, 2024
@pianoboy71
Copy link

Hey jeertmans, you might not remember me but I spoke with you on discord about a month ago about this issue. I know it's been a while but I was just wondering if there was any update as to how to get this working, if I should change pyside6 versions, change over to pyqt6, or install a different version of manim-slides entirely. If there is nothing and I do end up having to change my version of manim-slides, can you let me know what version to install and which qt bindings to install with it? Thanks

@jeertmans
Copy link
Owner Author

Hey jeertmans, you might not remember me but I spoke with you on discord about a month ago about this issue. I know it's been a while but I was just wondering if there was any update as to how to get this working, if I should change pyside6 versions, change over to pyqt6, or install a different version of manim-slides entirely. If there is nothing and I do end up having to change my version of manim-slides, can you let me know what version to install and which qt bindings to install with it? Thanks

Hi @pianoboy71! Unfortunately, I did not try anything further, as I am quite busy with my research work, and I am not an active Windows user :-/

Maybe installing it through WSL on Windows might be a "fix", but I hope to come with a better fix one day. If anyone is willing to put some time to help on this issue, please do so!

@Sipondo
Copy link

Sipondo commented Apr 4, 2024

Perhaps of little value, but I've noticed that using --hide-info-window prevents the presentation from crashing and thus allows the user to play manim-slides presentations on windows systems.

@jeertmans
Copy link
Owner Author

Perhaps of little value, but I've noticed that using --hide-info-window prevents the presentation from crashing and thus allows the user to play manim-slides presentations on windows systems.

Indeed, the fact that the info window duplicate the video stream seems to crash the app, and a solution seems to be to hide it from the start. I'd love to provide a better fix, but thank you for mentioning it :-)

@Sipondo
Copy link

Sipondo commented Apr 4, 2024

Let me know if you've come across any other fixes as I am using your excellent library on Windows right now. I'd love to contribute if I ever find the time to do so :)

@jeertmans
Copy link
Owner Author

jeertmans commented Apr 4, 2024

Let me know if you've come across any other fixes as I am using your excellent library on Windows right now. I'd love to contribute if I ever find the time to do so :)

Well, if you have some time, I'd love to get your help on Windows (see my message on Reddit)!

I think that, features-wise, Manim Slides is quite stable (at least the manim-slides present command). I'd like to prepare a v6 that is: (1) easier to install and (2) works on most platforms by default.

v6 will need (1) the Qt issue to be fixed (https://bugreports.qt.io/browse/QTBUG-118501) and also fixing any issue regarding incompatible Qt / Python version / OS triplets.

If you feel confident, I suggest you fork and clone this repo, checkout this branch, and start modifying manim_slides/present/player.py and see if that fixes the issues.

Another neat thing would be to create tests that capture those failing tasks, so we can actually test future fixes! Please let me know if you ever need help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed present Related to the main "present" feature windows Windows related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants