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 Player #149

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

Video Player #149

wants to merge 36 commits into from

Conversation

DrRetro2033
Copy link
Contributor

Did a redo on the video player, as it was in GitHub conflict hell. So it should work now, plus I even added some rounded corners to it as well.

@CyanVoxel CyanVoxel self-assigned this May 9, 2024
@CyanVoxel CyanVoxel added the enhancement New feature or request label May 9, 2024
Copy link
Member

@CyanVoxel CyanVoxel left a comment

Choose a reason for hiding this comment

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

Love the functionality! And sorry for all the code changes in the meantime, there was a recent formatting refactor that probably messed with stuff pretty bad. Thank you for your patience!

Overall I think this is going in a good direction, there's just a few things I've run into or would like to see done:

  • When clicking on a new video file, the preview size is always incorrect until I manually grab the resize bar to "refresh" the panel (pictured below)
    image
  • Rarely I'm encountering an issue with vertical videos where the only about the middle part of the video is updating during playback, while the rest of the frame area only updates when the panel size changes. This may be related to the first issue.
  • The video playback can be kind of intensive sometimes and slows down the program. This is more so an issue stemming from having to stream a potentially high bitrate video file from disk while the program runs. Because of this, I would really like to see an autoplay toggle to stop videos from automatically playing in the preview window. Maybe this could be included in the right-click context menu for the video preview.
  • And lastly I'd like to see the mute/unmute status carry over from video to video instead of always defaulting to mute. This doesn't need to persist between sessions, but I think it makes sense for each next video to remember your audio preference.

Thank you again for working on this and getting a pretty cool feature going!

Copy link
Contributor Author

@DrRetro2033 DrRetro2033 left a comment

Choose a reason for hiding this comment

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

Fixed bugs and added autoplay toggle.

@DrRetro2033 DrRetro2033 requested a review from CyanVoxel May 9, 2024 14:37
Copy link
Member

@CyanVoxel CyanVoxel left a comment

Choose a reason for hiding this comment

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

Awesome!! The persistent volume settings seem to work fine, but the autoplay toggle seems to be inconsistent. If I toggle autoplay off followed by clicking on another entry and then clicking back to the first video, then it will autoplay regardless of the setting.

Other than that, just a couple general housekeeping things:

  • Remove or comment out the testing log messages (under mouse, over mouse, etc.). Ideally the ffmpeg logs would also be removed, but I'm not even sure if it's possible to turn those off, so I wouldn't worry about those.
  • On startup I get the following warning logs:
QGraphicsScene::addItem: item has already been added to this scene
QGraphicsProxyWidget::setWidget: cannot embed widget 0x27f44083a30 which is not a toplevel widget, and is not a child of an embedded widget
QGraphicsProxyWidget::setWidget: cannot embed widget 0x27f44083d90 which is not a toplevel widget, and is not a child of an embedded widget

The first warning seems to stem from line 85 in video_player.py, however I'm not sure about the other two warnings. I would suggest investigating the causes of these.

@DrRetro2033 DrRetro2033 requested a review from CyanVoxel May 9, 2024 23:45
@CyanVoxel
Copy link
Member

Awesome!! The persistent volume settings seem to work fine, but the autoplay toggle seems to be inconsistent. If I toggle autoplay off followed by clicking on another entry and then clicking back to the first video, then it will autoplay regardless of the setting.

I'm also still having this same autoplay issue where it has inconsistency following the setting.

@DrRetro2033
Copy link
Contributor Author

Awesome!! The persistent volume settings seem to work fine, but the autoplay toggle seems to be inconsistent. If I toggle autoplay off followed by clicking on another entry and then clicking back to the first video, then it will autoplay regardless of the setting.

I'm also still having this same autoplay issue where it has inconsistency following the setting.

I can't seem to recreate the autoplay issue. It is working just fine on my end after multiple tries.

@CyanVoxel
Copy link
Member

I can't seem to recreate the autoplay issue. It is working just fine on my end after multiple tries.

Here's a clip of me recreating the issue on my end:

2024-05-10.12-57-17-1.mp4

It usually takes the form of the video autoplaying regardless of the setting when clicking off then back to the file. It seems to also be affected by whether or not the last file clicked on was also a video.

@DrRetro2033
Copy link
Contributor Author

Looking good! Besides the suggested changes above, there's only a couple issues I'm still running into. One is that the play/pause button seems to get desynced and doesn't update to the correct "pause" state when the videos start autoplaying.

The other issue might be tougher to track down, and seems to only affect certain video files I've tested it on. This is the issue I mentioned where only the center part of the video frame updates, unless there's mouse activity over the video where that'll force a frame update. So far I've only found 3 video files that do this, and they're all .mov files.
2024-05-10.17-58-05-1.mp4

Alright, So I do not have any vertical videos in the mov format to test; BUT, I have a hunch it has something to do with how Qt is rendering the video. I noticed in the video you provided, the screen was glitching the most with videos that were higher than 1440p. So I tried playing the GTA 6 trailer at 2160p in the video player and it had artifacts and freezes the program. I may have a solution, but I do not know how long it will take to implement it. Hopefully I will have the solution in a day or two. But I am not holding my breath.

@CyanVoxel
Copy link
Member

Alright, So I do not have any vertical videos in the mov format to test; BUT, I have a hunch it has something to do with how Qt is rendering the video. I noticed in the video you provided, the screen was glitching the most with videos that were higher than 1440p. So I tried playing the GTA 6 trailer at 2160p in the video player and it had artifacts and freezes the program. I may have a solution, but I do not know how long it will take to implement it. Hopefully I will have the solution in a day or two. But I am not holding my breath.

Here are the videos I've found that result in the issue for me. One of them isn't even vertical and is pretty low resolution (it's also a bizarre video so I'm sorry in advance), so that may (or may not) narrow down the issue...
Videos for PR 149.zip

@CyanVoxel
Copy link
Member

Also for the current merge conflict: In commit b00dbf9 the resources_rc.py file was recompiled with fewer resources from the resources.qrc file. I assumed that you added your assets to the resources.qrc file and recompiled, but now that I'm looking at it closer you don't appear to have touched it at all and Qt may have updated the resources_rc.py on it's own, or maybe that's just an older version of the file that was present when you made your branch.

Basically, if you didn't touch these resource files then I would recommend removing/reverting the changes to the resources_rc.py file to solve the merge conflict.

@DrRetro2033
Copy link
Contributor Author

DrRetro2033 commented May 14, 2024

Alright, So I do not have any vertical videos in the mov format to test; BUT, I have a hunch it has something to do with how Qt is rendering the video. I noticed in the video you provided, the screen was glitching the most with videos that were higher than 1440p. So I tried playing the GTA 6 trailer at 2160p in the video player and it had artifacts and freezes the program. I may have a solution, but I do not know how long it will take to implement it. Hopefully I will have the solution in a day or two. But I am not holding my breath.

Here are the videos I've found that result in the issue for me. One of them isn't even vertical and is pretty low resolution (it's also a bizarre video so I'm sorry in advance), so that may (or may not) narrow down the issue... Videos for PR 149.zip

Thanks for the videos, they are extremely helpful. It appears that I am getting a slightly different, more stranger bug now.
image
It appears that the video is rotated 90 degrees, and it is for every video you sent. Extremely weird. I am starting to think PySide6 hates me.

@CyanVoxel
Copy link
Member

Thanks for the videos, they are extremely helpful. It appears that I am getting a slightly different, more stranger bug now. ! It appears that the video is rotated 90 degrees, and it is for every video you sent. Extremely weird. I am starting to think PySide6 hates me.

Seeing how they're playing for you has potentially led me to the solution: These videos are actually encoded as having their height and widths swapped, with an EXIF rotation flag being set to correct for them. This is something I already have to manually account for when loading in image previews. I'll dig around the video player code to see where I can account for this flag and correct the resolution.
Actual dimensions for the low-res landscape video:
image
image

@CyanVoxel
Copy link
Member

Upon further testing this issue may lay deeper within Qt or possibly FFmpeg. That fact that we already had different behaviors should've tipped me off. While I'm certain that the rotation flag is the root of this behavior (also it wasn't EXIF but rather just QuickTime metadata), I'm not sure if it's easily fixable on our end.

@yedpodtrzitko
Copy link
Collaborator

yedpodtrzitko commented May 16, 2024

I did checkout the branch to see why is the CI failing and I noticed one unrelated bug:

  • select any video in library
  • video starts playing in the thumbnail
  • hover over the video and it shows play icon (▶️ ), but the video is playing already so it should show pause icon instead.

@yedpodtrzitko
Copy link
Collaborator

you can check this commit how to fix the mypy issues: 8e62147

radius=12,
fill=(0, 0, 0, 0),
)
mask = mask.getchannel("A").toqpixmap()
Copy link
Collaborator

Choose a reason for hiding this comment

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

mask has originally type PIL.Image, but here it's changed to QPixmap, so it would be really better to use different variable for one of these, so the types wont clash

# return super().resizeEvent(event)\

def inputMethodEvent(self, event: QInputMethodEvent) -> None:
return
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this intentional?

@CyanVoxel
Copy link
Member

The play/pause indicator not updating after autoplaying seems to be mostly fixed, except in the case of when the video autoplays while the user's mouse is hovered over the indicator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Pending Merge
Development

Successfully merging this pull request may close these issues.

None yet

3 participants