VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    has anyting invented a useable method to trim() videos using avisynth plugin or script function ?

    i search google but only found this method outlined below, i adjusted it to the video i was trying to trim, but it did not work correctly.

    trim(69,103)++trim(238,446)++trim(495,554)++trim(6 56,786)++trim(0,0)

    i think what i am looking for is the ability to use an infinate number of trim() inside a function, or as many values i need to add as trims, something like this:

    VideoTrim(69..103, 238..446, 495..554, 656..786)

    i would get the number from virtualdub, not snipping any video portion, just getting the timelines frame number position.
    Quote Quote  
  2. Originally Posted by vhelp View Post

    i search google but only found this method outlined below, i adjusted it to the video i was trying to trim, but it did not work correctly.

    trim(69,103)++trim(238,446)++trim(495,554)++trim(6 56,786)++trim(0,0)
    What did not work correctly exactly ? Were you using a frame accurate source filter ?

    i think what i am looking for is the ability to use an infinate number of trim() inside a function, or as many values i need to add as trims, something like this:

    VideoTrim(69..103, 238..446, 495..554, 656..786)

    i would get the number from virtualdub, not snipping any video portion, just getting the timelines frame number position.
    A better way, IMO is to use avspmod

    You mark in / mark out sections using home and end keys, respectively. They will be marked in the timeline (shown in blue). If you have it set to "copy to clipboard" when you push apply, all the trim commands representing all the Mark in/out sections will be pasted in the script when you paste (or you can paste somewhere else)
    Quote Quote  
  3. I use Trim() very regularly. It works a treat. Did you copy and paste the Trims you were using or did you make a typo when posting? It's just that the final "trim(0,0)" doesn't make sense to me. Plus the second last Trim has a gap in the first frame number.

    Trim works, but if you do "odd" things such as using invalid values the result is often no video gets encoded at all.

    You probably don't want to be using VirtualDub to work out the frame numbers to use for Trims. Well I guess you do, but there's a better way (aside from avspmod which poisondeathray has already mentioned).
    Create the script for encoding the whole video, then open it with the AVS Cutter under MeGUI's Tools menu... or I think there's a standalone version if you don't use MeGUI. The AVS Cutter will open the script with a preview which displays frame numbers etc, but the idea is to use the preview to set multiple start and end points, then MeGUI or the AVS Cutter will add them all to the script for you. MeGUI writes the Trims in a slightly different way to the method you used, but the end result is the same. It adds the Trims to the script like this:

    __film = last
    __t0 = __film.trim(0, 21093)
    __t1 = __film.trim(40427, 57685)
    __t2 = __film.trim(88844, 128792)
    __t0 ++ __t1 ++ __t2


    PS MeGUI can cut or re-encode the audio using a "cuts file" which the AVS Cutter creates, so it can split/rejoin or encode the audio to match the Trims added to the script if you need it to.
    Quote Quote  
  4. Originally Posted by vhelp View Post
    i think what i am looking for is the ability to use an infinate number of trim() inside a function, or as many values i need to add as trims, something like this:

    VideoTrim(69..103, 238..446, 495..554, 656..786)
    I don't think it's possible, and in my opinion it'd probably be a bad idea anyway, because sooner or later you'll probably discover the joy of being able to use different filtering or cropping etc for each Trim. As an example, if you want to add three Trims to a script and crop the video differently each time, while also adding noise filtering to one Trim, you might do something like this:

    trim(0, 21093).crop(4, 2, -6, -4).Spline36Resize(1280,720)\
    ++trim(40427, 57685).crop(12, 8, -12, -4).Spline36Resize(1280,720)\
    ++trim(88844, 128792).FluxSmoothST().crop(12, 6, -10, -4).Spline36Resize(1280,720)

    For the record, if you use the above method rather than add Trims to the script the way MeGUI does it, putting a "\" at the end of each one allows you to put the next trim on a new line rather than having them all joined together in a single line. Even if you're just using Trims without different filtering for each, having each Trim on an individual line might make life a little easier if you're adding lots of them to a script.

    trim(0, 21093)\
    ++trim(40427, 57685)\
    ++trim(88844, 128792)
    Last edited by hello_hello; 4th Dec 2013 at 06:13.
    Quote Quote  
  5. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    VideoTrim(69..103, 238..446, 495..554, 656..786) or
    VideoTrim(69,103, 238,446, 495,554, 656,786)
    i am only feeding cut scenes, not filtering. i'm not looking for do any filtering. i am only encoding these scenes.

    so currently, there is no way to code an avisynth script function to feed in (dynamically, i.e., selectevery) any amount of trim() values. not that it is impossible but that no one is savy (or interested) enough to do it.

    then i will continue to do it the long way like everyone else. thank you for your other suggestion though.
    Quote Quote  
  6. Originally Posted by vhelp View Post
    i am only feeding cut scenes, not filtering. i'm not looking for do any filtering. i am only encoding these scenes.
    I understand. I just thought I'd explain the advantage Trim can offer when using filtering.

    Originally Posted by vhelp View Post
    so currently, there is no way to code an avisynth script function to feed in (dynamically, i.e., selectevery) any amount of trim() values. not that it is impossible but that no one is savy (or interested) enough to do it.

    then i will continue to do it the long way like everyone else. thank you for your other suggestion though.
    If it can be done the way you'd prefer my Avisynth knowledge falls short.

    "Continue to do it the long way" is the sort of thing I have trouble getting my head around. Fair enough if the short way requires an initial learning curve and it's not something you'll be doing often, but when the short way is as easy as it gets......
    Each to their own but the two methods are effectively the same except one requires you to add each Trim to a script manually while the other doesn't, although it'll let you type in every frame number manually if you'd prefer.

    Behind MeGUI's AVS Cutter is it's preview window (to make the image smaller). The same navigation and zone setting abilities as VirtualDub. Frame numbers and time stamps at the top. Easier resizing of the video preview. The AVS cutter contains three trims I've specified. Three or three hundred, once they're set it adds them all to the script with the click of a button. For me, discovering the AVS Cutter finally meant about the only reason for using VirtualDubMod again was to remux the occasional AVI.

    Don't worry, that'll be the extent of my nagging you about it.

    Click image for larger version

Name:	Clipboard01.gif
Views:	627
Size:	69.3 KB
ID:	21799
    Last edited by hello_hello; 8th Dec 2013 at 14:34.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!