Jump to content

Recommended Posts

Posted (edited)

I am excited to share a lightweight yet powerful 4K video player that I built using AutoIt and the MPV engine. This project is the first step in my efforts to find a viable way to migrate the engine of my zPlayer from the legacy winmm.dll to the modern libmpv-2.dll which has hardware acceleration and supports high resolutions. I was especially interested in finding a way to play 4K video files. I have high expectations for @MattyD's efforts to bring WinRT functionalities to AutoIt. In the meantime, I looked into libvlc.dll and libmpv-2.dll, but frankly, I found both to be very difficult to learn. I was inclined to use MPV because it seemed oriented toward developers, whereas VLC was for users. This player has only rudimentary functions, but it uses most of the basic MPV commands and functions to support my migration.

For the latest version of libmpv-2.dll, I downloaded mpv-dev-x86_64-20260307-git-f9190e5.7z from this site.

Any comments or suggestions would be most welcome.

File updated on March 24, 2026

 

AutoIt_4K_MPV_Player(20260324).au3

Edited by CYCho
Posted

Hi, it works ok so far ...

The _PlayListCreate() function should be called after the check for the libmpv-2.dll

for my local copy of the script i made this change:

If $hMPV_DLL = -1 Then
;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes, No, Default Button=Second, Icon=Critical, Modality=Task Modal, Miscellaneous=Top-most attribute
$iMsgBoxAnswer = MsgBox(270596,"Error","libmpv-2.dll file cannot be loaded." & @CRLF & "Do you want to open the link to the download" & @CRLF &"page in your web browser ?"  & @CRLF &  "Download and extract the .dll from" & @crlf & "mpv-dev-x86_64-20260307-git-f9190e5.7z" & @crlf & "and copy it into the script folder" & @CRLF & "then restart this app")
    if $iMsgBoxAnswer = 6 then ;ok
        ShellExecute ("https://github.com/shinchiro/mpv-winbuild-cmake/releases")
    EndIf
    Exit
EndIf

to make it easier to get the dll file.

Some of my script sourcecode

Posted

MPV basically fills the GUI in full. The aspect ratio can be kept or ignored with one line of code:

_mpv_set_property_string($pHandle, "keepaspect", "yes") : keeps aspect ratio and fills the empty spaces with black background (Default)
_mpv_set_property_string($pHandle, "keepaspect", "no") : ignores the aspect ratio and fills the GUI with image

In my example, these options can be toggled with Ctrl+Alt+a hotkey.

Posted

I noticed that, if the video was hidden in the background for about 30 minutes and brought back to foreground, the image was frozen, though the audio was alive all the time. Through googling, I learned that the Windows power management sometimes freezes the GPU renderer while the audio, which is controlled by CPU, continues to work. So I made a small adlib function which fires every 10 minutes and, sofar, it seems to work.

Func _RefreshVideo()    ; Adlib to update the renderer with a harmless "seek" function every 10 minutes
    _mpv_command($pHandle, "seek", 0, "relative")
EndFunc

The file in the first post was updated.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...