VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    I have a fairly long DVD with many scenes from different tape transfers. So the black boarders on the left and right shift by a few pixels between the different scenes. So using a single crop setting for the entire video would be perfect for some scenes, but would also leave a black bar on the left or right of many scenes. Even though video picture is being cut off the opposite side.

    My knowledge of avisynth is modest but I'm not really sure how to do a custom crop for a group of frames, and then another custom crop for a different scene. I'll be using the same amount of cropping and resolution for the entire video, it's just a matter of cutting off more from the left or the right.

    Currently my only option is to just crop the video in segments with trim(), and just encode each scene separately. Appending it all together with MKVmerge. It works this way, just wondering how to do it in one go with avisynth.

    Any guidance would be nice.
    Last edited by KarMa; 26th Nov 2015 at 03:09. Reason: grammar
    Quote Quote  
  2. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    You may enjoy AutoCrop in this case.
    Quote Quote  
  3. Perhaps something like this:

    A=Last
    B=A.Crop(8,0,-8,0).AddBorders(8,0,8,0)
    ReplaceFramesSimple(A,B,Mappings="[0 16666] ")
    A=Last
    B=A.Crop(12,0,-4,0).AddBorders(8,0,8,0)
    ReplaceFramesSimple(A,B,Mappings="[16667 183207] ")
    A=Last
    B=A.Crop(4,0,-12,0).AddBorders(8,0,8,0)
    ReplaceFramesSimple(A,B,Mappings="[183208 251009] ")


    RemapFramesSimple is part of stickboy's RemapFrames. If you prefer you can also string together a bunch of Trims:

    X=Last
    A=X.Trim(0,16666).Crop(8,0,-8,0).AddBorders(8,0,8,0)
    B=X.Trim(16667 183207).Crop(12,0,-4,0).AddBorders(8,0,8,0)
    C=X.Trim(183208,251009.Crop(4,0,-12,0).AddBorders(8,0,8,0)
    A+B+C


    I prefer ReplaceFramesSimple because if you have to do a whole bunch of different crops throughout the movie, you can add the repeated ones (same crop values) to where you first used those same crop values:

    B=A.Crop(12,0,-4,0).AddBorders(8,0,8,0)
    ReplaceFramesSimple(A,B,Mappings="[16667 183207] [195000 197000] [199000 201000] ")


    whereas adding together a whole bunch of Trim statements can get kind of unwieldy. Whichever way you prefer.
    Last edited by manono; 26th Nov 2015 at 03:15.
    Quote Quote  
  4. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    Thank you LigH for pointing out AutoCrop, I tried it for awhile but I think I would rather set the cropping. Will probably use it when/if I have lots and lots of clips to deal with.

    Thank you manono as that was exactly what I wanted. This works perfectly.

    What I've done so far.

    X=Last
    A=X.Trim(0, 327).crop(12, 0, -6, 0).Spline64Resize(640,480)
    B=X.Trim(328, 10893).crop(12, 0, -6, 0).Spline64Resize(640,480)
    C=X.Trim(10894, 41294).crop(12, 0, -6, 0).Spline64Resize(640,480)
    D=X.Trim (41295, 49970).crop(16, 0, -2, 0).Spline64Resize(640,480)
    E=X.Trim(49971, 176264).crop(8, 0, -10, 0).Spline64Resize(640,480)
    F=X.Trim(176265, 202307).crop(6, 0, -12, 0).Spline64Resize(640,480)
    G=X.Trim(202308, 206628).crop(8, 0, -10, 0).Spline64Resize(640,480)
    H=X.Trim(206629, 211035).crop(6, 0, -12, 0).Spline64Resize(640,480)
    A+C+D+E+F+G+H #I cut out B
    Last edited by KarMa; 26th Nov 2015 at 05:01.
    Quote Quote  
  5. Originally Posted by KarMa View Post
    Thank you manono as that was exactly what I wanted. This works perfectly.
    I too find that can simetimes get out of control when you use a lot of trims, especially if you tend to change your mind and alter, add or remove them. I tend to do it like this:

    Trim(0, 327).crop(12, 0, -6, 0).Spline64Resize(640,480) \
    ++Trim(328, 10893).crop(12, 0, -6, 0).Spline64Resize(640,480) \
    ++Trim(10894, 41294).crop(12, 0, -6, 0).Spline64Resize(640,480) \
    ++Trim (41295, 49970).crop(16, 0, -2, 0).Spline64Resize(640,480) \
    ++Trim(49971, 176264).crop(8, 0, -10, 0).Spline64Resize(640,480)

    Then you can modify the trim ranges and add, delete or insert new ones without needing to also do the same for the sequence telling Avisynth what to encode as it's not needed. Whatever works though....

    And you only need to add resizing to each line to keep the resolution the same if the cropping doesn't result in the same resolution. If it does:

    Trim(0, 327).crop(12, 0, -6, 0) \
    ++Trim(328, 10893).crop(12, 0, -6, 0) \
    ++Trim(10894, 41294).crop(12, 0, -6, 0) \
    ++Trim (41295, 49970).crop(16, 0, -2, 0) \
    ++Trim(49971, 176264).crop(8, 0, -10, 0)
    Spline64Resize(640,480)
    Last edited by hello_hello; 26th Nov 2015 at 10:11.
    Quote Quote  



Similar Threads

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