• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

PHP Encoding Status Page (virtualdub)

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Soichiro

Member
Joined
Sep 24, 2005
Location
Indianapolis
So, I've been trying to make a page in PHP that displays the progress of the video I'm encoding in virtualdubmod. However, the only thing I've been able to do so far is read the virtualdub.jobs file, which doesn't help too much, because all that gives me is what files are in the job control and whether they're complete or in progress. What I need is the actual progress of the current encode, in percent. I know it's possible, as our head encoder, Edward_K, has a page that does this. However, I can't figure out how his page works, and he won't tell me. :rolleyes: So, does anyone have any ideas on this?
 
I can't find anywhere that virtualdub or virtualdubmod tells the progress. vdm is supposed to have a /log argument but I couldn't get it to work (it may just be for errors).
 
I've heard that it may be possible using the w32api functions in PHP. However, looking through Microsoft's API for Windows, the only functions I can find that would help are functions to retrieve window text, which it turns out require 3 functions to work, and the first function requires a "Window Class" struct to be created before hand, and it's really annoying. I can't figure out how to get this crap to work. :bang head
 
I doubt he does it strictly with PHP. Either he's found a way to have virtualdubmod output the progress to a text file (which I've briefly used and never found that option), or he's written a separate program to get the data and put it in a text file. I think I remember virtualdubmod showing the progress in the title bar, so it should be possible to write a simple program in say C# that takes the title bar text and writes it to a file then PHP can work on it from there.
 
so it should be possible to write a simple program in say C# that takes the title bar text and writes it to a file then PHP can work on it from there.

Any idea how I could do this in C#? I've tried looking through some of the available classes, etc., that might be related to the taskbar, yet I can't find anything to read the taskbar text or anything similar.
 
Any idea how I could do this in C#? I've tried looking through some of the available classes, etc., that might be related to the taskbar, yet I can't find anything to read the taskbar text or anything similar.

I took a look at the MSDN knowledge base but I couldn't find anything. I would try going to some programming forum and asking there.
 
Well, the Windows taskbar is a Windows thing... so it may not be directly accessible through C#.

http://msdn2.microsoft.com/en-us/library/aa511446.aspx

If you needed to access text from a taskbar button, the string value will be stored within the Text property of a Windows Form object in C# (since the text from the title bar of a window is usually what appears in the task bar). I'm not sure how much that helps... I've never worked with VirtualDubMod before, and am no PHP guru... but I'm decent with C#. :-/
 
Think I got it. This is in VB2005.

Code:
Try
            Dim VDM As Process() = Process.GetProcessesByName("VirtualDubMod")


            For counter As Long = 0 To 100
                Debug.Print(VDM(0).MainWindowTitle)
                VDM(0).Refresh()
                System.Threading.Thread.Sleep(1000)
            Next
        Catch ex As Exception
            'probably couldn't find window
        End Try

Output

Code:
35% [test.avi] - VirtualDubMod 1.5.10.2
35% [test.avi] - VirtualDubMod 1.5.10.2
36% [test.avi] - VirtualDubMod 1.5.10.2
36% [test.avi] - VirtualDubMod 1.5.10.2
36% [test.avi] - VirtualDubMod 1.5.10.2
36% [test.avi] - VirtualDubMod 1.5.10.2
36% [test.avi] - VirtualDubMod 1.5.10.2
37% [test.avi] - VirtualDubMod 1.5.10.2
37% [test.avi] - VirtualDubMod 1.5.10.2
37% [test.avi] - VirtualDubMod 1.5.10.2
37% [test.avi] - VirtualDubMod 1.5.10.2
38% [test.avi] - VirtualDubMod 1.5.10.2
38% [test.avi] - VirtualDubMod 1.5.10.2
38% [test.avi] - VirtualDubMod 1.5.10.2
38% [test.avi] - VirtualDubMod 1.5.10.2
39% [test.avi] - VirtualDubMod 1.5.10.2
39% [test.avi] - VirtualDubMod 1.5.10.2
40% [test.avi] - VirtualDubMod 1.5.10.2
40% [test.avi] - VirtualDubMod 1.5.10.2
40% [test.avi] - VirtualDubMod 1.5.10.2
41% [test.avi] - VirtualDubMod 1.5.10.2
41% [test.avi] - VirtualDubMod 1.5.10.2
42% [test.avi] - VirtualDubMod 1.5.10.2
42% [test.avi] - VirtualDubMod 1.5.10.2
43% [test.avi] - VirtualDubMod 1.5.10.2
43% [test.avi] - VirtualDubMod 1.5.10.2
43% [test.avi] - VirtualDubMod 1.5.10.2
44% [test.avi] - VirtualDubMod 1.5.10.2
44% [test.avi] - VirtualDubMod 1.5.10.2
45% [test.avi] - VirtualDubMod 1.5.10.2

Basically, when VDM is encoding it updates the progress in the form title. So read the title to get the progress. From here you could update a file or generate an html page with the current progress.

It seemed to be about a second behind on my machine but it is pretty close. It could be from that sleep call.
 
Last edited:
Back