Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Cutting Video Using A Script, hot to script with Sylia
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
Nemolo
  Posted: Mar 15 2013, 12:37 PM


Newbie


Group: Members
Posts: 3
Member No.: 36264
Joined: 15-March 13



Hi community,
i'm having some problem with a script i have to do.
i want to use virtualdub to cut a video file (.mpg) and i have to call it from an other program, so it must be used from command line
like this
vdub.exe /i script.jobs <input.mpg> <output> <startframe> <endframe>

and this is the script i have done(partially stolen):
CODE

// $signature 0 1
// $numjobs 1
//

// $job "Job 1"
// $input "c:\sourcedir\input.avi"
// $output "c:\outputdir\output__1_.avi"
// $state 0
// $id 5141efec95f611363275757
// $start_time 00000000 00000000
// $end_time 00000000 00000000

// VirtualDub.video.SetSmartRendering(0);  What is this?
// VirtualDub.audio.EnableFilterGraph(0);  what is this?

// USAGE
// From command line:
// Vdub.exe /i script.jobs <imput path.mpg> <output path> <startframe> <endframe>
// still testing


// $script


declare input;
declare output;
declare startframe;
declare endframe;
declare intstartframe;
declare intendframe;
declare frames;

input = VirtualDub.params[0];
output = VirtualDub.params[1];
startframe = VirtualDub.params[2];
endframe = VirtualDub.params[3];



intstartframe = Sylia.Atoi(startframe);
intendframe = Sylia.Atoi(endframe);

frames = intendframe - intstartframe;


VirtualDub.Log("Input path:");
VirtualDub.Log(input);
VirtualDub.Log("Output path:");
VirtualDub.Log(output);
VirtualDub.Log("StartFrame:");
VirtualDub.Log(startframe);
VirtualDub.Log("End Frame:");
VirtualDub.Log(endframe);


startframe = Sylia.ToString(intstartframe);
endframe = Sylia.ToString(intendframe);

VirtualDub.Log("Elaborated Frames:");
VirtualDub.Log(startframe);
VirtualDub.Log(endframe);


VirtualDub.Open(input);
VirtualDub.audio.SetSource(1);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,500,1,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();

VirtualDub.video.SetInputFormat(0);
VirtualDub.video.SetOutputFormat(0);
VirtualDub.video.SetMode(3);

VirtualDub.video.SetPreserveEmptyFrames(0);
VirtualDub.video.SetFrameRate2(0,0,1); // without this lane the video is good but the progression bar fails
VirtualDub.video.SetIVTC(0, 0, 0, 0);
VirtualDub.video.SetCompression();
VirtualDub.video.filters.Clear();
VirtualDub.audio.filters.Clear();
VirtualDub.subset.Clear();
VirtualDub.subset.AddRange(intstartframe,intendframe);
VirtualDub.video.SetRangeFrames(intstartframe,intendframe);
VirtualDub.project.ClearTextInfo();
VirtualDub.project.AddTextInfo("ISFT", "VirtualDub AutoCut");
 // -- $reloadstop --
VirtualDub.SaveSegmentedAVI(output+".mpg", 2000, 0);
VirtualDub.SaveAVI(output+"AVI.mpg");
VirtualDub.SaveCompatibleAVI(output+"_Compatible.mpg");
VirtualDub.audio.SetSource(1);
VirtualDub.Close();


// $endjob
//
//--------------------------------------------------

// $done


now: i have some issues with the methods :
VirtualDub.video.SetFrameRate2(0,0,1);
// VirtualDub.video.SetSmartRendering(0);
// VirtualDub.audio.EnableFilterGraph(0);

since i dont' know exactly what they do.

also, i need an exact copy of the section i'm cutting: same frames, same audio, same codec.
instead i get a much bigger file.

23:51min input file (240177KB) -> 22sec output file(221221KB)

how can i encode the file with the original codec?

i strongly hope someone can answere me.

(sorry for the grammar hell, i can't speak english very well)

 
     Top
-vdub-
Posted: Mar 15 2013, 08:16 PM


Advanced Member


Group: Members
Posts: 613
Member No.: 27087
Joined: 24-February 10



One way is to load video into virtualdub apply filters and edits then either use File - Queue Batch Operation - Save As Avi or File - Save Processing Settings. After saving them with or without closing virtualdub these script files will be in virtualdub folder or location you saved them to. With extensions of .jobs for batch and .vdscript or .vcf for process settings. From those you can find what you need to know. While not exactly the same for all will give you more idea for those that are what is needed and where, trial and error to learn. Unknown if there is an A-Z for every detail and much more besides for the script you have posted.

These you will se change in the .jobs, vdscript, .vcf files when selected from within virtualdub
VirtualDub.video.SetFrameRate2(0,0,1); = Video - Framerate (options)
// VirtualDub.video.SetSmartRendering(0); = Menu Video and help file for more details for these
// VirtualDub.audio.EnableFilterGraph(0); = Audio Full Compression - Use Advanced Filters <then> Filters

Many other questions no doubt will be in the Virtualdub Help F1 or Help - Contents for Virtualdub Help.
 
    Top
Nemolo
Posted: Mar 16 2013, 09:44 AM


Newbie


Group: Members
Posts: 3
Member No.: 36264
Joined: 15-March 13



that really helped, thank you, this job is easier now. i can select a codec without scripting it. but sorry if i bother you, how can i detect the codec of my original video?
 
     Top
Abrazo
Posted: Mar 16 2013, 08:49 PM


Advanced Member


Group: Members
Posts: 775
Member No.: 28995
Joined: 5-November 10



Once the videofile is open in VirtualDub, you can verify which video- and audio- decoders have been used for it, via File > File Information...

The "decoding"-codec being used by VirtualDub is not necessarely the same one as the "encoding"-codec that has been used while the file has been created, but it gives you an indication if it has been encoded with DivX, Xvid, H264, ...

So it can be that an AVI has been encoded with the native DivX codec and that VirtualDub will open it via ffdshow's Divx/DX50-capable decoder.

If you are more interested in these things:
> you can read this thread - starting from 3 aug. 2012
> http://forums.virtualdub.org/index.php?act...=ST&f=4&t=21095

AVI FourCC code changer:
> http://www.inmatrix.com/download/avic100.zip
FourCC Description Code: shows you the encoder that has been used
FourCC Used Codec: the encoding-format
 
     Top
-vdub-
Posted: Mar 17 2013, 03:42 AM


Advanced Member


Group: Members
Posts: 613
Member No.: 27087
Joined: 24-February 10



MediaInfo to show the codec used encoded the video
http://mediainfo.sourceforge.net/
 
    Top
Nemolo
Posted: Mar 18 2013, 11:44 AM


Newbie


Group: Members
Posts: 3
Member No.: 36264
Joined: 15-March 13



Thanks, with this i can solve all the problems i got.
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
5 replies since Mar 15 2013, 12:37 PM Track this topic | Email this topic | Print this topic

<< Back to Advanced Video Processing