VideoHelp Forum




+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 40
  1. My video is 720 x 480. I want to crop some garbage from it. When I use the following I get this error: "filtered and unfiltered video frame sizes must match".

    Code:
    ApplyRange(0,149,"Crop", 0,0,30,0)
    ApplyRange(0,149,"AddBorders", 0,0,30,0, $000000)
    If there's an easier way to set different settings on different sections of a video then please let me know.
    Quote Quote  
  2. Member Alex_ander's Avatar
    Join Date
    Oct 2006
    Location
    Russian Federation
    Search Comp PM
    Smth like this:

    Code:
    trim(0,149).Crop(0,0,-30,0).AddBorders(0,0,30,0,$000000)++trim(150,0)
    or:

    Code:
    trim(0,149).Letterbox(0,0,0,30,$000000)++trim(150,0)
    Probably you could also use Letterbox within ApplyRange(), since it doesn't change frame size for separate parts of video, just covers it with borders.

    P.S. Don't forget to use (-) in Crop() for right/bottom numbers.
    Quote Quote  
  3. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Originally Posted by holygamer View Post
    My video is 720 x 480. I want to crop some garbage from it. When I use the following I get this error: "filtered and unfiltered video frame sizes must match".

    Code:
    ApplyRange(0,149,"Crop", 0,0,30,0)
    ApplyRange(0,149,"AddBorders", 0,0,30,0, $000000)
    If there's an easier way to set different settings on different sections of a video then please let me know.
    You can't change frame sizes within an ApplyRange() clip, which is what you're doing with "Crop" inside the ApplyRange statement.
    Crop and Add Borders before using ApplyRange, or Crop+AddBorders and then Trim. You can always rejoin sections into the main AVI later.
    Last edited by sanlyn; 24th Mar 2014 at 12:14.
    Quote Quote  
  4. Originally Posted by Alex_ander View Post

    Code:
    trim(0,149).Crop(0,0,-30,0).AddBorders(0,0,30,0,$000000)++trim(150,0)
    or:

    Code:
    trim(0,149).Letterbox(0,0,0,30,$000000)++trim(150,0)
    Probably you could also use Letterbox within ApplyRange(), since it doesn't change frame size for separate parts of video, just covers it with borders.
    Thanks. That works. I read the trim documentation but I didn't really understand it. I understand the example you gave me but what does the ++ part do? Is that for adding a new trim? Do I have to keep it on the same line? If I have a 3rd trim do I have 3 pluses?
    Quote Quote  
  5. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Originally Posted by holygamer View Post
    I read the trim documentation but I didn't really understand it. I understand the example you gave me but what does the ++ part do? Is that for adding a new trim? Do I have to keep it on the same line? If I have a 3rd trim do I have 3 pluses?
    Avisynth's scripting language provides + and ++ operators as synonyms for UnalignedSplice and AlignedSplice respectively.
    http://avisynth.org/mediawiki/AlignedSplice

    When using trim you specify the start frame and the end frame of the section you want to keep.
    Trim(0,149) keeps frames 0 to 149 of the clip.

    If you specify Trim(start frame, 0), the "0" as the end-frame means there is no end frame -- got all the way to the end.
    Trim(150,0) keeps frames 150 thru the end of the clip.
    Last edited by sanlyn; 24th Mar 2014 at 12:14.
    Quote Quote  
  6. As far as I know you only need to use '++' if there's audio in the script. Without audio a single '+' between trims is enough to add them all together.
    Quote Quote  
  7. I don't want to cut anything from my video, I just want to use different settings on different parts of the video. The trim documentation seems to indicate that trim is for cutting parts out of a video. All I'm looking for is the easiest way to use different settings on different part of the video.

    I tried using apply range and I can get it working with tweak but not RGBAdjust. It says invalid arguments to function "ApplyRange":

    Code:
    ConvertToRGB32(interlaced=true) 
    ApplyRange(0,18234,"Tweak",0,0.8,10,1.1,False,"RGBAdjust", 0.9, 0.9, 0.8, 1.0, 0.0, 0.0, 0.0, 0.0, 1.00) 
    converttoyv12(interlaced=true)
    ApplyRange(18235,73155,"Tweak",0,0.8,10,1.1,False,"RGBAdjust", 0.9, 0.9, 0.8, 1.0, 0.0, 0.0, 0.0, 0.0, 1.00)
    Quote Quote  
  8. Originally Posted by holygamer View Post
    I don't want to cut anything from my video, I just want to use different settings on different parts of the video. The trim documentation seems to indicate that trim is for cutting parts out of a video. All I'm looking for is the easiest way to use different settings on different part of the video.
    The script you were given will do what you want. It cuts a part out, modifies it, then pastes it back in.
    Quote Quote  
  9. Could you please give an example as I'm still a bit confused.
    Quote Quote  
  10. You were already given examples in post #2.

    Code:
    trim(0,149).Crop(0,0,-30,0).AddBorders(0,0,30,0,$000000)++trim(150,0)
    Translation:

    Code:
    WhateverSource()
    
    part1 = trim(0,149) # make frames 0 to 149 into a separate video
    part1 = Crop(part1,0,0,-30,0) # crop that separate video
    part1 = AddBorders(part1,0,0,30,0,$000000) # addborders to that separate video
    
    part2 = trim(150,0) # create another video with frames 150 to the end of the original video
    
    return(part1++part2) # append part2 to part1 and return them
    Last edited by jagabo; 9th Dec 2012 at 11:53.
    Quote Quote  
  11. IMO, trim is the easiest, most intuitive way to do what you're trying to do (apply different filter settings to different sections) . ApplyRange doesn't work with all filters
    Quote Quote  
  12. Code:
    trim(0,18234). Tweak(Hue=-0, Sat=0.7, Bright=10, Cont=1.1, Coring=False). ConvertToRGB32(interlaced=true). RGBAdjust(0.9, 0.9, 0.8, 1.0, 0.0, 0.0, 0.0, 0.0, 1.00). ++trim(18235,0). Tweak(Hue=-0, Sat=0.7, Bright=10, Cont=1.1, Coring=False)
    I have the above script but I'm getting an error which says script error, expected function name following `.' It says the error is after the 2nd ++ in the 2nd trim.
    Quote Quote  
  13. Take out the period before the "++" , right after the endbracket of the RGBAdjust (you have an extra period)
    Quote Quote  
  14. Now it says "Splice: video formats don't match"
    Quote Quote  
  15. converttoyv12(interlaced=true) after the RGBAdjust endbracket. Add back the period after the endbracket, before the converttoyv12(interlaced=true)

    does it make sense to you why you add this back ? You should try to learn the reasoning behind this
    Quote Quote  
  16. Yeah it makes sense, I just forgot to add it for some reason.

    Code:
    trim(0,18234). Tweak(Hue=-0, Sat=0.7, Bright=10, Cont=1.1, Coring=False). ConvertToRGB32(interlaced=true). RGBAdjust(0.9, 0.9, 0.8, 1.0, 0.0, 0.0, 0.0, 0.0, 1.00).converttoyv12(interlaced=true) ++trim(18235,0) Tweak(Hue=-0, Sat=0.7, Bright=10, Cont=1.1, Coring=False)
    It's working now. Does it matter if I have a period before the last tweak? Having it or not doesn't seem to make a difference.
    Quote Quote  
  17. Really? I think it should matter . Using the period to include everything on one line is the same thing as breaking it out

    e.g

    WhateverSource()
    Filter1()
    Filter2()

    is the same thing as

    WhateverSource() . Filter1() . Filter2()
    Quote Quote  
  18. Originally Posted by holygamer View Post
    Does it matter if I have a period before the last tweak?
    Yeah, it matters. Why not have the Tweak on its own for the entire film since it's the same in both instances? That way you don't have to have it twice, in each of the 2 parts being trimmed.
    Last edited by manono; 9th Dec 2012 at 15:40.
    Quote Quote  
  19. Code:
    trim(0,18234). Tweak(Hue=-0, Sat=0.7, Bright=10, Cont=1.1,  Coring=False). ConvertToRGB32(interlaced=true). RGBAdjust(0.9, 0.9, 0.8,  1.0, 0.0, 0.0, 0.0, 0.0, 1.00).converttoyv12(interlaced=true)  ++trim(18235,0) Tweak(Hue=-0, Sat=0.7, Bright=10, Cont=1.1,  Coring=False)
    What I'm saying is that the functionality of the script seems to remain the same whether I include a period before the last weak or not.

    I know the tweaks are the same, I'm just using it as an example.

    Is there no way to have each part of the script on a new line? I tried that with and without the periods and it didn't work.

    Also if I want to do multiple trims then do I just add the following onto the end (and change the values)? ++trim(18235,0)
    Quote Quote  
  20. I'm not sure what I've done wrong here but when I change the tweak values or RGBAdjust values for one trim it also changes it for the other:

    Code:
    trim(0,18234). Tweak(Hue=-0, Sat=1.0, Bright=0, Cont=1.1, Coring=False).
    ConvertToRGB32(interlaced=true). RGBAdjust(1.0, 1.0, 0.9, 1.0, 0.0, 0.0, 0.0, 0.0, 1.00)
    .converttoyv12(interlaced=true) ++trim(18235,0). Tweak(Hue=-0, Sat=1.0, Bright=130, Cont=1.1, Coring=False)
    ConvertToRGB32(interlaced=true). RGBAdjust(0.9, 0.9, 0.8, 1.0, 0.0, 0.0, 0.0, 0.0, 1.00)
    Quote Quote  
  21. Originally Posted by holygamer View Post
    What I'm saying is that the functionality of the script seems to remain the same whether I include a period before the last weak or not.
    What you're saying is wrong. Without the period the Tweak isn't used.

    And once you have 3 or 4 Trim statements (and begin getting all confused, as you seem to be doing), for me the RemapFrames filter with ReplaceFramesSimple is way easier to use.
    Quote Quote  
  22. Could you please give an example script for that?
    Quote Quote  
  23. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    mm, if Trim() is that difficult, ReplaceFramesSimple won't be easier IMO. But it requires two clips, one of which could be created in the script.

    Code:
    Vid1=AviSource (or whatever source)
    vid2 = vid1.trim(0,18234)
    vid2.ConvertToRGB32(interlaced=true).RGBAdjust(0.9,0.9,0.8,1.0,0.0,0.0,0.0,0.0,1.00).converttoyv12(interlaced=true)
    vid3=ReplaceFramesSimple(vid1,vid2,mappings="[0 18234]").Tweak(Hue=-0, Sat=0.7, Bright=10, Cont=1.1, Coring=False)
    return vid3
    Last edited by sanlyn; 24th Mar 2014 at 12:14.
    Quote Quote  
  24. Originally Posted by sanlyn View Post
    mm, if Trim() is that difficult, ReplaceFramesSimple won't be easier to understand IMO. But it will look simpler. It requires two clips, one of which could be created in the script.

    Code:
    Vid1=AviSource (or whatever source)
    vid2 = vid1.trim(0,18234)
    vid2.ConvertToRGB32(interlaced=true).RGBAdjust(0.9,0.9,0.8,1.0,0.0,0.0,0.0,0.0,1.00).converttoyv12(interlaced=true)
    vid3=ReplaceFramesSimple(vid1,vid2,mappings="[0 18234]").\
      Tweak(Hue=-0,Sat=0.7,Bright=10,Cont=1.1,Coring=False)
    return vid3
    And how is vid1/vid2 any different from BaseClip/SourceClip? Or from A/B for that matter? Call them what you will. And by writing the script the way you did you've prevented any other filtering either before or after using ReplaceFramesSimple. Its worth it's weight in gold when you have to call the same filter about 10 different times within the same video. For something like that Trims are more-or-less useless. Here is a typical one for me, trying to get the brightness/contrast/levels looking better during one stage of a VHS to DVD project. I defy you to do this using Trims:

    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Cont=0.90,Coring=False )
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[37113 47556] ")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=7,Cont=0.95,Cor ing=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[19751 19766] [26908 28788] [33630 33738] [34650 35296] [38890 38988] [39012 39014] [39015 39032] [59802 59898][62126 62259] ")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-2,Cont=1.2,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[194453 194836]")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-5,Cont=1.05,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[62869 66901] [173733 174328] [176524 179713]")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-5,Cont=1.05,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[62869 67192]")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-5,Cont=1.00,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[0 2240] [10850 19330] [62626 62868] [63906 64929] [65639 67192]")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-13,Cont=1.35,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[76201 77190] [84742 84796] [195099 195631] [195673 196101] [196754 197311]")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-8,Cont=1.2,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[77191 80846]")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-15,Cont=1.02,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[59158 59210] [60032 60138] [61698 62476] [82346 82471] [88248 92362] [149698 150547] [178664 178696] [178721 178785] [178847 178872] [178900 179065] [179484 179713] [179743 179816] [179840 179920] [180716 180811] ")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-10,Cont=1.02,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[35407 35592] [44408 44580] [58850 59157] [59211 59224] [59331 60031] [60139 60291] [60543 60692] [61092 61104] [61117 68695] [150570 151966]")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-5,Cont=1.12,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[3580 10849] [50891 51130] ")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=-16,Cont=1.05,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[21485 24333] ")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=8,Cont=0.95,Cor ing=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[59661 59737] ")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.YLevelsS(0,1.6,255,0,255).Tw eak(Bright=3,Cont=0.90,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[47995 50463] [59225 67818] ")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.YLevelsS(0,1.6,255,0,255).Tw eak(Bright=-2,Cont=0.93,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[11154 19875] [34567 34588] [59764 59898] [60543 60692] [61698 62476] [68211 68695] [68696 76200] [174938 175313] ")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.YLevelsS(0,1.6,255,0,255).Tw eak(Bright=9,Cont=0.9,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[28841 29097] [30518 30557] [33807 34070] [35273 35283] ")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Levels(0,0.75,255,0,255,Cori ng=False).Tweak(Bright=0,Cont=1.02,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[24334 28788] [37601 38197] [39012 39108]")
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Levels(0,0.85,255,0,255,Cori ng=False).Tweak(Bright=5,Cont=0.93,Coring=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[28789 28821] [28935 29153] [34071 34107] [39797 41781] [44975 47352] [51161 51193] [121392 122411] [181648 185111]")
    Last edited by manono; 9th Dec 2012 at 20:45.
    Quote Quote  
  25. Instead of a sequence like:

    Code:
    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Cont=0.90,Coring=False  )
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[37113 47556] ")

    Isn't this much clearer?

    Code:
    ReplaceFramesSimple(last, Tweak(Cont=0.90, Coring=False), Mappings="[37113 47556]")


    Or, if you want the filter sequence on its own line, something like:
    Code:
    filtered=Tweak(Cont=0.90,Coring=False  )
    ReplaceFramesSimple(last,filtered,Mappings="[37113 47556] ")


    Last edited by jagabo; 9th Dec 2012 at 21:16.
    Quote Quote  
  26. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Yes, one could refresh Source Clip and Base Clip forever, and work a different process with each batch of frames. Eliminate the return statement, replace Vid1/Vid2 with Base Clip/Source Clip (or whatever), and Vid3 reference isn't needed. Tried to keep it shorter for holygamer.

    Could be even shorter by using one and the same Tweak near the end and applying it to all the previous frame groups if relevant. Alas, I've had to work on video that required 5 minutes to be broken into a dozen 30 to 100 frame clips, each requiring a different fix. Not fun.
    Last edited by sanlyn; 24th Mar 2014 at 12:14.
    Quote Quote  
  27. Originally Posted by jagabo View Post

    Isn't this much clearer?

    Code:
    ReplaceFramesSimple(last, Tweak(Cont=0.90, Coring=False), Mappings="[37113 47556]")
    Yes, and I was trying to figure out some reason it wouldn't work, but couldn't come up with one. I just grab my scripts from people that know more than I and this way to set it up has worked nicely for me. I have templates with it included, and I just cut and paste when I need more, and change the filters used and the frame numbers. Thanks, this will make it simpler for sure.

    Originally Posted by sanlyn View Post
    Alas, I've had to work on video that required 5 minutes to be broken into a dozen 30 to 100 frame clips, each requiring a different fix. Not fun.
    Assuming at least some of the time you're using the same filter for different groups of frames, ReplaceFramesSimple is what you want, I think. Trimming out everything is a nightmare, and I just hate ApplyRange.
    Quote Quote  
  28. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    No, usually the corrections are completely different for each frame group -- one of those really bad VHS sources that has different grunge and levels in every scene change. But assuming I could use the same fix for different groups, yes, one line with one fix and different frame groups would do it.

    But now I'm wondering what this statement is doing:
    RGBAdjust((0.9,0.9,0.8,1.0,0.0,0.0,0.0,0.0,1.00)

    The first two "0.9" parms reduce all red and green RGB values by 10%. The "0.8" reduces all blue values by 20%. The values that follow do nothing. Wouldn't the overall effect be to make the clip a bit more more yellow and visibly darker overall? It would be nice if holygamer had let us know exactly what correction is wanted.
    Last edited by sanlyn; 24th Mar 2014 at 12:15.
    Quote Quote  
  29. Originally Posted by holygamer View Post
    I tried using apply range and I can get it working with tweak but not RGBAdjust. It says invalid arguments to function "ApplyRange":

    Code:
    ConvertToRGB32(interlaced=true) 
    ApplyRange(0,18234,"Tweak",0,0.8,10,1.1,False,"RGBAdjust", 0.9, 0.9, 0.8, 1.0, 0.0, 0.0, 0.0, 0.0, 1.00) 
    converttoyv12(interlaced=true)
    ApplyRange(18235,73155,"Tweak",0,0.8,10,1.1,False,"RGBAdjust", 0.9, 0.9, 0.8, 1.0, 0.0, 0.0, 0.0, 0.0, 1.00)
    ApplyRange() can only be used for one filter. You'll have to use separate calls for Tweak() and RGBAdjust(). Oh, and Tweak() only works in YUV, and RGBAdjust() only works in RGB.

    Code:
    ConvertToYV12()
    ApplyRange(..."Tweak"...)
    ConvertToRGB()
    ApplyRange(..."RGBAdjust"...)
    Quote Quote  



Similar Threads

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