Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Display Modes
Old 14th August 2012, 20:03   #1  |  Link
Monkeylord
Registered User
 
Monkeylord's Avatar
 
Join Date: Nov 2009
Posts: 50
Apply a Filter at Regular Intervals

I have a clip where when I IVTC it the chroma gets messed up every 4th frame. For some reason it includes the chroma from the previous frame.

I added the following line to my script;

mergechroma(selectevery(1,1))

This fixes the frames where the errant chroma is introduced, but obviously screws up all the previously good ones.

What's my best method of applying the above line but tell it to only occur every 4th frame?

I messed around with the "selectevery" portion of the line, but the slightest change would introduce chroma from all manner of frames.


I really need to find an idiots guide to avisynth filter use/syntax, lol.
Monkeylord is offline   Reply With Quote
Old 14th August 2012, 20:18   #2  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 720
Code:
fixed = mergechroma(selectevery(1,1))
Interleave (last, fixed)
SelectEvery (8, 0, 2, 4+1, 6)
Move the "+1" on the frame you want to fix.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 14th August 2012, 20:33   #3  |  Link
Monkeylord
Registered User
 
Monkeylord's Avatar
 
Join Date: Nov 2009
Posts: 50
Quote:
Originally Posted by cretindesalpes View Post
Code:
fixed = mergechroma(selectevery(1,1))
Interleave (last, fixed)
SelectEvery (8, 0, 2, 4+1, 6)
Move the "+1" on the frame you want to fix.
Thanks,

Just so I can learn from this, what do the 8, 0, 2, 4+1 and 6 represent.

I take it the 4+1 is the frame multiple the filter is being applied to.


Sorry to be a pain, but I'd like to understand rather than just beg for help

Thanks
Monkeylord is offline   Reply With Quote
Old 14th August 2012, 20:51   #4  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 720
I interleaved the original clip and the fixed clip. Therefore the even frames are the original ones and the odd frames the fixed ones. Each group of 4 frames result in a group of 8 frames. Then we just have to pick 4 frames per group of 8, the original or the fixed frame in each pair. In my example:

Code:
Original:
… a   b   c   d   …

Fixed:
… A   B   C   D   …

-- Interleave ->

… a A b B c C d D …
  0 1 2 3 4 5 6 7
  ^   ^     ^ ^

-- SelectEvery ->

… a   b   C   d   …
I hope it is more clear with this diagram.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 14th August 2012, 20:53   #5  |  Link
Monkeylord
Registered User
 
Monkeylord's Avatar
 
Join Date: Nov 2009
Posts: 50
Genius!


Much clearer now, thanks again!
Monkeylord is offline   Reply With Quote
Old 14th August 2012, 22:51   #6  |  Link
Monkeylord
Registered User
 
Monkeylord's Avatar
 
Join Date: Nov 2009
Posts: 50
Hmmm... it doesn't seem to be working.

I mean, it is moving chromas around, but I can't get it to apply to the fields I want.

Should I add this before or after the IVTC? and also I forgot that I added a trim function to the end, which is why it looked to me that it started on frame 4 and repeated every 4 frames, but in actual fact (after IVTC) it starts on frame 2.


I'm getting so confused.


Here's the original script that when opened in Virtualdub shows the dodgy chroma every 4 frames.

If I get rid of the Trim function, and I skip past all the opening gumph to the actual movie, it still shows the chroma problem every 4 frames. Calculating backwards leads me to the problem first appearing on frame No 2.

Code:
#Audio
A=NicAC3Source("F:\Main Movie\VTS_01_1 T80 2_0ch 192Kbps DELAY 0ms.ac3")

#Video
V=DGDecode_mpeg2source("F:\Main Movie\VTS_01_1.d2v", info=3)

#Merge
Audiodub(V,A)

AssumeBFF()
TFM()
tdecimate(mode=1)

#Subs
VobSub("F:\Main Movie\VTS_01_0.idx")

#Trim
__film = last
__t0 = __film.trim(498, 115250)
__t0
Here's the one that fixes the dodgy chroma frames but screws up all the previously good frames.

Code:
#Audio
A=NicAC3Source("F:\Main Movie\VTS_01_1 T80 2_0ch 192Kbps DELAY 0ms.ac3")

#Video
V=DGDecode_mpeg2source("F:\Main Movie\VTS_01_1.d2v", info=3)

#Merge
Audiodub(V,A)

AssumeBFF()
TFM()
tdecimate(mode=1)
fixed = mergechroma(selectevery(1,1))

#Subs
VobSub("F:\Main Movie\VTS_01_0.idx")

#Trim
__film = last
__t0 = __film.trim(498, 115250)
__t0
Is it feasible (and ultimately easier) if I dump my original AVS in Virtualdub, including the dodgy frames, save to a lossless AVI (lagarith, I spose) and then use that as the source in a new AVS that includes the above suggested fix?

Obviously I'd rather not do any more passes than necessary, but it's driving me bonkers at this point.
Monkeylord is offline   Reply With Quote
Old 15th August 2012, 00:49   #7  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Temporarily Subtitle the fixed version and comment out the SelectEvery. Examine the double rate clip to determine the pattern you need to achieve your desired result. This is called stepwise debugging of your script.
Code:
#Audio
A=NicAC3Source("F:\Main Movie\VTS_01_1 T80 2_0ch 192Kbps DELAY 0ms.ac3")

#Video
V=DGDecode_mpeg2source("F:\Main Movie\VTS_01_1.d2v", info=3)

#Merge
Audiodub(V,A)

AssumeBFF()
TFM()
tdecimate(mode=1)
fixed = mergechroma(selectevery(1,1)).Subtitle("Fixed")
Interleave (last, fixed)
# SelectEvery (8, 0, 2, 4+1, 6)
When you have the right pattern reactive the SelectEvery with the right numbers. Test, rinse, repeat as required. Finally remove the Subtitle and add back the tail of your script. Test, rinse, repeat as required.
IanB is offline   Reply With Quote
Old 15th August 2012, 00:52   #8  |  Link
Monkeylord
Registered User
 
Monkeylord's Avatar
 
Join Date: Nov 2009
Posts: 50
Thanks for the advice. I'll give it a shot.



... it's gonna be a loooong night!
Monkeylord is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.