Mpv timed out, restarting

Hey, I have this error. It happens when I am in the middle of repeating words, I press a key to move forward and then Anki hangs and begins to think. I need to force close it manually, terminate the app.
When I restart it, I have a constant mpv timed out error.
Is this mpv even needed? How to get rid off it? It makes only issues leaving it be?

The problem occurs in the latest beta and the last stable version before beta

mpv is a media player.
See this other post for possible workarounds.

1 Like

To confirm, you tested with beta 3? Beta 3 updated mpv, so it may behave differently to beta 2.

1 Like

Hey, I downloaded this version:

Versie āØ2.1.50 (95dbf30f)ā©
Python 3.9.7 Qt 6.2.3 PyQt 6.2.3

But the error was still present so I downloaded mpv separately (the newest one possible and a one dll file from github), replaced both files but the problem still persisted.
So my workaround was to remove all audio from any deck and to kill mpv.exe process in the task manager.
I looked at BlackBeansā€™ advised thread but it is way too much hassle with it. No common user should be forced for tricks like advised in the thread :stuck_out_tongue:

Have you tried the first, easy workaround proposed in that thread, that is, download mplayer, go in the Anki directory, drop mplayer.exe there are remove the existing mpv.exe?

2 Likes

Aside from mplayer (the best possible option), a possible temporary alternative is to install/enable either of these two add-ons:

and then Anki hangs and begins to think

This is likely happens because Anki is waiting for mpv process to be terminated after it got suspended/unresponsive for some unknown reason (to make another attempt to play the audio file after restarting mpv).
And as you said, to avoid ā€˜mpv timed out, restartingā€™ after opening Anki again, mpv.exe process will need to be closed in the task manager after force closing Anki.


It will take some time and might go nowhere, but to better understand whatā€™s going on, I think, itā€™ll be necessary to run Anki from Python. Itā€™s similar to the one before and will look something like this.

  1. Download the latest mpv build from https://sourceforge.net/projects/mpv-player-windows/files/64bit/ and update the PATH environment variable (to include the path to the folder with mpv.exe) - https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/.

  2. Install Anki with Python (but donā€™t run or give it a test run) - https://faqs.ankiweb.net/running-from-python.html

  3. Start mpv from the Command Prompt (Win > cmd) using this command (to show mpv window and enable logging).

    mpv.com -v --idle --force-window=immediate --geometry=360+300+0 --script-opts=osc-visibility=always --audio-display=no --keep-open=no --gapless-audio=no --autoload-files=no --input-media-keys=no --config-dir=%APPDATA%\Anki2 --input-ipc-server=ankimpv

    Just in case (or to be aware of it), it might be better to uncheck ā€œQuick Edit Modeā€.

  1. Edit or replace C:\anki-venv\Lib\site-packages\aqt\mpv.py (for example, with Visual Studio Code) to enable ā€˜debugā€™ mode for mpv and add a few print statements if ERROR_BROKEN_PIPE.

    https://gist.github.com/kelciour/679adc891c3c05fec499981e09333c28/revisions

  2. Run Anki from Python and review a card with sound.

    If everything goes well, Anki will tell mpv to play the audio file by sending >>> {"command": ["loadfile" ... and will receive <<< {"data":{"playlist_entry_id":1},"request_id":0,"error":"success"}.

If the same issue happens again, maybe the output from these two console windows will contain some error messages or something useful.

3 Likes

These suggestions are not a solution, they are so we can figure out what is going wrong. The issue does not happen on developer machines, so we need a user who is experiencing the problem to try various things for us.

1 Like

I am back, was busy with other things. Thank you for solutions but for me as the end user the best and shortest is just to kill mvp process in the process manager. That what I do if it hangs.
Sorry I have rly no time for some extensive debugging :frowning: