Closed gdmka closed 4 years ago
it's your own fault. don't set vo=gpu
use the default (vo=libmpv
, which is basically vo=gpu). the cocoa backend for vo=gpu
is deprecated, but that's what the terminal output would say. i guess, if your mpv is not build with cocoa-cb/swift support then you don't have a choice.
the issue you referenced has the same problem, eg using vo=gpu
. it's not maintained and there are bugs and new mechanics that are not implemented.
scrap the hwdec=auto
if you don't need it. if you have problems with hwdec report it to ffmpeg. see all the videotoolbox related issues which are all ffmpeg related. if the files work with an older version you should mention the ffmpeg version that worked in the bug report on the fmpeg issue tracker.
@Akemi as per your advice i did set the vo value to libmpv (i'm aware of the deprecation warning since 0.29 but it never seemed to be an issue given the expected GPU performance was met)
if your mpv is not build with cocoa-cb/swift support then you don't have a choice.
I've attached the output log file for your consideration. There's definitely a macos-cocoa-cb
among the enabled features. Is this the one that need to be enabled to make hardware decoding happen? Because i can't seem to find anything related to cocoa-cb/swift
verbatim in the docs.
Unfortunately (for me ofc) no hardware acceleration is enforced. The easiest way to verify is checking the Activity Monitor column Requires High Perf GPU.
Am i still missing something?
Post a full log generated with --log-file=filename.log
of you playing back a video as the issue template requests.
Also, you seemingly keep confusing rendering and decoding. It is rendering using your hardware. hwdec=auto
enables decoding using your hardware.
I can't see whether you've actually set hwdec because whatever output you uploaded is severely truncated and partially overwritten, but if you want hardware decoding (which can be buggy on macOS due to faults in components outside of mpv, hence why Akemi recommended against it) then you need hwdec=auto
, or hit ctrl+h
during playback to toggle it on and off.
Also, you seemingly keep confusing rendering and decoding.
Granted! Lack of proper sleep can lead to unwanted results. I've updated the ticket title to reflect my intentions with better comprehension. Thanks.
UPD:
@CounterPillow
Verbose log attached. Mind i've put hwdec=auto
back.
At 722 it tells VideoToolbox session is not available which is new given 0.29.1 have never reported anything like it.
which can be buggy on macOS due to faults in components outside of mpv, hence why Akemi recommended against it)
Never had any issues with Mojave for more than a year of using mpv 0.29.1
to clarify, "Require High Pref GPU" has nothing to do with hardware acceleration (or hardware decoding). it just means it uses the internal GPU (not the dedicated one) to render. the automatic usage of the GPU is completely in Apples or macOS's hands. though in both cases it's hardware accelerated, eg not the software renderer.
why do you need to use the dedicated GPU (for reference i am interested in the exact reason)? if you don't have problems with playback/rendering you shouldn't care.
if you really need to force the dedicated GPU --cocoa-force-dedicated-gpu=yes
is the right option to use, though it is not implemented for the new backend yet. you have to wait for #7272 to be fixed. i plan to add support for this flag.
@Akemi
why do you need to use the dedicated GPU (for reference i am interested in the exact reason)? if you don't have problems with playback/rendering you shouldn't care.
Simply because i was led to believe it unloads the CPU and grants better performance playing 1080p and 4K videos (and i have never been discouraged by results i got). At least my experiences for this use case with alternative video players for MacOS were way worse.
it grants a bit better performance, but only for rendering. it's helpful for higher resolution and/or fps videos, higher quality scalers or demanding shaders. it can also be a workaround for macOS's bad energy saving strategies when it throttles the integrated GPU too much when it is not needed.
though yeah it doesn't unload anything from the CPU.
@Akemi
though yeah it doesn't unload anything from the CPU.
I've done some dirty quasi-checks
vo=gpu
and hwdec=auto
Notice how the configuration instructs the discrete GPU to spin.
Same file vo=libmpv
. hwdec
disabled.
vo=libmpv
+ hwdec=auto
It's obvious libmpv alone makes a single CPU core work twice harder than with hwdec
enabled.
That's what i was implying by "unloading" the CPU: lowering the CPU resource utilization for the process.
to clarify, "Require High Pref GPU" has nothing to do with hardware acceleration (or hardware decoding). it just means it uses the internal GPU (not the dedicated one) to render. the automatic usage of the GPU is completely in Apples or macOS's hands. though in both cases it's hardware accelerated, eg not the software renderer.
I'm a bit confused right now. According to https://support.apple.com/en-us/HT201464#energy
""High Perf." means the Mac is currently using high-performance graphics."
Anytime i use a specific mpv configuration i can identify that the GeForce is in use, to doublecheck i reason by gfxCardStatus with turns from Iris to Nvidia the moment i start any video. Are you trying to tell me that it's just an unintended coincidence?
vo=libmpv and vo=gpu should behave exactly the same in your scenarios. if only vo=gpu triggers "Requires High Perf GPU" there can only be so many reasons (which i can only guess without full logs of everything). you either still use cocoa-force-dedicated-gpu=yes, which obviously uses the dedicated GPU and like i said is not supported on libmpv (yet), or Apple's heuristic to automatically trigger the dedicated GPU is weird (like here where it depends on the window size).
you still get your things mixed up. i am talking about rendering and hwdec has nothing to do with rendering but decoding. obviously it will produce 'less' cpu load, though it still produces load on a different dedicated part of the chip that is not shown in activity monitor (on the intel CPU/GPU combi). i mean your own screenshots shows exactly that. vo=libmpv + hwdec=auto behaves similar to your first case just that "Requires High Perf GPU" is not yes.
I'm a bit confused right now. According to https://support.apple.com/en-us/HT201464#energy
""High Perf." means the Mac is currently using high-performance graphics."
yes? it's in no way contrary to what i said. i have no idea what you are confused about. it just means the dedicated GPU is doing the rendering ("using high-performance graphics"), nothing else.
i am not sure what you are asking? i can't tell you exactly what happens without logs of all cases, but see my assumption above.
I have a nascent feeling this thread is slowly getting derailed…
So to adress specifics.
@Akemi At first you claimed that utilizing GPU (no matter IGPU or a discrete one) doesn't free up the main CPU. For the sake of the premise really it doesn't matter what kind of computation is performed (decoding or rendering) given claim is correct by itself. I don't know why you would say that.
So after my completely synthetic tests arrived my words moved from being negated to the obvious section. I don't even understand why a maintiner would do that...
obviously it will produce 'less' cpu load, though it still produces load on a different dedicated part of the chip that is not shown in activity monitor (on the intel CPU/GPU combi). i mean your own screenshots shows exactly that.
This is exactly why those screenshots exist. To prove my point of computation being offloaded to IGPU/GPU and why i find mpv more compelling than, say, vlc.
you still get your things mixed up.
Well given the mpv pipeline i feel like i did until @CounterPillow clarified my misunderstanding, thought my intention can't be more clear: i require hardware acceleration support (specifically dedicated GPU) for both rendering and decoding. It worked perfectly in tandem before but now it's not. Btw the vlc doc states the same points to prefer GPU processing over software one as i did https://wiki.videolan.org/VLC_GPU_Decoding/
As much as i like to learn about the pecularities i'm afraid this domain is a bit outside of my area of expertise.
If you have upgraded to mpv 0.31.0 and have vo=gpu
hwdec=auto
cocoa-force-dedicated-gpu=yes
as i did and default keybindings have stopped working along with emerging of videotoolbox errors you may want to swtich to libmpv to take care of rendering and disable cocoa-force-dedicated-gpu
until @Akemi implements https://github.com/mpv-player/mpv/issues/7272
Hardware Decoding for MacOS is also discouraged by the maintainers.
you are still misunderstand my comments. i will try to sum it up and be very specific about it.
cocoa-force-dedicated-gpu=yes
only moves the GPU load (rendering) from the iGPU to the dedicated GPU it doesn't free up any resources on the CPU. that's what i 'claimed', nothing else. it does not choose the GPU the decoding is done on with hwdec
. if not used (cocoa-force-dedicated-gpu=no
) macOS will decide which GPU is used for renderinghwdec=auto
activates hardware accelerated video decoding. this can only offload decoding resources from the CPU to a dedicated part of a chip. on macOS it's, as far as i know, usually always done on the Intel CPU/iGPU combination. usually that part is attributed to the iGPU. it is not possible to chose a decoding device. in cases this can even be slower than software decoding, depending on codec, decoding optimisation, memory copies etc.cocoa-force-dedicated-gpu
and hwdec
are completely independent option and don't influence each other.hwdec
) when it is deactivated by defaultcocoa-cb-sw-renderer=yes
. if it does software rendering it will print a warning and it it will be magnitudes slower.cocoa-force-dedicated-gpu
. it will just not do anything with vo=libmpv
, but will start working whenever i add support for it.vo
option (just remove it from the config), it will chose the right one automatically.@Akemi Thank's for elucidating the details! It is truly heplful. Especially point no 6 which i presupposed would work.
i added support for this in PR #7376. the old option still works (works for cocoa-cb now) but i replaced it with a new option --macos-force-dedicated-gpu
. feel free to test.
Thank you @gdmka! There were nearly no rendering/decoding issues in my case but my fans would go crazy when playing H264 over HTTP at 80%+ CPU. These settings reduced CPU use back to 25ish% like on VLC and brought peace back to video watching. hr-seek=no
can be also set just in case.
mpv version and platform
mpv 0.31.0 built on Sun Dec 29 15:57:17 CET 2019 ffmpeg library versions: libavutil 56.31.100 libavcodec 58.54.100 libavformat 58.29.100 libswscale 5.5.100 libavfilter 7.57.100 libswresample 3.5.100 ffmpeg version: 4.2.1
MacOS 10.14.6 / MacBook Pro (Retina, 15-inch, Mid 2014) / NVIDIA GeForce GT 750M 2 GB / Intel Iris Pro 1536 MB
Sample files
N/A
Hi, i've seen a couple of issues related to my problem but can't seem to wrap my head around the best practices for running MPV with GPU acceleration anymore. For 29.0.1 this combination of attributes worked like a charm.
After upgrading to 0.31.0 i have encountered several issues such as https://github.com/mpv-player/mpv/issues/7316, video stream rapidly blinking upon entering fullscreen and initialization error like so [ffmpeg/video] h264: Failed setup for format videotoolbox_vld: hwaccel initialisation returned error for files which previosly never reported incidents with mpv 0.29.1.
My question is: what is the current state of GPU accelerated video playback for MacOS with mpv 0.31.0? What is your general advice and guidelines of tuning the settings so it reflects the performance and quality of 0.29.1 (aside from obvious downgrading)?
I believe this ticket may aid all of mpv MacOS users that encounter the same performance problems as i do.