PDA

View Full Version : interlace detection sometimes fails


rajalev
15th May 2006, 01:40
I'm using the script detailled in avisynth.org for interlaced and telecined status detection.
It work's almost everytime (XVID, DV, etc), but it fails for DIVX movies ("DIV3" and "DIV4" codecs), with the log messages:

I don't know what "a" means-I don't know what "b" means

The avs script i'm using is:

loadplugin("tivtc.dll")
avisource("moviename.avi",audio=false)
file="moviename.log"
global unused_ = blankclip(pixel_type="yv12", length=10).TFM()
global sep="-"

function IsMoving(){
global b = (diff < 1.0) ? false : true
}

c = SelectRangeEvery(every=1000, length=5)
global clip = c
c = WriteFile(c, file, "a", "sep", "b")
c = FrameEvaluate(c, "global a = IsCombedTIVTC(clip, cthresh=9)")
c = FrameEvaluate(c, "IsMoving")
c = FrameEvaluate(c,"global diff = 0.50*YDifferenceFromPrevious(clip) + 0.25*UDifferenceFromPrevious(clip) + 0.25*VDifferenceFromPrevious(clip)")
crop(c,0,0,8,8)


Is there any suggestion for warranty working in all codecs (or at least XVID and DIVX codecs) ?


Thank you

Wilbert
15th May 2006, 11:39
Strange that it sometimes works and sometimes doesn't. In any case, you need to initialize the variable a and b. Try

function IsMoving(){
global b = (diff < 1.0) ? false : true
}

loadplugin("tivtc.dll")
file="moviename.log"
global sep="-"
global a = 0
global b = 0

avisource("moviename.avi", audio=false)
global unused_ = blankclip(pixel_type="yv12", length=10).TFM()
c = SelectRangeEvery(every=1000, length=5)
global clip = c
c = WriteFile(c, file, "a", "sep", "b")
c = FrameEvaluate(c, "global a = IsCombedTIVTC(clip, cthresh=9)")
c = FrameEvaluate(c, "IsMoving")
c = FrameEvaluate(c,"global diff = 0.50*YDifferenceFromPrevious(clip) +
\\ 0.25*UDifferenceFromPrevious(clip) + 0.25*VDifferenceFromPrevious(clip)")
crop(c,0,0,8,8)


Perhaps DivX3/DivX4 expect the video to be mod 16. In that case replace the crop line by crop(c,0,0,16,16).

rajalev
15th May 2006, 12:04
Cropping for 16,16 gives the same results.
Initializing a and b to 0, the log gives only '0-0' for all frames.

Something else is failing, probably FrameEvaluate().


The stangest thing is that it fails only with DIV3 and DIV4.

Strange that it sometimes works and sometimes doesn't. In any case, you need to initialize the variable a and b. Try

function IsMoving(){
global b = (diff < 1.0) ? false : true
}

loadplugin("tivtc.dll")
file="moviename.log"
global sep="-"
global a = 0
global b = 0

avisource("moviename.avi", audio=false)
global unused_ = blankclip(pixel_type="yv12", length=10).TFM()
c = SelectRangeEvery(every=1000, length=5)
global clip = c
c = WriteFile(c, file, "a", "sep", "b")
c = FrameEvaluate(c, "global a = IsCombedTIVTC(clip, cthresh=9)")
c = FrameEvaluate(c, "IsMoving")
c = FrameEvaluate(c,"global diff = 0.50*YDifferenceFromPrevious(clip) +
\\ 0.25*UDifferenceFromPrevious(clip) + 0.25*VDifferenceFromPrevious(clip)")
crop(c,0,0,8,8)


Perhaps DivX3/DivX4 expect the video to be mod 16. In that case replace the crop line by crop(c,0,0,16,16).

berrinam
15th May 2006, 13:49
I would get a similar message on the first few frames if they were exactly identical (I knew they were identical because I was duplicating them through the use of loop()). I don't know if that helps.....?

rajalev
15th May 2006, 15:41
PROBLEM SOLVED !

This was getting me crazy!
I've never seen nothing like this.
Even the nice tool "Source Detection" gave the same results.

Well, I've changed the crop (0,0,16,16) to crop(0,0,600,400), in order to see more of the screen - even if the screen is not needed to the interlace detection calculations.

For divx sources (DIV3 and DIV4 only, and only these) I've received a message complaining about:
"Only planar images supported".


And the solution was as simple as:

avisource("Movie.avi",audio=false).converttoyv12


Now it works ! ! !

So, the full interlace and telecine detection script is now:

loadplugin("tivtc.dll")
avisource("Movie.avi",audio=false).converttoyv12
file="Movie.log"

global sep="-"
global unused_ = blankclip(pixel_type="yv12", length=10).TFM()

function IsMoving(){ global b = (diff < 1.0) ? false : true }

c = SelectRangeEvery(every=100,length=5)
global clip = c
c = FrameEvaluate(c, "global a = IsCombedTIVTC(cthresh=9)")
c = FrameEvaluate(c, "IsMoving")
c = FrameEvaluate(c,"global diff = 0.50*YDifferenceFromPrevious(clip) + 0.25*UDifferenceFromPrevious(clip) + 0.25*VDifferenceFromPrevious(clip)")

c = WriteFile(c, file, "a", "sep", "b")

crop(c, 0, 0, 16, 16)

Wilbert
15th May 2006, 15:45
For divx sources (DIV3 and DIV4 only, and only these) I've received a message complaining about:
"Only planar images supported".
Ok, i forgot about that. FrameEvaluate requires YV12. DivX3 (and apperently DivX4, but i didn't know about that) outputs RGB (althought the video is stored as YV12), hence your error message.

rajalev
16th May 2006, 00:32
Well, afterall it is not solved :angry:
I'm starting to get mad :angry: :angry:

Let see the results for the same AVI, VID3 codec, 29.97 fps, not interlaced not telecined:

1) The change for the convertyv12 worked well for 1 computer.

2) for a 2nd computer, the AVI file plays well, but when playing the script, avisynth complains about "could not locate a decompressor for fourcc DIV3". WHAT ? but if I Can play the directly the AVI why not the AVS script ?

3) For a 3rd computer, the avi plays well, but the AVS script refuses to play witha "class not registered" in Media player and BsPlayer refusing play.


Help ?



loadplugin("tivtc.dll")
avisource("Movie.avi",audio=false).converttoyv12
file="Movie.log"

global sep="-"
global unused_ = blankclip(pixel_type="yv12", length=10).TFM()

function IsMoving(){ global b = (diff < 1.0) ? false : true }

c = SelectRangeEvery(every=100,length=5)
global clip = c
c = FrameEvaluate(c, "global a = IsCombedTIVTC(cthresh=9)")
c = FrameEvaluate(c, "IsMoving")
c = FrameEvaluate(c,"global diff = 0.50*YDifferenceFromPrevious(clip) + 0.25*UDifferenceFromPrevious(clip) + 0.25*VDifferenceFromPrevious(clip)")

c = WriteFile(c, file, "a", "sep", "b")

crop(c, 0, 0, 16, 16)

danpos
16th May 2006, 00:53
2) for a 2nd computer, the AVI file plays well, but when playing the script, avisynth complains about "could not locate a decompressor for fourcc DIV3". WHAT ? but if I Can play the directly the AVI why not the AVS script ?

AviSynth is very precise with yours errors message: you haven't the codec DivX 3 low motion. Get it and your script will work. Other thing: you can to play a AVI and don't get it work with AviSynth, because of when you play it with a DirectShow player it will render the file with DirectShow filter, whereas in the script you need a VFW codec because of you're using AVISource called (or so you can to try the DirectShowSource called).

Regards,

foxyshadis
16th May 2006, 01:38
Just enable it on ffdshow's vfw menu. vfw (which avisource and virtualdub use) is separate from directshow (which everything else uses). And don't install divx 3, there's no reason to make the system unnecessarily unstable.

rajalev
17th May 2006, 12:57
Oddly, doing a script just with:
avisource(....)
played just fine even for DIV3 and DIV4.

Changing it to:
avisource(...).converttoyv12
did not work for DIV3 and DIV4 - no codec found: but, the codec worked for rgb output and not for yv12?
who did the convertion? avisynth, right? not the codec.

Anyway, it is solved:

What Have I done?

Unnistalled Avisynth, FFDSHOW and XVID codec.

Installed :
a) Avisynth 2.5.7
b) divx 3.11 alpha (the very old version made for DIV3 and DIV4 - the ones I had problems with).
c) ffdshow
d) XVID codecs
Reboot



now works for xvid, div3, div4, divx, whatever.
in rgb and yv12.

My question: Why?












Just enable it on ffdshow's vfw menu. vfw (which avisource and virtualdub use) is separate from directshow (which everything else uses). And don't install divx 3, there's no reason to make the system unnecessarily unstable.

foxyshadis
17th May 2006, 14:38
You didn't enable YV12 in ffdshow's vfw. Installing xvid adds a yv12 codec. It was the script output that virtualdub couldn't read, not the script input.

It really isn't a good idea to have 3.11 installed. For one, it might tempt you to use it :p but it tends to make vfw a bit unstable (especially if it's any hack other than the radium version), and you definitely do not want it doing any of the decoding. Use ffdshow for that, unless you want buggy output. Just enable divx 3 and divx 4 decoding in ffdshow's vfw config.

rajalev
18th May 2006, 15:41
You didn't enable YV12 in ffdshow's vfw. .

Yes. You are right.
I'm gonna test it.

Thank you for the help.