Suppose I wish to apply different settings of a particular filter to a clip (or) different filters to different parts of a clip.
How can I do this in avisynth?
Thanks
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 29 of 29
Thread
-
-
You can divide up your video into segments using trim, then join with aligned splice or use applyrange()
http://avisynth.org/mediawiki/ApplyRange
e.g
Code:a= avisource() a1 = a.trim(0,100).filter1() a2 = a.trim(101,200).filter2() a3 = a.trim(201,300) a1 ++ a2 ++ a3
-
You can use applyrange but it's use is limited otherwise the solution above is certainly a 1st option
*** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE -
I usually use ReplaceFramesSimple which is part of stickboy's RemapFrames:
http://avisynth.org/stickboy/
The usage goes something like this:
BaseClip=Last
SourceClip=BaseClip
SourceClip=SourceClip.YourFilterHere
ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[0 189] [7607 7613]")
That uses the filter from frames 0-189 and 7607-7613. It can be called (and different filters used) as many times as you like in a single script. -
Thank heaven I have TMPGenc Plus and TMPGenc MPEG editors. I'd have a nervous breakdown cutting/joining the typical 10 to 20 segments you need for color-correcting several minutes of bad VHS. All the methods mentioned above will work, though. I've used 'em a few times - - my last (3-hour) VHS restoration had more than 300 color-corrected segments.
Last edited by sanlyn; 21st Mar 2014 at 07:40.
-
I prefer to avoid using named variables when possible. It makes it simpler and more extensible -- you don't have to keep thinking up new names (even if they're a9, a10 a11...)
Code:avisource() trim(0,100).filter1() ++\ trim(101,200).filter2() ++\ trim(201,300)
ReplaceFramesSimple is good too, especially when I need to use the same filter (such as a delogo) on a number of disconnected segments. -
Or I could just cut the segments in Virtualdub (keyframes, of course). Then I could save them, apply whatever filter I need, and rejoin them.
-
I don't think AVI files have keyframes.
Someone jump up and hit me with a correction if I'm wrong on that. Well, don't hit me -- just nudge.
If you do all this cutting in Avisynth, remember that the audio might not match up at the end of the cut segments. Better to Trim() in Avisynth to keep audio aligned at the edit point.Last edited by sanlyn; 21st Mar 2014 at 07:41.
-
No, please. Someone don't jump up with anymore corrections. Even a simple question in this forum turns into an unecessary, triple-bypass, neurotically egotistical smartboy debate that does nothing but lead to further confusion.
I got it. Thanks.
But yes, Virtualdub does give you the option to trim your MPEG with keyframes, then save as an AVI -
Yep. I have other questions about the last script I posted, but can't get to it now. Later.
Last edited by sanlyn; 21st Mar 2014 at 07:41.
-
This isn't working out guys. Trim only TRIMS from one selected frame to another. Alan, I tried it your way:
avisource()
trim(0,100).filter1() ++\
trim(101,200).filter2() ++\
trim(201,300)
But it will just select frame from 0 - 100 and that's it. It won't divide my clip into different segments where I can apply different filters. What am I doing wrong? -
vid1 = AVISource("C:\MyVideo.avi").trim(0,100).filter1(). filter2().filter3()....
vid2 = AVISource("C:\MyVideo.avi").trim(101,200).filter1( ).filter2().filter3()....
vid3 = AVISource("C:\MyVideo.avi").trim(201,300).filter1( ).filter2().filter3()....
vid1 ++ vid2 ++ vid3
That's how i do personally*** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE -
It should work.
Is that your complete script? You've probably got something else that's interfering with the final result.
You're unnecessarily opening the file three times, using more memory, etc. Better would be:
v = AVISource("C:\MyVideo.avi")
vid1 = v.trim(0,100).filter1().filter2().filter3()....
vid2 = v.trim(101,200).filter1().filter2().filter3()....
vid3 = v.trim(201,300).filter1().filter2().filter3()....
vid1 ++ vid2 ++ vid3 -
Spoke to soon. Yes, trim works perfectly for what I needed to do with this video. Then came authoring time. When I played my dvd, the audio is completely out of sync. My video looks fine. Doesn't appear too slow or anything. The audio is going faster than the video. Does trim result in this nonsense or was it a coincidence and just a bad author?
-
If you play the joined AVI in MediaPlayer or VLC Player, etc., is the sound in sync? If the AVI is outta sync in a media player before you encode or author, it won't be in sync later.
Avisynth has two symbols for joining AVI video that has audio as well as video. The single plus sign (+) is an unaligned splice, the double plkus sign (++) is an aligned splice. Audio is treated differently with each type of join. See the Avisynth doc with examples: http://avisynth.org/oldwiki/index.php?page=CropLast edited by sanlyn; 21st Mar 2014 at 07:41.
-
Well, the video that I work with is demuxed from audio. And I join the separate segments as such at the end of my script:
vid1 ++ vid2 ++ vid3 -
Eh? Don't you mean http://avisynth.org/mediawiki/Splice?
Do you mean your script is handling only video and you are trying to sync the audio afterwards?
That should work as long as the video stays the same length.
If any of your filters changes the video length (or you have cut bits out), it will go out of sync. -
Last edited by sanlyn; 21st Mar 2014 at 07:41.
-
If I recall earlier posts, the toon posted earlier had no audio but video was then IVTC'd, apparently without audio. I don't IVTC that way, but wouldn't that throw off audio sync if audio was joined later?
Last edited by sanlyn; 21st Mar 2014 at 07:41.
-
Wait, so you're not supposed to IVTC without audio? I never had a problem before when it came time to remux my audio and video in the authoring process. This is the first time this happened to me, (after using trim() in my script to apply different filters to different sections of the video). Gavino, no, none of my filters involved clipping the video. Just cleaning. I did not clip my video at all and it looks fine during playback. I'm thinking it was a bad author, so I will re-author it again and see.
In any event, for you to get Mpeg2Source(), you're supposed to create an index file of your VOB first. In the process of creating this index file, your audio and video are demuxed. Also, considering the fact that HcEnc doesn't do audio, my audio and video would not mux until the authoring process anyway. -
Since a normal IVTC preserves the video duration, this should not give a problem for the audio.
In any event, for you to get Mpeg2Source(), you're supposed to create an index file of your VOB first. In the process of creating this index file, your audio and video are demuxed. -
It sounds to me like you cut sections out. Go over your Trim lines very carefully. Even for sections where you don't do any filtering you have to include them or else they'll be cut out and the audio will go out of synch. You can confirm (or disprove) this by checking the length of the video, before any Trims and then again after using all your Trims. Just typing a frame number incorrectly can mess the whole thing up. And also make sure your video matches (pretty closely) the length of the audio.
And if you're careful the Trims when added all back together will give you the same length video as when you started, but like sanlyn I no longer (usually) filter sections with Trims. -
I've used Trim(), but not exactly in this way. For every d2v I have its matching uncompressed WAV. In both Avisynth and/or VirtualDub, I rejoin the audio and d2v video as soon possible into AVI and seldom keep them apart -- especially if I expect to cut or otherwise change the video structure. When I don't process them together it can always be fixed, but it's a hassle every time.
Last edited by sanlyn; 21st Mar 2014 at 07:42.
-
Yeah, but like unclescoob I don't change the length of the video and almost always keep the audio separate from the video. It's no problem if the video length remains the same throughout.
-
manono, I'm gonna check for a possible error in my script. I'll get back to you guys. Thanks.
Similar Threads
-
Importing AVI vids into iMovie after applying Vdub filters: is it possible?
By quantice in forum MacReplies: 17Last Post: 4th Sep 2011, 12:48 -
Applying multiple filters at once with FFMPEG
By asterixvader in forum Video ConversionReplies: 3Last Post: 1st Jun 2011, 14:53 -
Which filters I should use for this anime? (avisynth)
By Cloudstrifeff7 in forum Newbie / General discussionsReplies: 6Last Post: 13th Dec 2010, 07:47 -
Applying filters to regions of interest (ROIs)
By johnnys5 in forum Newbie / General discussionsReplies: 1Last Post: 6th Dec 2010, 16:29 -
Avisynth Filters (help pls)
By Enkidu in forum EditingReplies: 14Last Post: 30th Jul 2010, 21:41