The result of my sent is catastrophic!
All my layout is lost: spaces, white lines!
What is the right method to send easily to you an icon, a .bat, and a shortcut?
Kind regards.
Edmund
The result of my sent is catastrophic!
All my layout is lost: spaces, white lines!
What is the right method to send easily to you an icon, a .bat, and a shortcut?
Kind regards.
Edmund
Hello Thweiss,
Apparently, info@vlc-forum.de don't like my bad english!
I try with Dateianhänge, Hochladen.
On the path F:\Vlc-de, I have put for you:
- MosaicIcon.ico, an icon for Mosaic VLC;
- Mosaic Video.lnk, a shortcut for start Mosaic VLC;
- Mosaic.bat, the cmd script.
I have seen Erlaubte Dateiendungen; all the above files are renamed with .txt; for MosaicIcon.ico (.txt) and Mosaic.bat (.txt) -> refused!
I put Mosaic.bat in Quellcode; I don't see how return to message!
I wish a good send; do not hesitate to ask me for explanations.
Kind regards.
Edmund
@echo off
rem ##################################################################################
rem # Mosaic VLC -> from Video-1 to Video-4 #
rem # ------------------------------------- #
rem # All the windows are started with the audio. #
rem # #
rem # All the hotkeys of VLC are usable for each subpicture, after select with a #
rem # mouse click. #
rem # #
rem # After launching of each subpicture, True is displayed in Mosaic VLC to #
rem # indicate a good start, in mute; else, False is displayed. #
rem # #
rem # To quit the mosaic, select Mosaic VLC and strike any key. #
rem # #
rem # WARNING: #
rem # Here, it is assumed that the creation time of the task corresponding to a #
rem # sub-window is less than one second; if he can be superior: #
rem # - increase the time in AudioToggle, $_.CPU -le 1; #
rem # - if he is random, add a loop to make sure the task is fully started #
rem # before searching for his Process id. #
rem # #
rem # Technical informations: #
rem # - a VLC subpicture is composed of two windows Windows 10: #
rem # - one main, hidden, identified by his Process id and his hWnd; #
rem # - one child, used for display, identified by his hWnd; #
rem # - the hotkeys of VLC must be adressed to the child window; #
rem # - after sending to a child window, the only direct method to retrieve the #
rem # focus here, is the use of Task view by the send of Alt+Tab; #
rem # - NULL is a file created in the current path to log debug informations. #
rem # #
rem # Malfunctions: #
rem # - thin black border around the videos; unknown cause; #
rem # - --width and --height don't function; BUG VLC; here, --zoom is used; #
rem # the inconvenients are : #
rem # - necessity to adjust --zoom to obtain the wished size of the subpicture; #
rem # - loss of video quality in fullscreen (strike of F), because upscaling on a #
rem # reduced video resolution cannot be well displayed in the subpicture. #
rem # #
rem ##################################################################################
rem ##################################################################################
rem # Global variables initialization. #
rem # #
rem ##################################################################################
setlocal enabledelayedexpansion &rem necessary for array and for /f loop
set "title=Mosaic VLC"
set "Stars=********************" &rem for well identify results of debug
set "DllFwe='[DllImport("""user32.dll""")] public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, IntPtr lclassName, string windowTitle);'"
set "DllSfw='[DllImport("""user32.dll""")] public static extern bool SetForegroundWindow(IntPtr hWnd);'"
set ProcessId=0 & set hWmain=0 & set hWchild=0 &rem Initialization of the variables for returned values
set SubpictureOldInd=0
title %title%
echo %title% started >NULL &rem debug
rem New session (required for good use of SetForegroundWindow);
powershell -Command " & {(New-Object -ComObject Shell.Application).MinimizeAll()}" &rem Minimize all opened windows (likewise with WinKey+M)
rem ##################################################################################
rem # Launching of the four subpictures. #
rem # #
rem ##################################################################################
set "PathVlc=C:\Program Files (x86)\VideoLAN\VLC\"
set "PathVideo=F:\Vlc-de\"
set "Opt-0=--no-one-instance --no-one-instance-when-started-from-file --loop --no-repeat --no-embedded-video"
set "Opt-1=--swscale-mode=10 --qt-start-minimized --no-qt-video-autoresize --no-video-deco --no-video-title-show"
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=1 --video-y=1 --zoom=0.75 "%PathVideo%Video-1.mp4"
call :AudioToggle
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=961 --video-y=1 --zoom=0.75 "%PathVideo%Video-2.mp4"
call :AudioToggle
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=1 --video-y=541 --zoom=0.75 "%PathVideo%Video-3.mp4"
call :AudioToggle
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=961 --video-y=541 --zoom=0.75 "%PathVideo%Video-4.mp4"
call :AudioToggle
rem Informations given in the cmd window (Mosaic VLC).
echo ^ Select a subpicture, strike:
echo ^ ^ m to toggle audio mode
echo ^ ^ f to toggle fullscreen mode
echo ^ ^ n -^> next video
echo ^ ^ p -^> previous video
echo ^ ^ ~
echo ^ To quit, select Mosaic VLC
echo ^ and strike any key.
pause >>NULL
rem Select cmd and strike any key to quit all instances of VLC.
powershell $WS=New-Object -ComObject wscript.shell; While($WS.AppActivate('VLC (Direct3D output)')){Sleep 1; $WS.SendKeys([char]94+'q')}
exit
rem ##################################################################################
rem # FUNCTION AudioToggle -> to toggle the sound, using the hotkey M of VLC, for #
rem # ----------- one subpicture. #
rem # #
rem # Warnings: #
rem # - %, ", are significant characters for the command interpreter; for direct use,#
rem # they must be trebled; #
rem # - caret ^ is used at the end of a multiple lines command; its function is to #
rem # take the next character for his ASCII value, here New line; so, the caret #
rem # must be the last character of the line, and it's necessary to use Notepad or #
rem # equivalent to edit; #
rem # - to transmit online several return values from a PowerShell script to the #
rem # calling cmd, the only possible method is the using of Environment Variable; #
rem # the method used here ensures the good affectation in a cmd set statement. #
rem # #
rem ##################################################################################
:AudioToggle
set /a SubpictureOldInd+=1 &rem Increment the value of the variable by 1
set ProcessId=0 & set hWmain=0 & set hWchild=0 &rem Initialization of the variables for returned values
rem Line by line:
rem - get the Process id of the last subpicture started;
rem - waiting for the subpicture construction, and get the handle number of the MAIN window ($hWm);
rem - get the handle number of the CHILD window ($hWc);
rem - update the return value in the Environment Variable Vlc;
rem - set the focus to the CHILD window;
rem - the Sleep below is, only, to obtain a delay for listening the audio;
rem send the hotkey m to toggle audio, and retrieve immediately the focus for cmd.
powerShell $Pi=Get-Process 'vlc' ^| Where-Object{$_.CPU -le 1} ^| Select -expand ID; ^
Sleep 1; $hWm=(Get-Process -Id $Pi.ToString()).MainWindowHandle; ^
$FW=Add-Type -MemberDefinition %DllFwe% -Name Wfw -PassThru; $hWc=$FW::FindWindowEx($hWm,[IntPtr]::Zero,[IntPtr]::Zero,[String]::Empty); ^
[System.Environment]::SetEnvironmentVariable('Vlc', $Pi.ToString()+' '+$hWm.ToString()+' '+$hWc.ToString(), 'user'); ^
$SF=Add-Type -MemberDefinition %DllSfw% -Name Wsf -PassThru; $SF::SetForegroundWindow($hWc); ^
$WS=New-Object -ComObject wscript.shell; Sleep 4; $WS.SendKeys('m'); $WS.SendKeys('%%%{TAB}')
rem Get return value in Vlc; this syntax reg query is for a one line result of a command.
for /f "tokens=3-5" %%V in ('"reg query "HKCU\Environment" /v Vlc"') do (set ProcessId=%%V &set hWmain=%%W &set hWchild=%%X)
rem These variables are for future developments.
echo %Stars% Subpicture %SubpictureOldInd% ProcessId= %ProcessId% hWmain= %hWmain% hWchild= %hWchild% %Stars% >>NULL &rem debug
goto:eof
rem # End of the FUNCTION AudioToggle ################################################
Hello Thweiss,
With the help of stackoverflow.com experts, I jumped over the wall!
In order to not disturb this forum with my bad English, and Powershell, I send you an e-mail to info@vlc-forum.de, with object For Thweiss.
Thank you again for showing me the way.
Kind regards.
Edmund
Hello Thweiss,
Thank you very much for your links; I have progressed but I tap on a big wall!
To send a hotkey to one instance of VLC, I need to use SetForegroundWindow with the handle of the child window.
But, this function works only if the batch has the focus; after the start command for a subwindow, the batch loses the focus; I have tried AppActivate and other commands; IMPOSSIBLE.
After very much evenings of work, I'm giving up the choose, by the mouse, of the subpicture selectionned for the audio.
If somebody has an answer for this problem, it's would be very well; everything else of my program is terminated.
Thanks for your kindness.
Kind regards.
Edmund
Hello Thweiss,
I worked a lot with VLC; all my mosaics are converted to your method.
The most wonderful is the possibility, for any subpicture, to toggle subpicture - full screen- subpicture by striking the kotkey F.
To select the audio with, only, the move of the mouse cursor on the subpicture, the program is ended but, I have a problem; I cannot set the focus to any subpicture, excepted for the first who have the focus by default.
My hotkey is well received by any subpicture but, the only result is the blinking of the icon in the taskbar.
For each subpicture, I got the Process id, the hWnd of the MainWindow; I have tried AppActivate, SetForegroundWindow, and Set Focus without result.
If you know a specialist in PowerShell of cmd, thanks for advance for the transmission of my problem.
Thanks for your kindness.
Kind regards.
Edmund
Hello Thweiss,
Thank you for your reply.
Your late answer is not a problem; like jb, my evenings are very busy, but not for the same reasons!
I am looking for a perfect achievement of your wonderfull batch command; I want to select the audio with, only, the move of the mouse cursor on the sub-picture!
For an easy maintenance, I mix PowerShell commands in the batch; now, all the elementary actions are good, and I have a programming tip to communicate easily between batch and PowerShell.
I think about your problem of synchronisation; perhaps that you will find some ways to solve it; I take the control of each "sub-picture" with the PID (Process id), and the control of the entire screen, detecting the coordonates of the mouse cursor, anywhere.
My last command is well working on my computer, with VLC 2.2.6; for me, it's not a version problem that you have:
- your website has cutted my last line in two; warning,
powershell $WS=New-Object...Direct3D output)')){Sleep 1; $WS.SendKeys('$')} must be like here, in one line;
- in the german version of VLC, the title of the "sub-pictures" is it 'VLC (Direct3D output)'? if not, you have to update my command;
- I cannot test the hotkey to quit in the version 3; it's easy to verify; by the Preferences, you can give $ for hotkey to quit, and test it manualy.
I hope that these remarks will permit you to enjoy of the serial killing; if not, you can send to me an echo log.
I don't like Taskkill, and PowerShell Stop-process (generaly Forced to stop); the main reason is the accumulating of temporary files; often, the process have no time to delete.
I send again the batch command, with playlists.
@echo off
set "PathVlc=C:\Program Files (x86)\VideoLAN\VLC\"
set "PathVideo=D:\...\"
set "Opt-0=--key-quit=$ --no-one-instance --no-one-instance-when-started-from-file --loop --no-embedded-video"
set "Opt-1=--qt-start-minimized --no-qt-video-autoresize --zoom=0.75 --no-video-deco --no-video-title-show"
set "Opt-2=--noaudio" &rem Delete this option to obtain audio with any video (here, the first).
rem --width and --height are not working - BUG VLC; no solution for a loop with multiple video resolutions.
Title VLC - Mosaic
powershell (New-Object -ComObject Shell.Application).MinimizeAll() &rem Minimize all opened windows (likewise with WinKey+M).
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=1 --video-y=1 "%PathVideo%... .xspf"
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% %Opt-2% --video-x=961 --video-y=1 "%PathVideo%... .xspf"
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% %Opt-2% --video-x=1 --video-y=541 "%PathVideo%... .xspf
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% %Opt-2% --video-x=961 --video-y=541 "%PathVideo%... .xspf
echo Strike any key to quit mosaic
pause >null
rem Select cmd and strike any key to quit all instances of VLC.
powershell $WS=New-Object -ComObject wscript.shell; While($WS.AppActivate('VLC (Direct3D output)')){Sleep 1; $WS.SendKeys('$')}
Thanks for your kindness.
Kind regards.
Edmund
Hello Thweiss,
Thank you for your reply.
For the end of the batch (I don't like an hard Taskkill), I suggest :
echo Strike any key to quit mosaic
pause >null
rem Select cmd and strike any key to quit all instances of VLC.
powershell $WS=New-Object -ComObject wscript.shell; While($WS.AppActivate('VLC (Direct3D output)')){Sleep 1; $WS.SendKeys('$')}
You must add --key-quit=$ in Opt-0.
Remarks:
AppActivate need the exactely title (no wildcard character permitted); the order of activation is random; with an other object, and others applets, it's possible to exactely choose;
The duration of Sleep (in seconds) may be reduced, but slowly; if another process has a very higher priority, the SendKeys will be for him! To be sure, you must use [System.Windows.Forms.SendKeys]::SendWait("^{q}"), needless complication here.
The PowerShell command above may be usefull to activate hotkeys of VLC; I have tried to modify the sound level, and it's ok; but, you cannot choose the instance.
It's very difficult to catch a serial killer! Explanations:
my first SendKeys was SendKeys("^q"), ^ is the character to simulate the Control Key; it's well for PowerShell Windows but, without effect here; perhaps that the reason is the filtering of Ctrl, used by cmd; I have tried SendKeys([char]94+'q'), and... it's good ! (94 is the ASCII code for ^).
I have tried SendKeys('%{F4}') with Notepad; it's good; I have also tried with VLC (key-quit=Alt+F4); no result; for me, the reason is that VLC is waiting for the external coding of Alt+F4, and I send the internal coding.
To finish, I am very suspicious of the programming tricks, I have choosen a typographic character, unused as hotkey by VLC.
Thanks for your responsiveness.
Kind regards.
Edmund
Excuse-me; there is a mistake in a comment of my last message.
To minimize all windows, you must strike WinKey+M.
Sorry.
Edmund
Hello Thweiss,
Danke schön - WONDERFUL METHOD - Danke schön.
Your method (I didn't know) is better than mosaic for all : performance, display, and fps.
With an Asus ROG, core I7, SSD, screen Full HD 48 inches, for the example, I obtain:
- a true fps=30, identical at the videos, instead of 5 to 10 with mosaic;
- CPU: 23 %,very lower; GPU: 50 % (half VLC, half Desktop Windows Manager),a few upper.
Your batch is perfect; only some very little problems:
- the "subpictures" are not synchronised in the same window; if several process are running, some "subpictures" may be hidden; my solution, in the batch below, is a PowerShell command for minimize all the active windows;
- to kill all the instances running of VLC, we need a serial killer! My bad solution, in the batch above, is a Taskkill; it would be better to terminate each instance with Ctrl+q; I have not yet found the method in a single line of command of PowerShell (Get-Process VLC* | Foreach-Object { $_.CloseMainWindow() | ... } | ... SendKeys Ctrl+Q);
- the taskbar is not hiding in the same way as with FullScreen; it's not important; when I will have a few minutes, I will look for getting a temporary floating taskbar.
A big progress with your method is the possibility to choose easily the audio to play.
Here is your customised batch:
@echo off
set "PathVlc=C:\Program Files (x86)\VideoLAN\VLC\"
set "PathVideo=D:\...\"
set "Opt-0=--no-one-instance --no-one-instance-when-started-from-file --repeat --no-video-deco --no-embedded-video --qt-start-minimized --no-video-title-show"
set "Opt-1=--noaudio" &rem Delete this option to obtain audio with any video (here, the first).
powershell (New-Object -ComObject Shell.Application).MinimizeAll() &rem Minimize all opened windows (likewise with WinKey+D).
start "" "%PathVlc%vlc.exe" %Opt-0% --video-x=1 --video-y=1 --zoom=0.5 "%PathVideo%...-1280x720.mp4"
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=961 --video-y=1 --zoom=0.75 "%PathVideo%...-1280x720.mp4"
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=1 --video-y=540 --zoom=0.75 "%PathVideo%...-1280x720.mp4"
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=961 --video-y=540 --zoom=0.75 "%PathVideo%...-1280x720.mp4"
pause
rem Select cmd and strike any key to quit all instances of VLC.
taskkill /IM VLC* /f
Thanks for your work.
Kind regards.
Edmund
Hello Thweiss,
Danke schön.
Videolan is lacking in informations; I am obliged to surf on the videolan forums; sorry, your forum is the best! with true replies, and the only where I wanted to subscribe.
"My command line example works fine with the VLC Version 2.2.8 (32-Bit). With the VLC Versions 3.0.0 (32-Bit and 64-Bit) I always get an application error."
This news is not happy; are-you searching another method for the last version of VLC?
Thanks in advance for your reply.
Kind regards.
Edmund
Hello,
I have a problem with the mosaics high resolution.
With a HD windows, all is good; with Full HD, the video is jerky, but continued; the visual fps is around 5.
It's surprising with a CPU busy around 30 %; here is the VLM file used, with VLC 2.2.6:
del all
new BG broadcast enabled
setup BG input file:///"D:\...-1920x1080.png" option image-fps=0 option image-duration=-1
setup BG output #transcode{vcodec=mp4v,acodec=none,scale=auto,vb=5000,fps=0,sfilter=mosaic{width=1920,height=1080,keep-picture,position=2,offsets="0,0,960,0,0,540,960,540",cols=0,rows=0,order="1,2,3,4"}}:display
new C1 broadcast enabled
setup C1 input file:///"D:\...-1280x720.mp4"
setup C1 output #mosaic-bridge{id=1,width=960,height=540}
setup C1 loop
new C2 broadcast enabled
setup C2 input file:///"D:\...-1280x720.mp4"
setup C2 output #mosaic-bridge{id=2,width=960,height=540}
setup C2 loop
new C3 broadcast enabled
setup C3 input file:///"D:\...-1280x720.mp4"
setup C3 output #mosaic-bridge{id=3,width=960,height=540}
setup C3 loop
new C4 broadcast enabled
setup C4 input file:///"D:\Films\...-1280x720.mp4"
setup C4 output #mosaic-bridge{id=4,width=960,height=540}
setup C4 loop
control BG play
control C1 play
control C2 play
control C3 play
control C4 play
The bottleneck seem to be at the input level; I have tried to delete sound, to modify file-caching, and the using of GPU, without positive result.
On this forum, the resolutions of mosaic are always lower; is the resolution of my example too high for VLC?
Thanks for advance for your reply.
Kind regards.
Edmund