Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,165
|
VD_EdChap - Make Chapter list using VDub2
VD_EdChap - Make Chapter list using VDub2
EDIT: Prompted by this thread:- https://forum.doom9.org/showthread.php?t=184059 he evenutually wanted a chapter list for MPC-HC Updated v0.01 Code:
VD_EdChap v0.01 for VirtualDub2. By StainlessS @ Doom9:- https://forum.doom9.org/showthread.php?t=184191 VD_EdChap, intended to assist in creating Chapter/BookMark time files. Requirements: VirtualDub2 x86 or x64, build 44282 or higher. [VirtualDub Standard or VirtualDubMod are non suitable]. Windows NotePad [will not work where windows system NotePad replaced with some other editor via some registry hack]. On running VD_EdChap, it will present a GUI dialog box with options, FractionSeparatorIsPeriod: Unticked=0=COMMA : Ticked=1=PERIOD (Default non exisitng ini=0) # Written Time fractional seconds separator. WriteChapterTitles: Unticked=0=No : Ticked=1=Yes (Default non exisitng ini=0) # 1 will ask user to input title for each Chapter. After clicking OK on above mentioned GUI dialog, it will become invisible but watching and waiting for key presses when VDub2 is in the foreground. You can call up the Hot GUI again later(CTRL/PAUSE or CTRL/HOME), if you eg maybe later decide to write chapter titles [Affects only chapters written AFTERWARDS]. If a VD_EdChap.Ini file does not exist in same directory as VD_EdChap.exe then it will be created, and will be updated whenever the GUI is closed. After Initial closure of the VD_Edkey GUI, if NotePad is not running, it will be started up for you, you can save to a filename then, Or, will be prompted for a filename when writing the first chapter. VirtualDub2 is not auto started. Usage, You can scroll through a video clip in VDub2, and press CTRL/INSERT to insert the current frame time into the NotePad window at current NotePad cursor position, if opted for in GUI will also prompt user for a chapter title, which will also be written, and then a NewLine will also be written moving the cursor down 1 line, and the NotePad file will be flushed to disk [Asking for Filename if not previously named/saved]. You can use the CTRL/PAUSE (or alternative CTRL/HOME) key combo at anytime to bring up the Hot GUi, but VDub2 must be the foreground window when using the CTRL/INSERT combo to insert the current VDub2 time into the NotePad window. VD_EdChap Keyboard commands:- CTRL/INSERT ::: Insert Chapter into NotePad window using current Vdub2 time. (NotePad must be visible, and VDub2 the active window) CTRL/PAUSE ::: Hot GUi CTRL/HOME ::: Alternative Hot GUI {Some keyboards may not have both sets of Hot GUI keys} CTRL+SHIFT+ALT+PAUSE ::: Terminate VD_EdChap Program (or close via System Tray icon). PAUSE is also known as BREAK, usually next to Scroll Lock. CTRL+END ::: Alternative VD_EdChap Terminate Program. ########################################################################################### NOTES:: VDub2 opens most video files just fine, does not have to be *.AVI. VDub2 must be stopped when you press CTRL/INSERT, else it will not be able to write a chapter into NotePad file [SPACE bar both starts and stops VDub2 play]. It is important to NOT do any VirtualDub2 clip editing, if you eg delete a frame in VirtualDub2, then all frames after that frame will be off by 1, and so all VD_EdChap times inserted later into NotePad file will be also off by 1 frame. MPC-HC, auto loads *.xchp files of same base name as movie file, so perhaps create empty MovieName.txt or MovieName.xchp in NotePad, and VD_EdChap will use that instance of Notepad instead of auto running the NotePad app. It is easy to see what is happening as the NotePad window will be visible and after each insertion into NotePad, an ENTER key will also be sent to move the cursor down one line, each chapter is on its own line. If you make a mistake, it is easy to just switch to NotePad window and delete the erroneous line. Chapters are inserted at the current NotePad position, so you can go back and insert chapters earlier in the notepad file. Its lovely to have a 2nd monitor for the NotePad window (if your graphics card supports), my Number 1 machine has a 19" 4:3 HP monitor that cost me £1.50 2nd hand (used) but in perfect condition, nobody wants them anymore, HeHeHe!. My No 2 m/c has similar 19" but cost a bit more some time ago. [2nd monitor is 'the dogs bollocks' for showing Debug Info via DebugView (google)] [EDIT: 'The Dogs Bollocks', Taste so good, you can't stop licking them :) ] MPC-HC does order *.xchp chapters when loading, so they do not have to be in exact order already. MPC-HC, PageUp, and PageDown, jump through the chapters. If your system is configured to open txt files via some other text editor (Open With), thats OK [We though MUST still use Windows STANDARD NotePad], only is problem when it is NOT possible to to execute system NotePad at all because of registry hack where opens some other editor [we need original NotePad.Exe name and also must have exact same control names and instances used inside of the executable]. NotePad2 (well one of the editors called NotePad2) is one of those that can be installed to totally replace system NotePad, if you do a few edits (4 lines) near beginning of the source, you can re-compile and it should work OK with that hacked editor. ########################################################################################### VD_EdChap.Ini file format (Defaults as set when creating New ini file :: Comments following '#' exist in this readme file only, not in the ini file.) >>>>>------------------->>> [Default] FractionSeparatorIsPeriod=0 # Time format for Fractional Seconds, 0=COMMA(,) 1=PERIOD(.) WriteChapterTitles=0 # Prompt user for, and write Chapter title, 0=No, 1=Yes. <<<-------------------<<<<< ########################################################################################### AutoiIt compiled executable with source provided, just click Menu Tools/build to create executable (In Scite4AutoIt3 editor). Requires AutoIt3 and Scite4AutoIt3 editor to re-build executable. ssS Or directly here:- https://www.mediafire.com/file/wwzcv...20613.zip/file EDIT: Here, a similar utility for creating frames file instead of times file[VD_EdKey]:- https://forum.doom9.org/showthread.p...light=VD_EdKey UPDATED.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 13th June 2022 at 19:27. Reason: Update |
![]() |
![]() |
![]() |
#2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,165
|
AutoIt Source, [included in the zip]
Code:
#cs ---------------------------------------------------------------------------- This program is free software; you can redistribute it and/or modify it under an terms terms you like. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use at you own risk. #ce ---------------------------------------------------------------------------- ; VD_EdChap v0.01 by StainlessS ... compiled with AutiIt v3.3.14.5 ; Insert Current Frame time #pragma compile(inputboxres, true)" #include <MsgBoxConstants.au3> #include <Misc.au3> #include <Math.au3> ; Only for _Max() function ; #include <GuiButton.au3> ; KEEP OFF THE GRASS. #include <GuiConstantsEx.au3> ; Do Not TOUCH. ; Opt("MustDeclareVars", 1) ;;; Global Const $AUTOIT_APP_NAME = "VD_EdChap.Exe" Global Const $AUTOIT_APP_INI = "VD_EdChap.ini" Global Const $APPTitle = "VirtualDub2" ; VirtualDub2 matches as "VirtualDub2" with traiiling "Build number" on title bar. Global Const $Watching = " VD_EdChap is WATCHING " Global Const $VdFrameNo = "[CLASS:Static; INSTANCE:1]" ; Frame Indicator box (bottom middle of window, just above status line) ; ; Format eg, "Frame 4871 (0:03:23.161)[B]" ; ; CAN CHANGE below to change editor, use AutoIt Au3Info program to get names (try 1st with NotePad.exe to see how to use it). Global Const $NOTEPAD_TITLE = "[CLASS:Notepad]" ; NotePad Window name. Global Const $NOTEPAD_EDITCONTROL = "[CLASS:Edit; INSTANCE:1]" ; NotePad text editor window control. Global Const $NOTEPAD_EXE = "NotePad.Exe" Global Const $NOTEPAD_SAVE_KEY = "^{s}" ; Send CTRL/S to NotePad, ie Save (FileSelector pop-up if not named) ; eg for NotePad2, Comment out above 4 lines and uncomment below two lines (Semi Colon is comment character). ; After changes, in AutoIt SciTE source editor, hit F7 to rebuild executable. (probably the same key in the basic AutoIt included editor). ;Global Const $NOTEPAD_TITLE = "[CLASS:Notepad2]" ; NotePad2 Window name. ;Global Const $NOTEPAD_EDITCONTROL = "[CLASS:SysListView32; INSTANCE:1]" ; NotePad2 text editor window control. ;Global Const $NOTEPAD_EXE = "NotePad2.Exe" ;Global Const $NOTEPAD_SAVE_KEY = "^{s}" ; Send CTRL/S to NotePad, ie Save (FileSelector pop-up if not named) ; ; Special symbols for key combos :- "^" = CTRL : "+" = SHIFT : "!" = ALT : "#" = Windows Key Global $Key_Insert_1 = "^{INSERT}" ; CTRL/INSERT Insert Chapter ; Global $Key_HotGUI_1 = '^{PAUSE}' ; CTRL/PAUSE Hot GUI Global $Key_HotGUI_2 = '^{HOME}' ; Alternative Hot GUI (CTRL/HOME) ; Global $Key_Terminate_1 = "^+!{PAUSE}" ; CTRL/SHIFT/ALT/PAUSE {PAUSE aka BREAK} is TERMINATE Program (or close via System Tray icon) Global $Key_Terminate_2 = "^{END}" ; Alternative Terminate, CTRL/END ; Global $Doze = 250 Global Const $ShowCntLimit = 2000 / $Doze Global $InAPP = False Global $ShowCnt = 0 ; ini file defaults (If ini Not already existing in APP directly) Global $FractionSeparatorIsPeriod = 0 ; 0=COMMA, 1=PERIOD Global $WriteChapterTitles = 0 ; 0=No, 1=Yes ; If _Singleton($AUTOIT_APP_NAME, 1) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "An occurrence of " & $AUTOIT_APP_NAME & " is already running") Exit EndIf ; Get defaults from ini file (if exists). $FractionSeparatorIsPeriod = IniRead(@ScriptDir & "\" & $AUTOIT_APP_INI, "Default", "FractionSeparatorIsPeriod", 0) $WriteChapterTitles = IniRead(@ScriptDir & "\" & $AUTOIT_APP_INI, "Default", "WriteChapterTitles", 0) Func UpdateIni() ; Update ini file. FileDelete(AppendSlash(@ScriptDir) & $AUTOIT_APP_INI) IniWrite(@ScriptDir & "\" & $AUTOIT_APP_INI, "Default", "FractionSeparatorIsPeriod", $FractionSeparatorIsPeriod) IniWrite(@ScriptDir & "\" & $AUTOIT_APP_INI, "Default", "WriteChapterTitles", $WriteChapterTitles) EndFunc ;==>UpdateIni UpdateIni() Func GUI() ; GUI Local $hGuiWnd = GUICreate($AUTOIT_APP_NAME & ' © StainlessS', 360, 260) Local $FractionSeparatorIsPeriodCN = GUICtrlCreateCheckbox('Fraction Separator Is Period', 10, 10, 240, 20) GUICtrlSetState($FractionSeparatorIsPeriodCN, ($FractionSeparatorIsPeriod <> 0) ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetTip($FractionSeparatorIsPeriodCN, '0=COMMA : 1=PERIOD' & @LF) Local $WriteChapterTitlesCN = GUICtrlCreateCheckbox('Write Chapter Titles', 10, 30, 240, 20) GUICtrlSetState($WriteChapterTitlesCN, ($WriteChapterTitles <> 0) ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetTip($WriteChapterTitlesCN, 'Asks user input for Chapter Title' & @LF) Local $OK_X = 164 Local $OK_Y = 220 Local $OK_W = 40 Local $OK_H = 30 Local $OKbutCN = GUICtrlCreateButton('OK', $OK_X, $OK_Y, $OK_W, $OK_H) GUISetState(@SW_SHOW) ; Show the GUI ; GUI MESSAGE LOOP, Run the GUI for a long time, or until the dialog is closed. Local $Msg Do $Msg = GUIGetMsg(1) If $Msg <> 0 And ($Msg[0] = $GUI_EVENT_CLOSE Or $Msg[0] = $OKbutCN) Then $FractionSeparatorIsPeriod = BitAND(GUICtrlRead($FractionSeparatorIsPeriodCN), $GUI_CHECKED) $WriteChapterTitles = BitAND(GUICtrlRead($WriteChapterTitlesCN), $GUI_CHECKED) ExitLoop EndIf Until (1 + 1 <> 2) ; For a long time, ... 4E4 GUIDelete($hGuiWnd) ; Delete GUI UpdateIni() Return ($Msg[0] <> $GUI_EVENT_CLOSE) EndFunc ;==>GUI ; Real time GUI, via CTRL+PAUSE Func Hot_GUI() GUI() EndFunc ;==>Hot_GUI If GUI() = 0 Then Exit 0 ; Exit if user selected close by top rhs little close botton. ; Check if NotePad is already running, if not, then start it. If Not WinExists($NOTEPAD_TITLE) Then Run($NOTEPAD_EXE) ; Do nothing if NotePad fails to start. EndIf OnAutoItExitRegister("Fn_AtExit") ; Whatever cleanup to do on termination HotKeySet($Key_Terminate_1, "Fn_Terminate") ; CTRL+SHIFT+ALT+PAUSE {PAUSE aka BREAK} is TERMINATE Program (or close via System Tray icon) HotKeySet($Key_Terminate_2, "Fn_Terminate") ; Altrenative HotKeySet($Key_HotGUI_1, 'Hot_GUI') ; Install Hotkey 'CTRL+PAUSE' for Hot GUI, HotKeySet($Key_HotGUI_2, 'Hot_GUI') ; Alternative ; Main Program Loop Do If Not $InAPP Then If WinActive($APPTitle) And WinExists($NOTEPAD_TITLE) Then Bind() ; Make HotKeys active $InAPP = True EndIf Else If Not WinActive($APPTitle) Or Not WinExists($NOTEPAD_TITLE) Then UnBind() ; Deactivate Hotkeys $InAPP = False EndIf EndIf Sleep($Doze) If $ShowCnt > 0 Then $ShowCnt = $ShowCnt - 1 If $ShowCnt = 0 Then ToolTip("") ; Display time expired, Switch off "VD_EdChap is WATCHING" EndIf EndIf Until (1+1 <> 2) ; 4E4, ... for a long time. ;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;; Func Bind() HotKeySet($Key_Insert_1, "InsertFrameTime") ; Enable CTRL/INSERT : Insert Frame $ShowCnt = $ShowCntLimit ToolTip($Watching) EndFunc Func UnBind() ToolTip("") ; switch off tooltips. $ShowCnt = 0 ; Disable HotKeys HotKeySet($Key_Insert_1) ; Disable CTRL/INSERT EndFunc Func Fn_AtExit() HotKeySet($Key_Terminate_1) ; Disable Program Terminate Hotkey HotKeySet($Key_Terminate_2) ; Alternative HotKeySet($Key_HotGUI_1) ; Disable Hotkey GUI (CTRL+PAUSE) HotKeySet($Key_HotGUI_2) ; Alternative UnBind() EndFunc Func Fn_Terminate() Exit 0; Goodbye cruel world. ; Will call Fn_AtExit to clean up (assuming OnAutoItExitRegister registered to Fn_AtExit) EndFunc Func GetFrameTime() ; Return VirtualDub Frame Time as string, else "" on Error Local $FrmTime = "" Local $E = ControlGetText($APPTitle,"", $VdFrameNo) ; Format eg, "Frame 4871 (0:03:23.161)[B]" ; MsgBox($MB_SYSTEMMODAL, "", "The text in Edit1 is: " & $E) Local $Poff=StringInStr($E,"(") if $Poff > 0 Then $E = StringMid($E,$Poff+1) ; Strip 'Frame nnnn (' $E = StringReverse($E) $Poff=StringInStr($E,")") if $Poff > 0 Then $E = StringMid($E,$Poff+1) ; Strip reversed ")[B]" $Poff = _Max(StringInStr($E,".") , StringInStr($E,",")) if($Poff > 0) Then Local $Frac = StringReverse(StringLeft($E,$Poff-1)) Local $Whole = StringReverse(StringMid($E,$Poff+1)) Local $Sep = ($FractionSeparatorIsPeriod = 0) ? "," : "." if StringMid($Whole,2,1) = ":" Then $Whole = "0" & $Whole EndIf $FrmTime = $Whole & $Sep & $Frac EndIf EndIf EndIf if $FrmTime=="" then Beep(500,50) EndIf Return $FrmTime EndFunc Func InsertFrameTime() Local $FrmTime=GetFrameTime() if $FrmTime <> "" Then Local $OutLine = $FrmTime if($WriteChapterTitles = 1) Then Local $Chapter = InputBox("Enter Title",$FrmTime,"") if $Chapter <> "" Then $OutLine = $OutLine & " " & $Chapter EndIf EndIf ControlSend($NOTEPAD_TITLE, "", $NOTEPAD_EDITCONTROL, $OutLine, 1) ; Send Output line ControlSend($NOTEPAD_TITLE, "", $NOTEPAD_EDITCONTROL, "{ENTER}", 0) ; Send ENTER key, 1 line down. ToolTip("Sending NotePad Save") $ShowCnt = $ShowCntLimit * 2 ControlSend($NOTEPAD_TITLE, "", $NOTEPAD_EDITCONTROL, $NOTEPAD_SAVE_KEY , 0) ; Send CTRL/S to NotePad, ie Save (FileSelector pop-up if not named) COOKED endif EndFunc Func AppendSlash($InName) Local $Dir = $InName If StringMid($Dir, StringLen($Dir), 1) <> '\' Then $Dir = $Dir & '\' EndIf Return $Dir EndFunc ;==>Fn_AppendSlash Code:
00:00:00,000 00:03:22,285 00:10:15,156 00:15:24,214 00:18:25,187 00:21:58,817 Code:
00:00:00.000 00:03:22.285 00:10:15.156 00:15:24.214 00:18:25.187 00:21:58.817 Or optionally with Chapter title. [below eg, user prompted for title "Minute 6"] Code:
00:00:00,000 Minute 0 00:01:00,000 Minute 1 00:02:00,000 Minute 2 00:03:00,000 Minute 3 00:04:00,000 Minute 4 00:05:00,000 Minute 5 00:06:00,000 Minute 6 00:07:00,000 Minute 7 00:08:00,000 Minute 8 00:09:00,000 Minute 9 00:10:00,000 Minute 10 00:34:38,000 Sometime 01:33:46,000 somewhere
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 13th June 2022 at 19:36. Reason: Update |
![]() |
![]() |
![]() |
#3 | Link | |||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,165
|
Update v0.01, see first post.
Posts #1 and #2 updated. Optional chapter title. Code:
00:34:38,000 Sometime Posted in another thread Quote:
From first post ReadMe, Quote:
Code:
; CAN CHANGE below to change editor, use AutoIt Au3Info program to get names (try 1st with NotePad.exe to see how to use it for below first two variables). Global Const $NOTEPAD_TITLE = "[CLASS:Notepad]" ; NotePad Window name. Global Const $NOTEPAD_EDITCONTROL = "[CLASS:Edit; INSTANCE:1]" ; NotePad text editor window control. Global Const $NOTEPAD_EXE = "NotePad.Exe" Global Const $NOTEPAD_SAVE_KEY = "^{s}" ; Send CTRL/S to NotePad, ie Save (FileSelector pop-up if not named) ; eg for NotePad2, Comment out above 4 lines and uncomment below two [EDIT: 4] lines (Semi Colon is comment character). ; After changes, in AutoIt SciTE source editor, hit F7 to rebuild executable. (probably the same key in the basic AutoIt included editor). ;Global Const $NOTEPAD_TITLE = "[CLASS:Notepad2]" ; NotePad2 Window name. ;Global Const $NOTEPAD_EDITCONTROL = "[CLASS:SysListView32; INSTANCE:1]" ; NotePad2 text editor window control. ;Global Const $NOTEPAD_EXE = "NotePad2.Exe" ;Global Const $NOTEPAD_SAVE_KEY = "^{s}" ; Send CTRL/S to NotePad, ie Save (FileSelector pop-up if not named) Updated only here, since zip posted Code:
NOTES:: VDub2 opens most video files just fine, does not have to be *.AVI. VDub2 must be stopped when you press CTRL/INSERT, else it will not be able to write a chapter into NotePad file [SPACE bar both starts and stops VDub2 play]. It is important to NOT do any VirtualDub2 clip editing, if you eg delete a frame in VirtualDub2, then all frames after that frame will be off by 1, and so all VD_EdChap times inserted later into NotePad file will be also off by 1 frame. MPC-HC, auto loads *.xchp files of same base name as movie file, so perhaps create empty MovieName.txt or MovieName.xchp in NotePad, and VD_EdChap will use that instance of Notepad instead of auto running the NotePad app. It is easy to see what is happening as the NotePad window will be visible and after each insertion into NotePad, an ENTER key will also be sent to move the cursor down one line, each chapter is on its own line. If you make a mistake, it is easy to just switch to NotePad window and delete the erroneous line. Chapters are inserted at the current NotePad position, so you can go back and insert chapters earlier in the notepad file. Its lovely to have a 2nd monitor for the NotePad window (if your graphics card supports), my No1 machine has a 19" 4:3 HP 2nd monitor that cost me £1.50 2nd hand (used) but in perfect condition, nobody wants them anymore, HeHeHe!. My No2 m/c has similar 19" 2nd monitor but cost a bit more some time ago, is less good condition than the £1.50 one. Also, Windows 10 1909 No1 m/c with 19" 2nd display is 8 BPC 1280x1024, and the primary display is 4K HDR10, works fine together. [you have to change W10 display Settings for 10BPC] [2nd monitor is 'the dogs bollocks' for showing Debug Info via DebugView (google)] [EDIT: 'The Dogs Bollocks', Taste so good, you can't stop licking them {WARNING, cease and desist if you hear him growling} :) ] MPC-HC does order *.xchp chapters when loading, so they do not have to be in exact time order already. MPC-HC, PageUp, and PageDown, jump through the chapters. MPC-BE, I thought that MPC-BE had previously used *.xchp chapter files when I tried it, but seems it does not, neither with/without chapter title/millisecs seconds timing, or whether COMMA or PERIOD separated milliseconds. (Somebody say if MPC-BE does support some other exotic format, or if I did something wrong) If your system is configured to open txt files via some other text editor (Open With), thats OK [We though MUST still use Windows STANDARD NotePad], only is problem when it is NOT possible to to execute system NotePad at all because of registry hack where opens some other editor [we need original NotePad.Exe name and also must have exact same control names and instances used inside of the executable]. NotePad2 (well one of the editors called NotePad2) is one of those that can be installed to totally replace system NotePad, if you do a few edits (4 lines) near beginning of the source, you can re-compile and it should work OK with that hacked editor.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 14th June 2022 at 09:44. |
|||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|