mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.39k stars 2.91k forks source link

mpv play 4k 60fps vp9 video with hwdec slower than Firefox, even than software decoding #14548

Open MizuyoruTW opened 3 months ago

MizuyoruTW commented 3 months ago

mpv Information

mpv v0.38.0-580-g00f43e09 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on Jul  7 2024 00:04:00
libplacebo version: v7.349.0 (v7.349.0-dirty)
FFmpeg version: N-116159-gecd3a9783
FFmpeg library versions:
   libavcodec      61.9.100
   libavdevice     61.2.100
   libavfilter     10.2.102
   libavformat     61.4.100
   libavutil       59.28.100
   libswresample   5.2.100
   libswscale      8.2.100

Other Information

CPU: Intel i5-8400 GPU: Nvidia GTX 1050 Although I have BlackDesert in minimized(which do not consume too much resources), it's abnormal that firefox does better than mpv. GTX 1050 has vp9 decoding support. link

screenshots: mpv --no-config --profile=fast: image

mpv --no-config --hwdec=d3d11va --profile=fast: image

play file in firefox: image

Reproduction Steps

MPV Software testing 1: mpv <file> --no-config MPV Software testing 2: mpv <file> --no-config --profile=fast

MPV Hardware testing 1: mpv <file> --no-config --hwdec=d3d11va MPV Hardware testing 2: mpv <file> --no-config --hwdec=d3d11va --profile=fast

Firefox Hardware testing: drag and drop into new tab

Expected Behavior

MPV Software testing 1: maybe slow MPV Software testing 2: maybe slow

MPV Hardware testing 1: fast MPV Hardware testing 2: fast

Firefox Hardware testing: fast

** slow means visable shuttering

Actual Behavior

MPV Software testing 1: slow MPV Software testing 2: fast

MPV Hardware testing 1: slow MPV Hardware testing 2: slow

Firefox Hardware testing: fast

** slow means visable shuttering

Log File

mpv <file> --no-config --hwdec=d3d11va --gpu-debug --log-file=output.txt output.txt

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

Doofussy2 commented 3 months ago

--vo=gpu-next

kasper93 commented 3 months ago

You need to provide a sample file, so we can reproduce the issue. It looks like mpv/ffmpeg uses 100% of video decode engine on your gpu and that causes frame drops, but we need more information to diagnose why this happens.

EDIT: See also https://github.com/mpv-player/mpv/discussions/13991 for other VP9 performance issues in ffmpeg. EDIT2: There is also unexpected low performance on Apple Silicon https://trac.ffmpeg.org/ticket/10963

MizuyoruTW commented 3 months ago

--vo=gpu-next

still same

You need to provide a sample file, so we can reproduce the issue. It looks like mpv/ffmpeg uses 100% of video decode engine on your gpu and that causes frame drops, but we need more information to diagnose why this happens.

EDIT: See also #13991 for other VP9 performance issues in ffmpeg. EDIT2: There is also unexpected low performance on Apple Silicon https://trac.ffmpeg.org/ticket/10963

you can use this youtube mpv "https://www.youtube.com/watch?v=bnofYmfKLeo" --no-config --ytdl-format="315+251" --hwdec=d3d11va

MizuyoruTW commented 3 months ago

Additional: As I have mentioned

Although I have BlackDesert in minimized(which do not consume too much resources), it's abnormal that firefox does better than mpv.

I tested it without BlackDesert. The video can play without dropping frames. However, AFAIK, minimized BlackDesert may occupy vram, but will lower the CPU and GPU usage significantly.

And, I heard that Firefox alse use FFmpeg as video decoder, so I think it won't be FFmpeg problem

Andarwinux commented 3 months ago

Firefox doesn't use ffmpeg as a hardware acceleration method, but uses d3d11 or media foundation in its own way.

MizuyoruTW commented 3 months ago

Firefox doesn't use ffmpeg as a hardware acceleration method, but uses d3d11 or media foundation in its own way.

Thanks for correcting me, I will check if it's FFmpeg's problem

MizuyoruTW commented 3 months ago

After invesgating about video decoder in FFmpeg, I found it seems like my GPU doesn't have enough vram to decoding high resolution video when running game int the background.

I confirmed that via taskmgr, in that situation, when I open a high quality video, it increase the vram usage, and starting using shared memory (although gpu's vram is not full).