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".
If there's an easier way to set different settings on different sections of a video then please let me know.Code:ApplyRange(0,149,"Crop", 0,0,30,0) ApplyRange(0,149,"AddBorders", 0,0,30,0, $000000)
+ Reply to Thread
Results 1 to 30 of 40
-
-
Smth like this:
Code:trim(0,149).Crop(0,0,-30,0).AddBorders(0,0,30,0,$000000)++trim(150,0)
Code:trim(0,149).Letterbox(0,0,0,30,$000000)++trim(150,0)
P.S. Don't forget to use (-) in Crop() for right/bottom numbers. -
Last edited by sanlyn; 24th Mar 2014 at 12:14.
-
-
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.
-
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.
-
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)
-
-
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)
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.
-
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
-
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)
-
Take out the period before the "++" , right after the endbracket of the RGBAdjust (you have an extra period)
-
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 -
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)
-
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() -
Last edited by manono; 9th Dec 2012 at 15:40.
-
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)
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) -
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)
-
-
I've done it before in a thread of yours:
https://forum.videohelp.com/threads/346908-How-to-Encode-Parts-of-a-Video-at-Different-...le#post2168390
Or, even more explicitly, in a different thread (easy to find by searching):
https://forum.videohelp.com/threads/349488-different-color-settings-on-different-parts-...le#post2189190 -
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.
-
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.
-
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.
-
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.
-
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.
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. -
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.
-
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"...)
Similar Threads
-
Do Avisynth and Premiere work well on Windows 7?
By spicediver10191 in forum EditingReplies: 11Last Post: 21st Sep 2012, 18:45 -
How to Remove Dancing Pixels with Avisynth when Denoisers don't work?
By VideoFanatic in forum RestorationReplies: 61Last Post: 23rd Aug 2012, 21:19 -
Can't get RemoveSpots to work with Avisynth
By VideoFanatic in forum RestorationReplies: 8Last Post: 21st Aug 2012, 08:09 -
AVIsynth refuses to work anymore... Plz help!
By Nagashi in forum Newbie / General discussionsReplies: 3Last Post: 24th Dec 2010, 17:44 -
how do I install x264.exe to work AND to work with Lemings GUI?
By Krelmaneck in forum Newbie / General discussionsReplies: 1Last Post: 14th Nov 2010, 22:13