uvlights Posted March 22, 2023 Share Posted March 22, 2023 I'm looking for a solution to play a video in a GUI with no frame or any controls just the video, in any size I want to. Of course I've searched for solutions myself but everything that I found is from many years ago and does not work anymore on Windows 10. Cmon there must be a way? Link to comment Share on other sites More sharing options...
mistersquirrle Posted March 22, 2023 Share Posted March 22, 2023 I haven't used it much, but I just opened a script that I've used this VLC UDF on before and it still works for me on Windows 10: I haven't tried opening a video file directly using the UDF, instead I open a playlist which specifies the video file to play, but my script looks like this: expandcollapse popup#include <GUIConstants.au3> #include <VLC.au3> #include <SliderConstants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiSlider.au3> _VLCErrorHandlerRegister() Local $hMainGui = GUICreate("VLC UDF Example", 600, 1013, -1, -1) Local $state, $msg $vlc1 = _GUICtrlVLC_Create(0, 0, 600, 337) ; _GUICtrlVLC_Create($left, $top, $width, $height) ;$vlc2 = _GUICtrlVLC_Create(0, 337, 600, 337) GUISetState(@SW_SHOW) UpdateGUIAndPlay($vlc1, "C:\Users\Raven\Documents\AutoIt\VLC\TestVideo.xspf") While 1 $msg = GUIGetMsg() ; Loop a finished video $state = _GUICtrlVLC_GetState($vlc1) If $state = 6 Then UpdateGUIAndPlay($vlc1) If $msg = $GUI_EVENT_CLOSE Then ExitLoop EndIf WEnd Func UpdateGUIAndPlay(ByRef $hVlc, $path = "") If StringLen($path) > 0 Then _GUICtrlVLC_Clear($hVlc) _GUICtrlVLC_Play($hVlc, _GUICtrlVLC_Add($hVlc, $path)) Else _GUICtrlVLC_Play($hVlc, 0) EndIf While _GUICtrlVLC_GetState($hVlc) <> 3 Sleep(10) WEnd EndFunc ;==>UpdateGUIAndPlay We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
uvlights Posted March 22, 2023 Author Share Posted March 22, 2023 1 hour ago, mistersquirrle said: I haven't used it much, but I just opened a script that I've used this VLC UDF on before and it still works for me on Windows 10: I haven't tried opening a video file directly using the UDF, instead I open a playlist which specifies the video file to play, but my script looks like this: expandcollapse popup#include <GUIConstants.au3> #include <VLC.au3> #include <SliderConstants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiSlider.au3> _VLCErrorHandlerRegister() Local $hMainGui = GUICreate("VLC UDF Example", 600, 1013, -1, -1) Local $state, $msg $vlc1 = _GUICtrlVLC_Create(0, 0, 600, 337) ; _GUICtrlVLC_Create($left, $top, $width, $height) ;$vlc2 = _GUICtrlVLC_Create(0, 337, 600, 337) GUISetState(@SW_SHOW) UpdateGUIAndPlay($vlc1, "C:\Users\Raven\Documents\AutoIt\VLC\TestVideo.xspf") While 1 $msg = GUIGetMsg() ; Loop a finished video $state = _GUICtrlVLC_GetState($vlc1) If $state = 6 Then UpdateGUIAndPlay($vlc1) If $msg = $GUI_EVENT_CLOSE Then ExitLoop EndIf WEnd Func UpdateGUIAndPlay(ByRef $hVlc, $path = "") If StringLen($path) > 0 Then _GUICtrlVLC_Clear($hVlc) _GUICtrlVLC_Play($hVlc, _GUICtrlVLC_Add($hVlc, $path)) Else _GUICtrlVLC_Play($hVlc, 0) EndIf While _GUICtrlVLC_GetState($hVlc) <> 3 Sleep(10) WEnd EndFunc ;==>UpdateGUIAndPlay Thank you! I've played around with this too but I don't rlly like it. I'm not writing on my own UDF using the ffmpeg decoder library. works like a charm Link to comment Share on other sites More sharing options...
Nine Posted March 22, 2023 Share Posted March 22, 2023 Another way with Media Player (no need of UDF) : expandcollapse popup#include <Constants.au3> #include <StructureConstants.au3> #include <GUIConstants.au3> Local $hGui = GUICreate("WMPlayer", 800, 600) Local $oPlayer = ObjCreate("WMPlayer.OCX") If Not IsObj($oPlayer) Then Exit MsgBox($MB_SYSTEMMODAL, "WMPlayer.OCX", "Cannot create a WMP object.", 5) GUICtrlCreateObj($oPlayer, 0, 0, 800, 600) With $oPlayer .URL = "Your path here.wmv" ; $sFullPath .uiMode = "none" .settings.mute = False EndWith While $oPlayer.playState = 9 Sleep(50) WEnd GUISetState() ResizeOCX($oPlayer, 0, 0, 800, 600) While $oPlayer.playState = 3 ; 1 - stopped, 2 - paused, 3 - playing Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func ResizeOCX($oObject, $iLeft, $iTop, $iRight, $iBottom) Local Const $tagIOleInPlaceObj = _ "ContextSensitiveHelp none(int); " & _ "GetWindow none(ptr); " & _ "InPlaceDeactivate none(); " & _ "ReactivateAndUndo none(); " & _ "SetObjectRects none(ptr; ptr;); " & _ "UIDeactivate none();" Local $oIInPlace = ObjCreateInterface($oObject, "{00000113-0000-0000-C000-000000000046}", $tagIOleInPlaceObj) Local $tRect = DllStructCreate($tagRECT) $tRect.Left = $iLeft $tRect.Top = $iTop $tRect.Right = $iRight $tRect.Bottom = $iBottom Local $pRect = DllStructGetPtr($tRect) $oIInPlace.SetObjectRects($pRect, $pRect) EndFunc ;==>ResizeOCX mLipok 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
uvlights Posted March 22, 2023 Author Share Posted March 22, 2023 7 minutes ago, Nine said: Another way with Media Player (no need of UDF) : expandcollapse popup#include <Constants.au3> #include <StructureConstants.au3> #include <GUIConstants.au3> Local $hGui = GUICreate("WMPlayer", 800, 600) Local $oPlayer = ObjCreate("WMPlayer.OCX") If Not IsObj($oPlayer) Then Exit MsgBox($MB_SYSTEMMODAL, "WMPlayer.OCX", "Cannot create a WMP object.", 5) GUICtrlCreateObj($oPlayer, 0, 0, 800, 600) With $oPlayer .URL = "Your path here.wmv" ; $sFullPath .uiMode = "none" .settings.mute = False EndWith While $oPlayer.playState = 9 Sleep(50) WEnd GUISetState() ResizeOCX($oPlayer, 0, 0, 800, 600) While $oPlayer.playState = 3 ; 1 - stopped, 2 - paused, 3 - playing Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func ResizeOCX($oObject, $iLeft, $iTop, $iRight, $iBottom) Local Const $tagIOleInPlaceObj = _ "ContextSensitiveHelp none(int); " & _ "GetWindow none(ptr); " & _ "InPlaceDeactivate none(); " & _ "ReactivateAndUndo none(); " & _ "SetObjectRects none(ptr; ptr;); " & _ "UIDeactivate none();" Local $oIInPlace = ObjCreateInterface($oObject, "{00000113-0000-0000-C000-000000000046}", $tagIOleInPlaceObj) Local $tRect = DllStructCreate($tagRECT) $tRect.Left = $iLeft $tRect.Top = $iTop $tRect.Right = $iRight $tRect.Bottom = $iBottom Local $pRect = DllStructGetPtr($tRect) $oIInPlace.SetObjectRects($pRect, $pRect) EndFunc ;==>ResizeOCX Yup I've seen this one too, doesn't work in windows 10 unfortunately idk why. Link to comment Share on other sites More sharing options...
Nine Posted March 22, 2023 Share Posted March 22, 2023 2 minutes ago, uvlights said: Yup I've seen this one too, doesn't work in windows 10 unfortunately idk why. I just tested it on Win10 -- it works fine. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
uvlights Posted March 22, 2023 Author Share Posted March 22, 2023 2 minutes ago, Nine said: I just tested it on Win10 -- it works fine. hm weird. But anyways i'm super happy with ffmpeg now Link to comment Share on other sites More sharing options...
argumentum Posted March 23, 2023 Share Posted March 23, 2023 8 hours ago, uvlights said: using the ffmpeg decoder library. works like a charm would you share the code ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
uvlights Posted March 23, 2023 Author Share Posted March 23, 2023 4 hours ago, argumentum said: would you share the code ? oh it's actually pretty simple, just download the ffmpeg release, and run the ffplay.exe in terminal like: ffplay -noborder -x 600 -y 400 ./video.avi you can also position it with -left and -top parameters. then just create your gui and position it inside of the gui where ever you want. use the "Run" function from autoit to run the cmd command. and use the @SW_HIDE showflag to hide the cmd window. But make sure to credit FFmpeg if you're planning to release anything in public. argumentum 1 Link to comment Share on other sites More sharing options...
Belini Posted May 3, 2023 Share Posted May 3, 2023 Does anyone know what commands I should use to open ffplay running as light as possible, I'm currently testing Mplayer but it's a little heavy on more modest machines so I'm trying to find another player alternative that requires less cpu resources. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Belini Posted May 4, 2023 Share Posted May 4, 2023 (edited) so far in searches I only saw -threads 1 to improve ffplay. I'm using it like this: Run("ffplay.exe video.mp4"& $mute & " -fs -x 1024 -y 768 -left 0 -top 0 -threads 1 -window_title win_fundo -infbuf -framedrop -noborder -vf setdar=ratio=4/3", @ScriptDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) Edited May 4, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Werty Posted May 4, 2023 Share Posted May 4, 2023 3 hours ago, Belini said: -threads 1 Was there any explanation as why that improves performance, more threads should get better performance, though I do know that some programs likes singlethread. Have you tried using the exact amount of threads the cpu supports? $cores = EnvGet("NUMBER_OF_PROCESSORS") Run("ffplay.exe video.mp4"& $mute & " -fs -x 1024 -y 768 -left 0 -top 0 -threads " & $cores & "-window_title win_fundo -infbuf -framedrop -noborder -vf setdar=ratio=4/3", @ScriptDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Belini Posted May 5, 2023 Share Posted May 5, 2023 I haven't tested it using all cores yet, I'll test it here to see. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
CYCho Posted May 8, 2023 Share Posted May 8, 2023 (edited) winmm.dll comes with Windows and using it is probably the leanest method available for media streaming. The following example shows 2 videos playing in one GUI. Other examples of winmm.dll commands can be found here. expandcollapse popup#include <GUIConstants.au3> #include <WinAPISysWin.au3> #include <WinAPIConv.au3> ;#include <Array.au3> HotKeySet("^!{END}", "_Exit") $videoWidth = 720 $videoHeight = 405 $hGUI = GUICreate("WINMM.DLL", $videoWidth, $videoHeight*2, -1, -1) ;, $WS_OVERLAPPEDWINDOW) $iGui = Dec(StringMid($hGUI, 3)) $aPos = WinGetPos($hGUI) $borderWidth = ($aPos[2]-$videoWidth)/2 $titleHeight = $aPos[3]-$videoHeight*2-$borderWidth GUISetState() $hDLL = DllOpen("winmm.dll") GUIRegisterMsg($WM_MOVE, "WM_MOVE") $sFile1 = "D:\Video\Big_buck_Bunny.webM" $sFile2 = "D:\Video\Yanni - The Rain Must Fall.mp4" $iRet = mciSendString("open """ & $sFile1 & """ alias myMedia_1 type MPEGVideo style popup parent " & $iGui) If $iRet <> 1 Then $sMsg = $sFile1 & @CRLF & @CRLF & "This file cannot be opened by this player." MsgBox(0, "Open error", $sMsg) _Exit() EndIf mciSendString("set myMedia_1 audio all off") mciSendString("play myMedia_1 repeat") $hVideo1 = WinGetHandle($sFile1) WinMove($hVideo1, "", $aPos[0]+$borderWidth, $aPos[1]+$titleHeight, $videoWidth, $videoHeight) $iRet = mciSendString("open """ & $sFile2 & """ alias myMedia_2 type MPEGVideo style popup parent " & $iGui) If $iRet <> 2 Then $sMsg = $sFile2 & @CRLF & @CRLF & "This file cannot be opened by this player." MsgBox(0, "Open error", $sMsg) _Exit() EndIf ;mciSendString("set myMedia_2 audio all off") mciSendString("play myMedia_2 repeat") $hVideo2 = WinGetHandle($sFile2) WinMove($hVideo2, "", $aPos[0]+$borderWidth, $aPos[1]+$titleHeight+$videoHeight, $videoWidth, $videoHeight) While 1 $guiMsg = GUIGetMsg() Switch $guiMsg Case $GUI_EVENT_CLOSE _Exit() EndSwitch WEnd Func mciSendString($string) ;https://learn.microsoft.com/en-us/windows/win32/multimedia/multimedia-command-strings Local $aRet = DllCall($hDLL, "int", "mciSendStringW", "wstr", $string, "wstr", "", "int", 65534, "hwnd", 0) If Not @error Then Return $aRet[2] EndFunc Func WM_MOVE($hWnd, $MsgID, $wParam, $lParam) #forceref $hWnd, $MsgID, $wParam, $lParam If $hWnd = $hGUI Then $x = _WinAPI_LoWord($lParam) $y = _WinAPI_HiWord($lParam) WinMove($hVideo1, "", $x, $y) WinMove($hVideo2, "", $x, $y+$videoHeight) EndIf Return $GUI_RUNDEFMSG EndFunc Func _Exit() mciSendString("close myMedia_1") mciSendString("close myMedia_2") DllClose($hDLL) Exit EndFunc Edited May 9, 2023 by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Belini Posted May 9, 2023 Share Posted May 9, 2023 @CYCho yes using winmm.dll was always my best option and it was working fine until it got to windows 10 then with it problems started with some videos not playing so I'm trying to migrate to some light player that already has its own codecs because using the winmm.dll need to install klite or another codec pack to play videos. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
CYCho Posted May 9, 2023 Share Posted May 9, 2023 Thank you for sharing your experience. I've been toying around with winmm.dll for the last couple of months and I also had some frustrations. The biggest problem I had was that some files could not be played in fullscreen mode. This was solved by combination of mciSendString("play myMedia") and mciSendString("play myMedia fullscreen from 0"). So far I have not seen any file that cannot be played by winmm.dll. As regards to codec, I already had klite installed in my computer, so I did not see it as a problem. 49 minutes ago, Belini said: some videos not playing Are those files playing in Windows Media Player, but not in winmm.dll? zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Belini Posted May 9, 2023 Share Posted May 9, 2023 yes, having the codec, all videos that play in the media player will play with winmm.dll too, as for fullscreen, I couldn't make videos of different resolution occupy the whole screen without black bars, did you manage to solve this? My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
CYCho Posted May 9, 2023 Share Posted May 9, 2023 30 minutes ago, Belini said: whole screen without black bars, did you manage to solve this? No, I couldn't. I took it as an effort to keep the aspect ratio of the source which, to me, was a very important feature. If I really wanted to fill the screen disregarding the aspect ratio, I had to be content with a maximized window. zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
CYCho Posted May 9, 2023 Share Posted May 9, 2023 (edited) On 5/9/2023 at 10:27 PM, Belini said: whole screen without black bars, did you manage to solve this? I learned just now from here that I can make the video fullscreen without the black bars. WinMove($hVideo1, "", 0, 0, @DesktopWidth, @DesktopHeight) GUISetStyle(BitOR($WS_POPUP, $WS_EX_TOPMOST), $hVideo1) Edit: The file must have been opened in popup style in order for this to be effective. Edited May 10, 2023 by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Belini Posted May 10, 2023 Share Posted May 10, 2023 (edited) Thanks for the tip, I'll try it out. Edited May 10, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now