PLEASE! I need help controlling VLC programmatically! Desperately!

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
spection
Blank Cone
Blank Cone
Posts: 46
Joined: 04 Feb 2009 03:07
Operating System: Windows

PLEASE! I need help controlling VLC programmatically! Desperately!

Postby spection » 27 Jul 2019 05:30

The documentation here described several different interfaces for controlling VLC on Windows other than with the GUI, but I desperately need suggestions and advice concerning which to use, and no one has been willing to help. :cry:

I will have several independent instances of VLC or VLC Portable running simultaneously (I will not be using playlists). ALL I need to to is to hard-pause and hard-play (that is, NOT toggle) any given instance. Hell, I don't even need the hard-play if it's too difficult. It would also be nice -- but not mandatory -- to enlarge the decorated (i.e., embedded?) VLC window NOT to full screen, but one step smaller, such that the menu bar remains visible but the window otherwise fills the screen.

I've looked into the we/http interface, but it absolutely will not let me connect to localhost, no matter which port I choose.

I've looked into the command line interface, but it doesn't look like I can control an already-running instance that way (if I'm wrong, please let me know).

I've looked at sending Windows messages to control it, but there is effectively ZERO documentation on the subject at all.

I've looked at using Lua scripts, but there's no indication that I can hard-pause any specific instance that way (since I won't be using playlists). And I've asked for help elsewhere, but no one answers.

So is there any way to do something so extremely simple or not? Please, PLEASE, I beg you! Please HELP me!?

Thanks

Ed Edison
Blank Cone
Blank Cone
Posts: 33
Joined: 20 Nov 2018 20:05

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby Ed Edison » 27 Jul 2019 19:45

Hello,

I'm not sure I understand your question.
I do not know the possibility of VLC you are talking about.
Personally, I control multiple instances of VLC using PowerShell, and Windows DLLs in a PowerShell script.
For the main window and its child windows, it is possible to transmit anything that could come from the keyboard and get information.
The control of the mouse is a bit more complicated, but achievable.
If you're ready to use PowerShell, I may be able to help you with your explanations.

Ed.

spection
Blank Cone
Blank Cone
Posts: 46
Joined: 04 Feb 2009 03:07
Operating System: Windows

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby spection » 27 Jul 2019 21:33

Thank you enormously! Hooray for Ed!

I'm coding in AutoIt, which has even more power and capability than PowerShell, including the ability to directly access DLLs. But PLEASE don't let that dissuade you from helping me with how you do it with PowerShell, since Its very probable that I can translate PowerShell code to AutoIt. So please carry on, kind sir!

First, mouse control is easy in AutoIt. More importantly, I already know the PIDs, command lines, and window handles of all the VLC instances (main video window handle and child window handles), and I know how to send messages and key "presses" to generic applications. But I can't figure out how to send them to only one specific instance of VLC. And I don't know which, if any, child window(s) I should care about and access. Note that when I try to send key presses to VLC, nothing happens, such as when I try to send a space character to toggle play/pause. Nor does anything happen when I try to send Alt sequences (taking into account the underlined characters correctly) to select a particular menu item. Nothing happens.

To close for now, here's why I'm so extremely happy with your reply: You're describing a method that is IDEAL to me! That is the approach I've always wanted to use, rather than trying to figure out these terribly under-documented alternative control interfaces.

Thanks again, Ed, and I eagerly look forward to working with you!

Ed Edison
Blank Cone
Blank Cone
Posts: 33
Joined: 20 Nov 2018 20:05

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby Ed Edison » 27 Jul 2019 22:53

Hello,

I will be happy to share my knowledge with you, but I am neither a system specialist nor very good in English!
I do not know AutoIt.

Some remarks, and to my knowledge, following your explanations:
- to receive a message, the target window MUST have the focus; to give the focus, there are many restrictions imposed by Windows; to work around the difficulty, I use a third-party task;
- you have the PID's and hWnd's; the hwnd is the most important to address a VLC instance (very often a child window);
- finally, to properly identify an instance, I use the title customised.

Among other things, I use PowerShell for a four-window mosaic display with a small control software; when I have a few minutes, I comment a little and I post it.

Precisely, for your lost sends, I think that the target window does not have the focus because the transmitter has kept it; for verify, put a wait order after your send and strike the key with the keybord; if nothing occurs, your destination window don't have the focus and your send is queued... and lost if the destinary ignore it.

Ed.

spection
Blank Cone
Blank Cone
Posts: 46
Joined: 04 Feb 2009 03:07
Operating System: Windows

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby spection » 28 Jul 2019 00:42

Thank you once again, sir -- You've helped already! I have to work on the setting the focus, so I'll start there.

But please post your PowerShell code when you have the chance. I'm sure it will help me quite a bit.

Have a great day, and don't worry about your English -- it's just fine!

spection
Blank Cone
Blank Cone
Posts: 46
Joined: 04 Feb 2009 03:07
Operating System: Windows

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby spection » 28 Jul 2019 08:42

Okay, I've got the main stuff working! I spent a lot of time trying to use the Win32 API function "SetFocus()", but I always got an access error, even after using OpenProcessToken() and AdjustTokenPrivileges() functions to allow access privilege. It was driving me crazy, until I realized there was a much simpler alternative: Simply Activate the window (WinActivate)! Then I sent a sequence of keys to select the Playback menu and then down 10 times to choose the Stop menu item. First mission accomplished.

But it's also important to be able to "hard-pause" the video where it is (rather than Stop it or just toggling the state with menu item 9). For that, I need to know the current state: Is the video playing or paused? How do I obtain this info?

In your first reply, you mentioned being able to get information from VLC, which is the heart of that question. How is that accomplished, please?

Thanks again!

Ed Edison
Blank Cone
Blank Cone
Posts: 33
Joined: 20 Nov 2018 20:05

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby Ed Edison » 28 Jul 2019 18:10

Code: Select all

@echo off rem ################################################################################## rem # Mosaic Zumba -> from Zumba I to Zumba IV # 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; here, forced to 1.5; # 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 ##################################################################################

Ed Edison
Blank Cone
Blank Cone
Posts: 33
Joined: 20 Nov 2018 20:05

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby Ed Edison » 28 Jul 2019 18:11

[coderem ##################################################################################
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=D:\Films\Danse\Zumba\"
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.5 "%PathVideo%Zumba_I\Zumba_1.xspf"
call :AudioToggle
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=961 --video-y=1 --zoom=0.5 "%PathVideo%Zumba_II\Zumba_2.xspf"
call :AudioToggle
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=1 --video-y=541 --zoom=0.5 "%PathVideo%Zumba_III\Zumba_3.xspf"
call :AudioToggle
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=961 --video-y=541 --zoom=0.5 "%PathVideo%Zumba_IV\Zumba_4.xspf"
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][/code]

Ed Edison
Blank Cone
Blank Cone
Posts: 33
Joined: 20 Nov 2018 20:05

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby Ed Edison » 28 Jul 2019 18:13

Code: Select all

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.5} ^| 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 ################################################

Ed Edison
Blank Cone
Blank Cone
Posts: 33
Joined: 20 Nov 2018 20:05

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby Ed Edison » 28 Jul 2019 18:20

Remarks :
I do not understand the limit of number of characters for such a small module;
for fun, my program has been written with a lot of tips and tricks; do not use this method for a real program, and add tests for robustness.
Have fun!

Ed.

spection
Blank Cone
Blank Cone
Posts: 46
Joined: 04 Feb 2009 03:07
Operating System: Windows

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby spection » 12 Aug 2019 20:58

I apologize, Ed, for failing to come back here to let you know that you helped a very great deal! Thank you!!

I'd still like some way of either putting VLC in a known state (playing or paused) -or- inquiring the current state from VLC, but it seems you need to script with lua and I can't figure out how to do that. Reading several lua scripts hasn't helped.

joefiesta
Blank Cone
Blank Cone
Posts: 25
Joined: 29 Oct 2012 15:55

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby joefiesta » 27 Dec 2019 17:02

I am not a user of AutoIt. I use Autohotkey. It is my UNDERSTANDING--not knowledge--that AutoHotkey (AHK) is much more robust. I can also tell you it has a very active user forum. As a programmer of some 50 years, I can also tell you it is A GREAT BIG PAIN THE NECK TO LEARN. It appears to be a conglomeration of code and styles from multiple languages. The variable syntax in itself is abominable. There are is AHK version 2, which you should problably stay clear of. It is not finished for all intents and purposes. And not backward compatible with AHK version 1. It's intended to clean up some of the mess of version 1, but i'm not sure how many use it. As a newbie, however, it may be the place to start.

I use AHK to automate all sorts of things. In my mind, there is NOTHING it can not do in a windows os.

With AHK there is little problem keeping track of what window is what. It can send commands to the Active window, but it can also send commands to inactive windows. It can also send commands from one script to another!

I could go on forever about it how wonderful it is and how horrible it is. (I've been using it over 10 years and still have great pains dealing with it's VERY thorough yet poorly organized documentation.)

Small example: Get the name of the file playing in VLC. I first found I had to set $F option (Undocumented) for some such thing somewhere in VLC to show TITLE in Window Title. And then I have to translate from HTML format (all the %20% crap etc). I now get it from the .INI

My script--actually a function which must be called from a script--to discern VLC playing fileid. This is only the beginning of course. With the fileid, now can do all sorts of things.

VLCFilePlaying() {
; Get the fileid of the file VLC is playing.
;
; Returned values:
;
;
; -1 - VLC is not the active window. OBSOLETE
; -1 - VLC qt ini file error.
; -2 - VLC is not playing a file.
; -3 - VLC window title does not include a fully-qualified fileid
; allother - The full path of the file VLC is playing.
;
VLCqtIni = %a_appdata%\vlc\vlc-qt-interface.ini
If !FileExist(VLCqtIni)
return, "-4 VLC qt ini file not found. INIfile=" VLCqtIni
IniRead, RecentsMRL_list, %VLCqtIni%, RecentsMRL, list, error
if (RecentsMRL_list = "error")
return, "-1 Error reading key 'LIST' of section 'RecentsMRL' from VLC qt ini file '" VLCqtIni "'"
Playing := substr(RecentsMRL_list,1,instr(RecentsMRL_list,",")-1)
Playing := substr(Playing,9) ; strip "file:\\\" from start
Playing := StrReplace(Playing,"%20"," ")
Playing := StrReplace(Playing,"%21","!")
Playing := StrReplace(Playing,"%23","#")
Playing := StrReplace(Playing,"%24","$")
Playing := StrReplace(Playing,"%25","%")
Playing := StrReplace(Playing,"%26","&")
Playing := StrReplace(Playing,"%27","'")
Playing := StrReplace(Playing,"%28","(")
Playing := StrReplace(Playing,"%29",")")
Playing := StrReplace(Playing,"%2B","+")
Playing := StrReplace(Playing,"%2C",",")
Playing := StrReplace(Playing,"%2D","-")
Playing := StrReplace(Playing,"/","\")
Return, Playing
}

joefiesta
Blank Cone
Blank Cone
Posts: 25
Joined: 29 Oct 2012 15:55

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby joefiesta » 27 Dec 2019 18:00

And, yes. There is No way to HARD stop VLC that I know of. The Browser_stop and Browser_Pause functions shown in the hotkeys menu don't do anything. It looks like that is because WINDOWS does not support these two functions. Autohotkey, for example, only has:

Media_Next Next Track
Media_Prev Previous Track
Media_Stop Stop
Media_Play_Pause Play/Pause

(As well as Browser_xxx functions). None of these does a HARD stop or PAUSE.

One way I create what could be considered a HARD PAUSE is (and this is VERY clumsy, mind you):

1. Set setting so that RESTART of file starts where it left off
2. STOP
3. do what you have to do .... (while in this "virtual" pause state)
4. PLAY same file.

This allows me to "Pause" a file, open it's properties, set a comment or change my rating or even delete it, and then continue (if I didn't delete!). All done with AHK and hitting a key or two.

Another way would be to look at the cpu usage (or some other value) of the program, see if it increasing, etc. etc... very messy. this would determine play/pause state.

johnoo
New Cone
New Cone
Posts: 2
Joined: 17 Jan 2022 18:13

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby johnoo » 17 Jan 2022 18:31

Hello guys,
I am newbie. I know a little PowerShell and heard recently and installed AutoHotkey. Why I am writing here is because:
I record with screen recorder (OBS) tv (available only via webapp so not able to load it to VLC). Movies and things I record have ads.
What I would love to is to make a script where either Vlc loads the movie with ads and cuts out them based on given time and saves it into some 720p video but something small.
Or my first intention was that I script vlc to when it comes to specific point of time it jumps to another (jumps over ad) and my screen recorder (OBS) will be able to record it without interruptions.
But my problem was to load rc into powershell (it opens in other window; I use conemu terminal) and have not found way to precisely navigate with seek (only seconds not milliseconds) - I thought that could be achieved with AHK script.
Can you help me with this or give a hint what should I look for or what would be right approach?
I could use some video cutting sw like openshot but my laptop is x230 - i5-3rd gen, integrated graphics, 4GB DDR3 so that looks to be done in many hours.

Johnoo

joefiesta
Blank Cone
Blank Cone
Posts: 25
Joined: 29 Oct 2012 15:55

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby joefiesta » 18 Jan 2022 18:51

ha ha! good luck editting videos. VLC does nothing except allow you to record/stop. And splicing out makes individual files and I can't figure out how to combine them. I tried learning AVIDEMUX, but it SO complicated--basically for a professional film editor--that I gave up.

And recording with VLC is basically absurd 3rd grade stuff since it only records what is being played.

As to your installing Autohotkey, Congrats! It is the best thing since sliced bread.

Here is one sample of the AHK code I use to control VLC. Oh, and btw, I won't go past VLC 2.6 because newer versions bother me. For example, I can't control the font size of the playlist with versions past 2.6.

See attached file. never mind. i don't see a way to attach a file here. Was going to add a LOT. here is a start:

Code: Select all

;=============================================================================== ;========= VLC - media player AND VLC playlist *Hotkeys* =========== ;=============================================================================== ; The following is no longer valid, because VLC is now run by the renamed ; VLC_vendor.exe. 20200514: ;;;#IfWinActive, Playlist ahk_exe vlc.exe ; VLC Playlist #IfWinActive, Playlist ; VLC Playlist !^s:: ; Alt + Ctrl + s - Resave VLC Playlist run %ahk_exe% /restart "%ahk_macros%\SaveVLCPlaylist.ahk" "Prompt", %pgmfiles%\Autohotkey return #IfWinActive, VLC media player ; VLC media player ; The following is no longer valid, because VLC is now run by the renamed ; VLC_vendor.exe. 20200514: ;;;#IfWinActive, VLC media player ahk_exe vlc.exe ; VLC media player !^s:: ; Alt + Ctrl + s - Resave VLC Playlist run %ahk_exe% /restart "%ahk_macros%\SaveVLCPlaylist.ahk" "Prompt", %pgmfiles%\Autohotkey return ; $ in the following allow the hotkey to send it's own value (without triggering ; the hotkey again!) ; Alt+Ctl+Right/Left are LONG jumps (forward and backward) $!^Left:: Send, !^{Left} ; Alt + Ctrl + Left : Native function for VLC $!^Right:: Send, !^{right} ; Alt + Ctrl + Right : Native function for VLC F5:: Send, !^{left} ; jump back - long F6:: Send, ^{left} ; jump back - medium F7:: Send, !{left} ; jump back - short F8:: Send, +{left} ; jump back - very short F9:: Send, +{right} ; jump forward - very short F10:: Send, !{right} ; jump forward - short F11:: Send, ^{right} ; jump forward - medium F12:: Send, !^{right} ; jump forward - long

joefiesta
Blank Cone
Blank Cone
Posts: 25
Joined: 29 Oct 2012 15:55

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby joefiesta » 18 Jan 2022 18:52

btw. I have thousands of lines of much more complex stuff for VLC, but the forum doesn't allow me to post much.

1. yes, SaveVLCPlaylist.ahk is not documented or included here. It automates RESAVING the playlist to the same file or a new file.

2. yes, some of the variables are defined here. this is an extract.

Most important: VLC must be the active window for this code to work. You can't really write code to do things to a window from anywhere. You can,, but: the hotkeys you define trigger no matter what the active window is. So, e.g. PF5 would send "Alt + Ctrl + LEFT" to whatever the active window is. Not cool.

To make "universal" hotkey functions for a program, you need to create a context menu designed for just that program. I can show that if you get this far. You create a SINGLE, COMPLEX hotkey to execute from anywhere that shows a menu of choices for your appropriate program.

johnoo
New Cone
New Cone
Posts: 2
Joined: 17 Jan 2022 18:13

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby johnoo » 18 Jan 2022 22:37

Hello Joe,

thanks for input. AHK script saved.
Regarding editing videos: I think this "many hours" with openshot took when I cutted some long movie. Our TVs make from 2h movie 3h15 - with ads so cutting took ages and saving because of old machine as well - some time ago but new version of openshot has better hw decoding support - has support for i5 3rd gen which cuts the saving time in half and I realized if I screenrecord or "VLC record" it takes pretty similar time let's say 40min with 2x6.5 min ads 53 minutes and saving with openshot took around 50 minutes so not sure where I got long hours and now with their format mp4 qsv (qsv if hw decoding for intel 3rd gen) it is half of that.
Back to the topic I realized that fine cutting of ads (from frame ads starts till end) takes lot of time and because we get every day 1 part - I need 1h to screenrecord it later 1h for cutt it thats so long. So realized that I might just use AHK to pause when ads and pause when end and that is it.

But I wanted to know if VLC is able to help me somehow in this big effort.

Hitchhiker
Big Cone-huna
Big Cone-huna
Posts: 2203
Joined: 29 Jun 2018 11:40
VLC version: 3.0.17.4
Operating System: Windows 8.1
Location: The Netherlands

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby Hitchhiker » 19 Jan 2022 10:11

Your best bet would be to peruse the existing repositories at https://github.com/topics/vlc and to check whether what you're proposing exists already or not. If there's something similar then you could contact the author for advice. There are currently 441 repositories on the Github site.

joefiesta
Blank Cone
Blank Cone
Posts: 25
Joined: 29 Oct 2012 15:55

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby joefiesta » 20 Jan 2022 05:49

AHK can not detect when an AD is playing. Essentially, I don't want can, unless, like some television show from way back, the signal includes the information that an ad is starting/stopping. I remember I had--think I still have it--a vcr that recognized commercials. But, it only recognized them upon playback and then fast forwarded through them. I have decided the best way is to forget, while recording, about the ads or what you want to skip during playback and just make it easier to skip the ads durring playback. Whick is why my sample code shows my hotkeys for skipping forward (F9-F12) and skipping backward (F5-F8). I find this hotkeys I have defined so much easier to remember as opposed to hotkeys VLC defines for these functions (jump forward, very short; jump forward, short; etc....).

As to moving fractions of a second... I don't know. I'll look into it though and see what I find.

joefiesta
Blank Cone
Blank Cone
Posts: 25
Joined: 29 Oct 2012 15:55

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby joefiesta » 26 Jan 2022 00:16

got it!!!

however, I am very confused about what you want, but it certainliy looks like I've found what you need.
all the following assumes that you are going to use Autohotkey for your solution. It's the only way I know--and want to know--how to program window automation.

so,


1. Firstly, you say you can't send a SPACE (character) to VLC. You're doing something wrong, but it's easy.
The following is all you need in your ahk script. Pressing F3 toggles play/pause.


#IfWinActive, VLC media player
F3::
send {space}
return

Now. that assumes you have only 1 instance of VLC active. It gets MUCH more complicated when you have 2 or more. (I never run multiple VLC instances, so have no such complications to deal with. KISS: Keep it simple, stupid.) If each VLC runs a different .EXE file, it's not too difficult.

joefiesta
Blank Cone
Blank Cone
Posts: 25
Joined: 29 Oct 2012 15:55

Re: PLEASE! I need help controlling VLC programmatically! Desperately!

Postby joefiesta » 26 Jan 2022 00:19

2. there are ways to move forward/backward to an EXACT time. but, automating it is gonna be complicated. Check out the "jump to time" option in the VIEW"" menu. It's a little complicated and I did not find any explanation anywhere.


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 89 guests