VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. Banned
    Join Date
    Dec 2010
    Location
    New York
    Search Comp PM
    How can I break a GOP up into segments, do whatever filtration I need to do with each segment separately, and rejoin them? Can someone post a sample script for this?

    Thanks.
    Quote Quote  
  2. Originally Posted by unclescoob View Post
    How can I break a GOP up into segments, do whatever filtration I need to do with each segment separately, and rejoin them? Can someone post a sample script for this?

    I'm not entirely sure what you are asking

    You can't "break up a GOP" using avisynth scripts, because avisynth frameserve uncompressed video , so the idea of GOP's no longer exist

    If you are starting with MPEG2 video, you can use something like mpg2cut2 or avidemux to cut along GOP segments . So if there was a certain section that you wanted filtered (but you don't want to the re-encode other segments) , you could cut them with those tools, filter, re-encode, then rejoin
    Quote Quote  
  3. Banned
    Join Date
    Dec 2010
    Location
    New York
    Search Comp PM
    I should rephrase. Imagine a frame, any frame of a clip, broken up into segments (the same way you would cut a picture into six squares with scissors). Work with those segments individually as I wish, then rejoin them to make the whole image again.

    The reason I said GOP's (group of pictures) is because I would like to apply this same action to several pictures at once.
    Quote Quote  
  4. Originally Posted by unclescoob View Post
    I should rephrase. Imagine a frame, any frame of a clip, broken up into segments (the same way you would cut a picture into six squares with scissors). Work with those segments individually as I wish, then rejoin them to make the whole image again.
    So do you mean part of a frame in a sequence, e.g. like the top right hand corner over a range of certain frames?

    If so, a general approach would be to crop() plus whatever filters, and overlay() using x,y coordinates . You can think of it as the filtered section "covering up" the old unfiltered section , leaving the other parts of the frame untouched

    Another way would be to apply your filters through masks, either with masktools or overlay

    There are other ways of doing this, but you have to describe more information on what filters and transformations and programs you plan using (e.g. photoshop ?)


    (GOP has very specific connotation in video encoding, as you can imagine the confusion)
    http://en.wikipedia.org/wiki/Group_of_pictures
    Quote Quote  
  5. Banned
    Join Date
    Dec 2010
    Location
    New York
    Search Comp PM
    I accomplished the first portion of this goal with crop. For example, here are my steps:

    1. I loaded the full clip.

    2. I cropped off the RIGHT half part of the image, added the filter that I needed to the portion of the image left, then added a border to turn it back into the same size video it was. Saved it as clip 1.

    3. I then loaded the original full image again, and this time cropped off the LEFT half of the image, added a filter completely different from the one in clip 1, then added the same size border that I cropped off in that area, and saved it as clip 2.

    How do I put these halves together to form my new clip?
    Quote Quote  
  6. For example:

    Code:
    tl = Crop(0, 0, width/2, height/2)
    tr = Crop(width/2, 0, width/2, height/2)
    bl = Crop(0, height/2, width/2, height/2)
    br = Crop(width/2, height/2, width/2, height/2)
    
    # filter each
    
    StackVertical(StackHorizontal(tl, tr), StackHorizontal(bl, br))
    Quote Quote  
  7. Banned
    Join Date
    Dec 2010
    Location
    New York
    Search Comp PM
    jagabo, suppose I want to apply a different filter to tl, tr, bl, br. How would that script look? Can you please post a sample?
    Quote Quote  
  8. Originally Posted by unclescoob View Post
    jagabo, suppose I want to apply a different filter to tl, tr, bl, br. How would that script look? Can you please post a sample?
    You just add the filter after with a period

    eg..

    Code:
    WhateverSource()
    tl = Crop(0, 0, width/2, height/2).SomeFilter1() 
    tr = Crop(width/2, 0, width/2, height/2) 
    bl = Crop(0, height/2, width/2, height/2) 
    br = Crop(width/2, height/2, width/2, height/2)  
    
    StackVertical(StackHorizontal(tl, tr), StackHorizontal(bl, br))
    In this example, top left (tl), was treated with SomeFilter1()


    The potential problems with doing it this way (With stackhorizontal or stackvertical):

    1) You get an abrupt demarcation. There is no gradual blending or "feathering". Think of where you have a noisy filter video, and you filter the top left quadrant, it might look completely different and "out of place".

    2) Only square areas are filtered - it's difficult to filter non square regions. What if you need a circle area filtered?

    With the overlay approach using masks, you can feather the mask and make it blend in better
    Quote Quote  
  9. Originally Posted by poisondeathray View Post
    Originally Posted by unclescoob View Post
    jagabo, suppose I want to apply a different filter to tl, tr, bl, br. How would that script look? Can you please post a sample?
    You just add the filter after with a period

    eg..

    Code:
    WhateverSource()
    tl = Crop(0, 0, width/2, height/2).SomeFilter1() 
    tr = Crop(width/2, 0, width/2, height/2) 
    bl = Crop(0, height/2, width/2, height/2) 
    br = Crop(width/2, height/2, width/2, height/2)  
    
    StackVertical(StackHorizontal(tl, tr), StackHorizontal(bl, br))
    Or you can add the filters where I specfied:

    Code:
    tl = Crop(0, 0, width/2, height/2)
    tr = Crop(width/2, 0, width/2, height/2)
    bl = Crop(0, height/2, width/2, height/2)
    br = Crop(width/2, height/2, width/2, height/2)
    
    tl = Invert(tl)
    br = Invert(br)
    
    StackVertical(StackHorizontal(tl, tr), StackHorizontal(bl, br))
    Note that this has some restrictions on the frame size. Width/2 and height/2 must be valid frame sizes for the colorspace. For example, they must be mod 2 if the colorspace is YV12. Meaning the full width and height must be mod 4.
    Quote Quote  
  10. Banned
    Join Date
    Dec 2010
    Location
    New York
    Search Comp PM
    Ok, it worked. You're right about those hard-to-reach areas.

    I'll give overlay a shot. Not sure how it works, but I'll read up on it.

    Thanks!
    Quote Quote  



Similar Threads

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