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.

 
Script Problem, save part of file
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
TheHulk
Posted: Jul 30 2012, 02:18 AM


Member


Group: Members
Posts: 16
Member No.: 15323
Joined: 28-May 05



I want to make a script which can open a file and then save a bit of it out to a new file.

I thought I should use AddRange to do that, but this script loads the file but saves the entire file out again. What am i doing wrong?
CODE

 VirtualDub.Open(U"C:\in.avi");


VirtualDub.audio.SetSource(0);
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.audio.EnableFilterGraph(0);

VirtualDub.video.SetInputFormat(0);
VirtualDub.video.SetOutputFormat(0);
VirtualDub.video.SetMode(3);
VirtualDub.video.SetSmartRendering(0);
VirtualDub.video.SetPreserveEmptyFrames(0);
VirtualDub.video.SetFrameRate2(0,0,1);
VirtualDub.video.SetIVTC(0,0,-1,0);
VirtualDub.video.SetCompression(0x7367616c,0,0,0);

VirtualDub.video.filters.Clear();
VirtualDub.audio.filters.Clear();

VirtualDub.subset.Clear;
VirtualDub.subset.AddRange(738,1200);

VirtualDub.SaveAVI(U"C:\out.avi");
VirtualDub.Close();
 
     Top
dloneranger
Posted: Jul 30 2012, 05:52 AM


Moderator


Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07



You want to delete VirtualDub.subset.AddRange(738,1200); and add
VirtualDub.video.SetRangeFrames(738,1200);
Where the numbers are startframe and endframe+1

In directstream mode virtualdub will start at the the nearest keyframe before the start frame though

If you wanted to start at the exact frame you'de have to do either of these

1) Recompress the beginning only
(Use fast recompress plus smart rendering, and set the video compression to the same as in the source file)

2) Recompress the entire section

-------------------

To see virtualdub's script for how it does anything, set it all up how you would do it, then queue the job
You can then open the .jobs file that's in virtualdub's directory with notepad and read it through

--------------------
MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask
Windows7/8 Codec Chooser
All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3
 
    Top
TheHulk
Posted: Jul 30 2012, 02:54 PM


Member


Group: Members
Posts: 16
Member No.: 15323
Joined: 28-May 05



QUOTE (dloneranger @ Jul 30 2012, 05:52 AM)



QUOTE
You want to delete VirtualDub.subset.AddRange(738,1200); and add
VirtualDub.video.SetRangeFrames(738,1200);


Ah, but "SetRangeFrames" isn't listed in the VirtualDub scripting language reference.

QUOTE

To see virtualdub's script for how it does anything, set it all up how you would do it, then queue the job
You can then open the .jobs file that's in virtualdub's directory with notepad and read it through


That's handy. Still using 1.8.5 though, don't think you could queue them there.

But thanks for your help it seems to work
 
     Top
malky
Posted: Jul 30 2012, 03:07 PM


Advanced Member


Group: Members
Posts: 290
Member No.: 22386
Joined: 6-November 07



CODE
VirtualDub.subset.AddRange(738,1200);


Does that not simply mean 'save 1200 frames starting at frame 738'?
 
    Top
dloneranger
Posted: Jul 30 2012, 04:45 PM


Moderator


Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07



QUOTE
Still using 1.8.5 though, don't think you could queue them there.


In the old versions, it's a checkbox on the save as dialog
In the new ones it's a separate entry in the file menu
Same thing though

The docs for the scripting language are kind of old so it's usually easier to read a queued job to see what goes where
Especially with using different versions, as the scripting language keeps changing



--------------------
MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask
Windows7/8 Codec Chooser
All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3
 
    Top
TheHulk
Posted: Jul 31 2012, 11:55 PM


Member


Group: Members
Posts: 16
Member No.: 15323
Joined: 28-May 05



Ok, thanks dloneranger

(And malky I don't know)
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
5 replies since Jul 30 2012, 02:18 AM Track this topic | Email this topic | Print this topic

<< Back to Newbie Questions