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

MPV not working as expected #645

Open
ciaens opened this issue Feb 1, 2024 · 10 comments · May be fixed by #652
Open

MPV not working as expected #645

ciaens opened this issue Feb 1, 2024 · 10 comments · May be fixed by #652
Labels
bug Something isn't working

Comments

@ciaens
Copy link

ciaens commented Feb 1, 2024

Describe the bug
Depending on the configuration, the MPV backend doesn't work, or exhibit color shift, color banding, compression, and fails to display an HDR image.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a movie encoded in HEVC 10 bit with HDR10 (main).
  2. Click on play
  3. See error (black screen or wrong playback).

Expected behavior
Normal playback of the movie, as done with the default backend (Exoplayer).

Screenshots
Screenshot_20240131-201215
Screenshot_20240131-201246

First image is MPV, second is ExoPlayer. You may need to increase brightness as it was captured on an HDR screen. Very noticeable in person.

Device info (please complete the following information):

  • Device: Google Pixel 8 Pro
  • Android version: 14 / UQ1A.240105
  • App version: v0.13.1 / versionCode 22 / targetSDK 34
  • Jellyfin version: not relevant

Additional context
Here are some logs where I start by using MPV, and then switch to ExoPlayer.
In this first log, I'm using first MPV with gpu-next and mediacodec-copy, then ExoPlayer
E dev.jdtech.jellyfin: PIXEL: ioctl err: 1 is spammed during MPV playback. See complete verbose logs below:
Findroid log 8242f4cf56ba.txt

In this second log, I'm first using MPV with no mediacopy / hardware encoding, then switching to mediacodec-copy.
Related issue: #537
When disabling hardware acceleration, I only get a black screen. When using the hardware encoding mediacodec or mediacodec-copy, I have an image (it's not displaying correctly thus why I'm making this issue).
Findroid log 6c1e37110e7e.txt

About this: #574
I've sometime encountered this issue, but this was either weird encoded movies, or solved by clearing the cache of the application.

@ciaens ciaens added the bug Something isn't working label Feb 1, 2024
@Jcuhfehl
Copy link
Contributor

Jcuhfehl commented Feb 1, 2024

Mpv on android cannot support hdr. This means all playback is tonemapped, which seems to be the cause of the color shift you're describing. The banding might also be because of this, but I'm not entirely sure about that since mpv should dither it when tonemapping

@ciaens
Copy link
Author

ciaens commented Feb 1, 2024

You're right mpv-android doesn't support HDR (I didn't think of that).
When using the android-mpv application, with the gpu-next backend I don't get the color shift and banding as in Findroid. The file plays in SDR but correctly tonemapped.
Here are the stats of mpv-android to compare:
Screenshot_20240201-125453~2.png

@jarnedemeulemeester
Copy link
Owner

The differences between Findroid and mpv-android may be because mpv-android is using a newer version of MPV than Findroid.

The next version of Findroid will upgrade mpv to the latest version (0.37.0) which will hopefully solve the tonemapping issues you're seeing.

And yeah, it's correct that mpv in Findroid has the same limitations (HDR) as mpv-android.

@Jcuhfehl
Copy link
Contributor

Jcuhfehl commented Feb 2, 2024

@ciaens What video settings do you use in mpv android? Findroid uses mpv's fast profile which leads to lower quality. Can you test if changing your mpv android settings to the following recreates the artifacts you're experiencing:

scale=bilinear
dscale=bilinear
dither=no
correct-downscaling=no
linear-downscaling=no
sigmoid-upscaling=no
hdr-compute-peak=no
allow-delayed-peak-detect=yes

I plan to create a pr to allow switching between mpv profiles (probably also individual settings) because there are a lot of quality improvements to be had from using actually good scaling kernels

@ciaens
Copy link
Author

ciaens commented Feb 2, 2024

Sure !
Here are the result. The first image is reference (VLC), the second is Findroid, and the third is MPV android with your settings (and gpu-next backend).Screenshot_20240202-230255.png

Screenshot_20240202-230141.png

Screenshot_20240202-230214.png

When I said MPV was doing dithering great, I only tested on a local HDR 10 film taken with my phone.
As tested with a real media, it seems that it's struggling a bit more, but still better than default Findroid imo.

@Jcuhfehl
Copy link
Contributor

Jcuhfehl commented Feb 2, 2024

This honestly just looks like different tonemapping methods. Personally vlc (are you sure it's vlc and not exoplayer?) seems worst (it nukes all the stars but I'm not sure because they're not the same frame). Providing more options is basically the only solution, since there isn't a "mathematically correct" way to tonemap so it's always going to come down to subjective opinion

Edit: both vlc and explayer support hdr passthrough, so the first image is also tonemapped (through some unknown process at screenshot time) so me claiming it looks worse probably doesn't make sense

@Jcuhfehl Jcuhfehl linked a pull request Feb 4, 2024 that will close this issue
@Jcuhfehl
Copy link
Contributor

Jcuhfehl commented Feb 4, 2024

@ciaens could you test with #652 (with high quality enabled) and gpu-next to see if you still get the same issue?

@ciaens
Copy link
Author

ciaens commented Feb 4, 2024

@ciaens could you test with #652 (with high quality enabled) and gpu-next to see if you still get the same issue?

Hello,
I've build your branch of the projet but couldn't find the options in the menu. I do have the options from the other's PRs.

To answer your precedent post, I did crank up the brightness of the image to make the defaults more apparent in a single screenshot. VLC was imo almost perfect, with only occasional decode hiccups. The screenshot I presented was taken with the file paused, and loaded at that frame (it was the 1st frame displayed) so that maybe the cause of visual glitches.

@GrabbenD
Copy link

GrabbenD commented Feb 7, 2024

Mpv on android cannot support hdr. This means all playback is tonemapped

Is this just Android or also Android TV?

@Jcuhfehl
Copy link
Contributor

Jcuhfehl commented Feb 7, 2024

It's an mpv limitation, so it applies to both android and android tv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants