MPV playing video lag

Videos are laggy when they played via MPV.
But Videos are smooth when they played via Haruna.

what should I set in mpv?

Hi @sunriseast,

To be able to possibly provide a solution, or at least something to search for, wee need more information. IIRC, MPV is started via CLI. Something like:

mpv /path/to/video.file

Where, surprise surprise, /path/to/video.file is the path to the video file.

Please provide the output in the terminal when you do that.

Thanks for the reply.

I got as follow.```
mpv /path/to/video.file

(+) Video --vid=1 () (h264 1920x1080 23.976fps)
(+) Audio --aid=1 (
) (ac3 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:16 / 01:46:00 (0%) A-V: 0.403 Dropped: 134

Audio/Video desynchronisation detected! Possible reasons include too slow
hardware, temporary CPU spikes, broken drivers, and broken files. Audio
position will not match to the video (see A-V status field).

Please provide the output of:

inxi --admin --verbosity=7 --filter --no-host --width

Did you try enabling Hardware video acceleration?
https://wiki.archlinux.org/title/mpv#Hardware_video_acceleration

1 Like

I tried,but video is still laggy.

~/.config/mpv/mpv.conf

hwdec=auto

inxi  --admin --verbosity=7 --filter --no-host --width                                                                         ✔ 
System:
  Kernel: 5.9.16-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 10.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-5.9-x86_64
    root=UUID=bbdf1655-8bdb-4bb3-b264-da83e94847f8 rw quiet
    udev.log_priority=3
  Desktop: LXQt v: 1.2.0 tk: Qt v: 5.15.7 info: lxqt-panel wm: Openbox
    v: 3.6.1 vt: 7 dm: LightDM v: 1.32.0 Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 74585FV v: ThinkPad X200
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: LENOVO model: 74585FV serial: <superuser required> BIOS: LENOVO
    v: 6DET72WW (3.22 ) date: 10/25/2012
Battery:
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M315/235/317
    serial: <filter> charge: 100% (should be ignored) rechargeable: yes
    status: discharging
Memory:
  RAM: total: 7.67 GiB used: 1.05 GiB (13.7%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: Intel Core2 Duo P8600 bits: 64 type: MCP arch: Penryn level: v1
    built: 2008 process: Intel 45nm family: 6 model-id: 0x17 (23)
    stepping: 0xA (10) microcode: 0xA0C
  Topology: cpus: 1x cores: 2 smt: <unsupported> cache: L1: 128 KiB
    desc: d-2x32 KiB; i-2x32 KiB L2: 3 MiB desc: 1x3 MiB
  Speed (MHz): avg: 2294 high: 2363 min/max: 800/2401 boost: enabled scaling:
    driver: acpi-cpufreq governor: schedutil cores: 1: 2363 2: 2225
    bogomips: 9578
  Flags: acpi aperfmperf apic arch_perfmon bts clflush cmov constant_tsc
    cpuid cx16 cx8 de ds_cpl dtes64 dtherm dts est flexpriority fpu fxsr ht
    ida lahf_lm lm mca mce mmx monitor msr mtrr nopl nx pae pat pbe pdcm pebs
    pge pni pse pse36 pti sep smx sse sse2 sse4_1 ssse3 syscall tm tm2
    tpr_shadow tsc vme vmx vnmi vpid xsave xtpr
  Vulnerabilities:
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: EPT disabled
  Type: mds status: Vulnerable: Clear CPU buffers attempted, no microcode;
    SMT disabled
  Type: meltdown mitigation: PTI
  Type: spec_store_bypass status: Vulnerable
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Full generic retpoline, STIBP: disabled, RSB
    filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel Mobile 4 Series Integrated Graphics vendor: Lenovo
    driver: i915 v: kernel arch: Gen-5 process: Intel 45nm built: 2008 ports:
    active: VGA-1 off: LVDS-1 empty: DP-1, DP-2, DP-3, HDMI-A-1, HDMI-A-2
    bus-ID: 00:02.0 chip-ID: 8086:2a42 class-ID: 0300
  Display: x11 server: X.org v: 1.21.1.6 driver: X: loaded: modesetting
    alternate: fbdev,vesa dri: crocus gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1280x1024 s-size: <missing: xdpyinfo>
  Monitor-1: LVDS-1 note: disabled model: Lenovo 0x4010 built: 2007 res: N/A
    dpi: 125 gamma: 1.2 size: 261x163mm (10.28x6.42") diag: 308mm (12.1")
    ratio: 16:10 modes: 1280x800
  Monitor-2: VGA-1 pos: primary model: Philips 170V serial: <filter>
    built: 2008 res: 1280x1024 hz: 60 dpi: 96 gamma: 1.2
    size: 338x270mm (13.31x10.63") diag: 433mm (17") ratio: 5:4 modes:
    max: 1280x1024 min: 720x400
  API: OpenGL v: 2.1 Mesa 22.3.1 renderer: Mesa Mobile Intel GM45 Express
    (CTG) direct render: Yes
Audio:
  Device-1: Intel 82801I HD Audio vendor: Lenovo ThinkPad T400
    driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:293e
    class-ID: 0403
  Sound API: ALSA v: k5.9.16-1-MANJARO running: yes
  Sound Server-1: JACK v: 1.9.21 running: no
  Sound Server-2: PulseAudio v: 16.1 running: yes
  Sound Server-3: PipeWire v: 0.3.63 running: no
Network:
  Device-1: Intel 82567LM Gigabit Network vendor: Lenovo ThinkPad T400
    driver: e1000e v: kernel port: 1840 bus-ID: 00:19.0 chip-ID: 8086:10f5
    class-ID: 0200
  IF: enp0s25 state: down mac: <filter>
  Device-2: Intel PRO/Wireless 5100 AGN [Shiloh] Network driver: iwlwifi
    v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 bus-ID: 03:00.0
    chip-ID: 8086:4237 class-ID: 0280
  IF: wlan0 state: up mac: <filter>
  IP v4: <filter> type: dynamic scope: global
  IP v6: <filter> scope: link
  WAN IP: <filter>
Bluetooth:
  Device-1: Broadcom BCM2045B (BDC-2.1) [Bluetooth Controller] type: USB
    driver: btusb v: 0.8 bus-ID: 4-2:3 chip-ID: 0a5c:2145 class-ID: fe01
  Report: rfkill ID: hci0 rfk-id: 2 state: up address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 111.79 GiB used: 31.93 GiB (28.6%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/sda maj-min: 8:0 vendor: Kingston model: SV300S37A120G
    size: 111.79 GiB block-size: physical: 512 B logical: 512 B speed: 3.0 Gb/s
    type: SSD serial: <filter> rev: BBF0 scheme: MBR
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 50.59 GiB size: 49.74 GiB (98.31%) used: 31.93 GiB (64.2%)
    fs: ext4 dev: /dev/sda5 maj-min: 8:5 label: N/A
    uuid: bbdf1655-8bdb-4bb3-b264-da83e94847f8
Swap:
  Alert: No swap data was found.
Unmounted:
  ID-1: /dev/sda1 maj-min: 8:1 size: 50 MiB fs: ntfs
    label: \xe7\xb3\xbb\xe7\xb5\xb1\xe4\xbf\x9d\xe7\x95\x99
    uuid: 906E0DD96E0DB8CC
  ID-2: /dev/sda2 maj-min: 8:2 size: 29.01 GiB fs: ntfs label: N/A
    uuid: E46E0EB56E0E8112
  ID-3: /dev/sda3 maj-min: 8:3 size: 32.13 GiB fs: ntfs
    label: \xe6\x96\xb0\xe5\xa2\x9e\xe7\xa3\x81\xe7\xa2\x9f\xe5\x8d\x80
    uuid: 2E98EE5898EE1DD9
  ID-4: /dev/sda4 maj-min: 8:4 size: 1 KiB fs: <superuser required>
    label: N/A uuid: N/A
USB:
  Hub-1: 1-0:1 info: Full speed or root hub ports: 6 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-2: 2-0:1 info: Full speed or root hub ports: 6 rev: 2.0 speed: 480 Mb/s
    chip-ID: 1d6b:0002 class-ID: 0900
  Hub-3: 3-0:1 info: Full speed or root hub ports: 2 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
  Device-1: 3-1:2 info: Logitech Unifying Receiver type: Keyboard,Mouse,HID
    driver: logitech-djreceiver,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s
    power: 98mA chip-ID: 046d:c52b class-ID: 0300
  Hub-4: 4-0:1 info: Full speed or root hub ports: 2 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
  Device-1: 4-1:2 info: AuthenTec AES2810 type: <vendor specific> driver: N/A
    interfaces: 1 rev: 2.0 speed: 12 Mb/s power: 100mA chip-ID: 08ff:2810
    class-ID: ff00
  Device-2: 4-2:3 info: Broadcom BCM2045B (BDC-2.1) [Bluetooth Controller]
    type: Bluetooth driver: btusb interfaces: 4 rev: 2.0 speed: 12 Mb/s
    power: 100mA chip-ID: 0a5c:2145 class-ID: fe01
  Hub-5: 5-0:1 info: Full speed or root hub ports: 2 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
  Hub-6: 6-0:1 info: Full speed or root hub ports: 2 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
  Device-1: 6-2:2 info: Logitech Media Keyboard K200 type: Keyboard,HID
    driver: hid-generic,usbhid interfaces: 2 rev: 1.1 speed: 1.5 Mb/s power: 90mA
    chip-ID: 046d:c31d class-ID: 0300
  Hub-7: 7-0:1 info: Full speed or root hub ports: 2 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
  Hub-8: 8-0:1 info: Full speed or root hub ports: 2 rev: 1.1 speed: 12 Mb/s
    chip-ID: 1d6b:0001 class-ID: 0900
Sensors:
  System Temperatures: cpu: 39.0 C mobo: 34.0 C
  Fan Speeds (RPM): cpu: 3461
Info:
  Processes: 155 Uptime: 7m wakeups: 3 Init: systemd v: 252 default: graphical
  tool: systemctl Compilers: gcc: 12.2.0 clang: 14.0.6 Packages: pm: pacman
  pkgs: 1187 libs: 398 tools: pamac Shell: Zsh v: 5.9 running-in: qterminal
  inxi: 3.3.24

Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

Please format your text using Preformatted Text option so that it’s easier to read. It looks like you have an intel card.

  • Where is the file located - Network, local copy, USB etc.?
  • Try starting playback in the terminal using the following and see if it gets better. You seem to be dropping a lot of frames.
mpv --hwdec=vaapi /path/to/file
mpv --hwdev=vaapi-copy /path/to/file
$ mpv --hwdec=vaapi ~/Documents/file
 (+) Video --vid=1 (*) (h264 1920x1080 23.976fps)
 (+) Audio --aid=1 (*) (ac3 2ch 48000Hz)
[ffmpeg] AVHWFramesContext: Failed to create surface: 14 (the requested RT Format is not supported).
[ffmpeg] AVHWFramesContext: Unable to allocate a surface from internal buffer pool.
[ffmpeg/video] h264: No support for codec h264 profile 100.
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:02:27 / 01:46:00 (2%) A-V:  0.444 Dropped: 18
$ mpv --hwdec=vaapi-copy ~/Documents/file
 (+) Video --vid=1 (*) (h264 1920x1080 23.976fps)
 (+) Audio --aid=1 (*) (ac3 2ch 48000Hz)
[vaapi] libva: /usr/lib/dri/iHD_drv_video.so init failed
[ffmpeg/video] h264: No support for codec h264 profile 100.
[ffmpeg/video] h264: Failed setup for format vaapi: hwaccel initialisation returned error.
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:04:08 / 01:46:00 (4%) A-V:  0.403 Dropped: 22

What does vainfo from package libva-utils report? In this specific case mpv is reporting that your GPU does not support h264 codecs.

On my old laptop with 4th gen intel CPU/iGPU I had to install libva-intel-driver-g45-h264 from the AUR to get hardware decoding on h264 to work.

Take a look at Hardware video acceleration - ArchWiki for the specific packages related to your card.

Kernel 5.9.16-1 was marked End Of Life in April 2021 and is no longer supported

I suggest you install LTS kernel v5.10

sudo mhwd-kernel -i linux510
1 Like