odd change in behaviour after recent MS Windows update

Support forum for DGDecNV
Post Reply
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

odd change in behaviour after recent MS Windows update

Post by hydra3333 »

Hello. Thanks for your lovely tools, I use them every day in an automated process which uses vbscript.

After a recent MS update to Win10Pro x64, I noticed the VB script is now freezing at DGIndexNV so I took a look.
It seems that the recent windows update may have changed some behaviours, given it worked up until a couple of days ago (coincidentally around the same time I updated DGIndexNV to the 244 release).

1. (trivial) Perhaps I never noticed before, but this line in a DOS box produces this visible output (cut and pasted from the DOS box)

Code: Select all

G:\HDTV\TEST>"C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGIndexNV.exe" -version

G:\HDTV\TEST>DGIndexNV 241.0.0.0 (64 bit)
where the output from DGIndexNV is on the same line and after the next command prompt and the cursor is sitting at character 1 of the following blank line.
When I hit enter, nothing happens though, so it's not being treated as an input.
It just seems ... unusual, compared to everything else.

2. Also perhaps I never noticed before, but this line in a DOS box produces this visible output (again, cut and pasted straight from the DOS box)

Code: Select all

G:\HDTV\TEST>"C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGIndexNV.exe" -i "D:\VRDTVSP-SCRATCH\test_file.QSF.mp4" -e -h -o "D:\VRDTVSP-SCRATCH\test_file.QSF.dgi"

G:\HDTV\TEST>Project
100
You may notice
a) the 1st line of output is on the next line similar to (1) above
b) the second line of output follows on a line by itself with the cursor on the line after it, blinking away at character 1 looking like it's waiting for DGIndexBV to finish.
c) the text lines Project and 100 may not be strictly necessary from this CLI command; would it be possible for DGIndexNV to finish its work silently then exit when it's done ?

Suggestions welcomed.


Whilst I'm here, and this is now actually my issue with using DGIndexNV ...

With this code snippet from a vbscript function,

Code: Select all

	cumulative_sleep = 0
	set eac_exe_object = wso.Exec(eac_command_string)
	Do While eac_exe_object.Status = 0 '0 is running and 1 is ending
		Wscript.Echo "vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for " & sleep_amount & " ms (slept " & (cumulative_sleep/1000) & " seconds so far)"
	 	Wscript.Sleep sleep_amount
		cumulative_sleep = cumulative_sleep + sleep_amount
	Loop
	WScript.StdOut.WriteLine("START StdOut: ")
	Do Until eac_exe_object.StdOut.AtEndOfStream
		eac_tmp = eac_exe_object.StdOut.ReadLine()
		WScript.StdOut.WriteLine(eac_tmp)
	Loop
	WScript.StdOut.WriteLine("END   StdOut: ")
	WScript.StdOut.WriteLine("START StdErr: ")
	Do Until eac_exe_object.StdErr.AtEndOfStream
		eac_tmp = eac_exe_object.StdErr.ReadLine()
		WScript.StdOut.WriteLine(eac_tmp)
	Loop
	WScript.StdOut.WriteLine("END   StdErr: ")
	eac_exe_status = eac_exe_object.ExitCode
	WScript.StdOut.WriteLine("EXIT STATUS: " & eac_exe_status)
and a command string like

Code: Select all

"C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGIndexNV.exe" -i "D:\VRDTVSP-SCRATCH\test_file.QSF.mp4" -e -h -o "D:\VRDTVSP-SCRATCH\test_file.QSF.dgi"
It used to exit the first Do While loop normally when DGIndexNV was finished, but now after the ms update it just loops forever.
Same thing happens given this command

Code: Select all

"C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGIndexNV.exe" -version
I backed down DGIndexNV from v244 to v241 and same thing happens, which is why I attribute the issue to the recent MS windows update.
Like I said, it used to work up until the MS windows update a couple of days ago.
Now I'll have to find another way :)

Suggestions welcomed. I understand if you decline :)
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

odd change in behaviour after recent MS Windows update

Post by hydra3333 »

I notice that there are updated Microsoft C-runtimes out, perhaps I should install and try again ?
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

odd change in behaviour after recent MS Windows update

Post by Rocky »

DGIndexNV in CLI mode is still a windows app and so console output is asychronous, i.e., it can come at any time relative to the command prompt. It's just a display issue. DGIndexNV does complete and exit; it's just that the last thing displayed may not be the command prompt. In that state if you hit return you'll see the shell is alive waiting for input. You don't have to hit return or anything to get DGIndexNV to terminate.

Now, as for your real issue...

Let's first see if it is DGIndexNV or Windows. Can you please see if this runs successfully and report back:

-----
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("calc")

Do While oExec.Status = 0
WScript.Sleep 100
Loop

WScript.Echo oExec.Status
-----

For me, that terminates immediately with status 1 even though the calculator is still open, which seems wrong to me.

Please show the part where DGIndexNV is invoked.

I doubt the run-times are involved but it wouldn't hurt to try.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

odd change in behaviour after recent MS Windows update

Post by Rocky »

Here is working code to start Notepad and wait for it to finish. You can apply the same idea to DGIndexNV.

Code: Select all

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
objWMIService.Create "notepad.exe", null, null, intProcessID
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService.ExecNotificationQuery _
    ("Select * From __InstanceDeletionEvent Within 1 Where TargetInstance ISA 'Win32_Process'")
Do Until i = 1
    Set objLatestProcess = colMonitoredProcesses.NextEvent
    If objLatestProcess.TargetInstance.ProcessID = intProcessID Then
        i = 1
    End If
Loop
Wscript.Echo "Notepad has been terminated."
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

odd change in behaviour after recent MS Windows update

Post by hydra3333 »

Rocky wrote:
Wed Jul 20, 2022 7:36 am
Please show the part where DGIndexNV is invoked.
OK, uncut commands, code, and log, showing DGIndexNV works fine from a command prompt but not longer works from Cscript '.Exec'.

Code: Select all

G:\HDTV\TEST>C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGIndexNV.exe -version 
DGIndexNV 241.0.0.0 (64 bit)

G:\HDTV\TEST>C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGIndexNV.exe -i "D:\VRDTVSP-SCRATCH\test_file.QSF.mp4" -e -h -o "D:\VRDTVSP-SCRATCH\test_file.QSF.dgi" 
Project
100

G:\HDTV\TEST>TYPE "D:\VRDTVSP-SCRATCH\test_file.QSF.log" 
Stream Type: MP4
Video Type: AVC
Profile: High
Level: 4
Coded Size: 1920x1088
PAR: 1:1
Display Size: 1920x1080
Frame Rate: 25.000000 fps
Colorimetry: BT.709 [1]
Frame Structure: 
Frame Type: 
Coded Number: 113481
Playback Number: 113481
Frame Repeats: 0
Field Repeats: 0
Bitrate: 
Bitrate (Avg): 2.841
Bitrate (Max): 
Audio Stream:  2: MPEG-1 Audio (11172-3) 256kbps 48000 2ch
Elapsed: 
Remain: 0:00:00
FPS: 
Info: Finished!

G:\HDTV\TEST>TYPE "G:\HDTV\TEST\DGNV_TEST.vbs" 
Option Explicit
Dim cscript_wshShell, cscript_strEngine
Dim vrdtvsp_ComputerName, vrdtvsp_ScriptName
Dim fso, wso
DIm a_cmd, a_return_code
'
Set cscript_wshShell = CreateObject( "WScript.Shell" )
cscript_strEngine = UCase( Right( WScript.FullName, 12 ) )
vrdtvsp_ComputerName = cscript_wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
vrdtvsp_ScriptName = Wscript.ScriptName
WScript.Echo "Checked and CSCRIPT Engine = """ & cscript_strEngine & """" ' .Echo works in both wscript and cscript
If UCase(cscript_strEngine) <> UCase("\CSCRIPT.EXE") Then
    ' exit immediately with error code 17 cannot perform the requested operation
    ' since it was not run like:
    '      cscript //NOLOGO "vbscript_path_and_file" "parameter 1" "parameter 2"
    '      cscript //NOLOGO "test.vbs" /p1:"This is the value for p1" /p2:500
    ' Err.Raise 17 ' Error 17 = cannot perform the requested operation
    WScript.Echo "CSCRIPT Engine MUST be CSCRIPT not WSCRIPT ... Aborting ..."
	On Error goto 0
	Wscript.Echo "Error 17 = cannot perform the requested operation"
	WScript.Quit 17 ' Error 17 = cannot perform the requested operation
End If
Set wso = CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
'
a_cmd = "C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGIndexNV.exe -version"
a_return_code = vrdtvsp_exec_a_command_and_show_stdout_stderr(a_cmd)
'
a_cmd = "C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGIndexNV.exe -i ""D:\VRDTVSP-SCRATCH\test_file.QSF.mp4"" -h -o ""D:\VRDTVSP-SCRATCH\test_file.QSF.dgi"""
a_return_code = vrdtvsp_exec_a_command_and_show_stdout_stderr(a_cmd)
'
Function vrdtvsp_exec_a_command_and_show_stdout_stderr (byVAL eac_command_string)
	Const sleep_amount = 1000	' 1 second = 1000 ms
	Dim cumulative_sleep
	Dim  eac_exe_cmd_string, eac_exe_object, eac_exe_status, eac_tmp
	If eac_command_string = "" then
		vrdtvsp_exec_a_command = 0
		Exit Function
	End If
	WScript.StdOut.WriteLine("==================================================================================")
	WScript.StdOut.WriteLine("vrdtvsp_exec_a_command_and_show_stdout_stderr " & vrdtvsp_current_datetime_string())
	' Examples with and without CMD and 2>&1
	'		eac_exe_cmd_string = "CMD /C ""something"""
	'		eac_exe_cmd_string = "CMD /C ""something"" 2>&1"
	'		eac_exe_cmd_string = "Taskkill ""something"""
	'		eac_exe_cmd_string = "Taskkill ""something"" 2>&1"
	WScript.StdOut.WriteLine("EXEC command: " & eac_command_string)
	cumulative_sleep = 0
	set eac_exe_object = wso.Exec(eac_command_string)
	Do While eac_exe_object.Status = 0 '0 is running and 1 is ending
		Wscript.Echo "vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for " & sleep_amount & " ms (slept " & (cumulative_sleep/1000) & " seconds so far)"
	 	Wscript.Sleep sleep_amount
		cumulative_sleep = cumulative_sleep + sleep_amount
	Loop
	WScript.StdOut.WriteLine("START StdOut: ")
	Do Until eac_exe_object.StdOut.AtEndOfStream
		eac_tmp = eac_exe_object.StdOut.ReadLine()
		WScript.StdOut.WriteLine(eac_tmp)
	Loop
	WScript.StdOut.WriteLine("END   StdOut: ")
	WScript.StdOut.WriteLine("START StdErr: ")
	Do Until eac_exe_object.StdErr.AtEndOfStream
		eac_tmp = eac_exe_object.StdErr.ReadLine()
		WScript.StdOut.WriteLine(eac_tmp)
	Loop
	WScript.StdOut.WriteLine("END   StdErr: ")
	eac_exe_status = eac_exe_object.ExitCode
	WScript.StdOut.WriteLine("EXIT STATUS: " & eac_exe_status)
	Set eac_exe_object = Nothing
	WScript.StdOut.WriteLine("vrdtvsp_exec_a_command_and_show_stdout_stderr " & vrdtvsp_current_datetime_string())
	WScript.StdOut.WriteLine("==================================================================================")
	vrdtvsp_exec_a_command_and_show_stdout_stderr = eac_exe_status
End Function
'
Function vrdtvsp_current_datetime_string ()
    ' return format: YYYY.MM.DD-HH.MM.SS.mmm
	Dim t, t_date, tmp, milliseconds
	t = Timer
	t_date = Now()
	tmp = Int(t)
	milliseconds = Int((t-tmp) * 1000)
    vrdtvsp_current_datetime_string = year(t_date) & "." & Right("00" & month(t_date),2) & "." & Right("00" & day(t_date),2) & "-" & Right("00" & hour(t_date),2) & "." & Right("00" & minute(t_date),2) & "." & Right("00" & second(t_date),2) & "." & Right("000" & milliseconds,3)
End Function
G:\HDTV\TEST>cscript //nologo "G:\HDTV\TEST\DGNV_TEST.vbs" 
Checked and CSCRIPT Engine = "\CSCRIPT.EXE"
==================================================================================
vrdtvsp_exec_a_command_and_show_stdout_stderr 2022.07.21-11.35.28.023
EXEC command: C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGIndexNV.exe -version
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 0 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 1 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 2 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 3 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 4 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 5 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 6 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 7 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 8 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 9 seconds so far)
vrdtvsp_exec_a_command_and_show_stdout_stderr About to sleep for 1000 ms (slept 10 seconds so far)
^CTerminate batch job (Y/N)? 
Rocky wrote:
Wed Jul 20, 2022 7:36 am
I doubt the run-times are involved but it wouldn't hurt to try.
Yep, an over-the-horizon long shot but stranger things have happened at sea :)

Thanks for your code suggestion, I'll have a go now.
(With .exec I can retrieve stdout and stderr and parse them if need be; not so sure with the objWMIService.Create code, will have a look.)
User avatar
hydra3333
Posts: 394
Joined: Wed Oct 06, 2010 3:34 am
Contact:

odd change in behaviour after recent MS Windows update

Post by hydra3333 »

I ended up having to find another way ... I ended up popping the DGIndexNV command into a .bat file with redirects to capture stdout and stderr and capturing ERRORLEVEL, and using .Run with that.

Thanks for your info and suggestions !

Looking into it further, the same thing happened in the remote past with ffmpeg ... although DGIndexNV continued to work fine until just the other day.

Windows feels a bit like a compressed shocker coil spring does to a mechanic, if you're not careful then one day it'll slip and take your face off.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

odd change in behaviour after recent MS Windows update

Post by Rocky »

Glad you found a workaround. Marking resolved.
Post Reply