Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
95 views
in Technique[技术] by (71.8m points)

Script for virtualdub to cut videos

I have videos I would like to process to remove x secondes at their beginning. Since I have around 140 videos I started to write a script to do so but... it does not work !

My present script is :

VirtualDub.audio.SetSource(1);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,500,1,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetEditMode(1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio.EnableFilterGraph(0);
VirtualDub.video.SetInputFormat(0);
VirtualDub.video.SetOutputFormat(7);
VirtualDub.video.SetMode(3);
VirtualDub.video.SetSmartRendering(0);
VirtualDub.video.SetPreserveEmptyFrames(0);
VirtualDub.video.SetFrameRate2(15,1,1);
VirtualDub.video.SetRange(600000,290000);
VirtualDub.video.SetIVTC(0, 0, 0, 0);
VirtualDub.video.SetCompression(0x6376736d,0,8000,0);
VirtualDub.video.SetCompData(4,"SwAAAA==");
VirtualDub.video.filters.Clear();
VirtualDub.audio.filters.Clear();

As you may note I also change framerate and I compress the video.

My command-line is: "C:Program FilesVirtualDub-1.10.4VirtualDub.exe" /s "C:Users...framerate.vdscript" /c /b "C:Users...video" "C:Users...output" /r /x

This allows me to process all videos in "C:Users...video" folder and to save them in "C:Users...output" folder.

Framerate change and compression work perfectly but not the trimming !!! The puzzling thing is that when I open one of the video in VDub then i load the script it actually defines a range and processes it exactly as I want !!!

An additional question is how I could define specific starts for each video files (I may change the script opening each file setting range, closing it and have a routine to change range according to each file - not sure it is possible in a script and I don't know how to do so but I didn't check yet).

Any help would be very much appreciated !

Xavier

question from:https://stackoverflow.com/questions/66052558/script-for-virtualdub-to-cut-videos

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I was exploring my second goal (processing several files) using the script below which is a simplified version of the previous one (without audio and seemingly useless things) :

VirtualDub.Open("C:/Users/.../File1.avi",0,0);
VirtualDub.video.SetFrameRate2(15,1,1);
VirtualDub.video.SetRange(600000,290000);
VirtualDub.video.SetCompression(0x6376736d,0,8000,0);
VirtualDub.video.SetCompData(4,"SwAAAA==");
VirtualDub.video.filters.Clear();
VirtualDub.SaveAVI("C:/Users/.../Output1.avi");
VirtualDub.Open("C:/Users/.../File2.avi",0,0);
VirtualDub.video.SetFrameRate2(15,1,1);
VirtualDub.video.SetRange(600000,290000);
VirtualDub.video.SetCompression(0x6376736d,0,8000,0);
VirtualDub.video.SetCompData(4,"SwAAAA==");
VirtualDub.video.filters.Clear();
VirtualDub.SaveAVI("C:/Users/.../Output2.avi");

And it worked!!! May be the recursive processing of one folder content was the issue?

Note than moved from the command line to the script the in the path have to be changed to /

Cheers,

Xavier


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...