View Single Post
Old 4th October 2017, 04:16   #4  |  Link
edumj
Registered User
 
Join Date: Sep 2017
Posts: 33
This is my script, I 've translated the most part to english:

Code:
v=MPEG2Source("VTS_03_1_HonorFlags+Demux.d2v").trim(190,-10)

global Counter=0
global Counter2=0

global RepeatedField=false
global WriteTXT=false

Media="50%+25%+25%="
abre_parentesis=" ("
cierra_parentesis=")"
YY="Y="
UU="U="
VV="V="


function SeRepiteTop()
{
global RepeatedField = (diff_top < 1.0) ? true : false

	# If repeated TOP Field, increase counter
	global Counter=   RepeatedField==true ? Counter+1 : Counter

	# If TOP Field moving, WriteTXT=true
	global WriteTXT=   RepeatedField==false ? true : false
	
}

function SeRepiteBottom()
{
global RepeatedField = (diff_bottom < 1.0) ? true : false

	# If repeated BOTTOM Field, increase counter
	global Counter = RepeatedField==true ? Counter+1 : Counter
	
	# If TOP Field moving, WriteTXT=true, else keep looking for more duplicated TOP (and BOTTOM) fields, until the image moves
	global WriteTXT=   RepeatedField==false ? true : WriteTXT
	
	# If WriteTXT=true add 2 to counter, and save to a different variable to Initialize Counter
	global Counter2= WriteTXT==true ? Counter+2 : Counter2
	# Initialize Counter to zero
	global Counter= WriteTXT==true ? 0 : Counter

	
}

function CombingInfo(clip c, clip d)
{
#filec = "campos_repes_top_y_bottom.log"
filed = "campos_repes_top_y_bottom.log"
global top = c
global bottom = d

c= ScriptClip(c,"Poner_Nombre(Media+string(diff_top)+abre_parentesis+string(WriteTXT)+cierra_parentesis +string(Counter2) ,5)")
c= ScriptClip(c,"Poner_Nombre(YY+string(Ydiff_top) ,1)")
c= ScriptClip(c,"Poner_Nombre(UU+string(Udiff_top) ,2)")
c= ScriptClip(c,"Poner_Nombre(VV+string(Vdiff_top) ,3)")
d= ScriptClip(d,"Poner_Nombre(Media+string(diff_bottom)+abre_parentesis+string(WriteTXT)+cierra_parentesis +string(Counter2) ,5)")

#c = WriteFileIf(c, filec, "WriteTXT", """ "frame " """, "current_frame", """ "=" """, "Counter2", """ " fields " """)
c = FrameEvaluate(c, "SeRepiteTop")
c = FrameEvaluate(c,"global diff_top = 0.50*YDifferenceToNext(top) + 0.25*UDifferenceToNext(top) + 0.25*VDifferenceToNext(top)")
c = FrameEvaluate(c,"global Ydiff_top = YDifferenceToNext(top)")
c = FrameEvaluate(c,"global Udiff_top = UDifferenceToNext(top)")
c = FrameEvaluate(c,"global Vdiff_top = VDifferenceToNext(top)")


d = WriteFileIf(d, filed, "WriteTXT", """ "frame " """, "current_frame", """ "=" """, "Counter2", """ " fields" """)
d = FrameEvaluate(d, "SeRepiteBottom")
d = FrameEvaluate(d,"global diff_bottom = 0.50*YDifferenceToNext(bottom) + 0.25*UDifferenceToNext(bottom) + 0.25*VDifferenceToNext(bottom)")

# Initialize??
#global WriteTXT=false
	
return stackvertical (c,d)
}



	# Función para poner texto, y posición?? o número de línea (multiplicar por 15 o algo, para simular ir bajando líneas)
function Poner_Nombre(clip "c", "nombre", int "linea") {
	linea = Default (linea, 1)*18
	c = Default (c, last)
	c=c.Subtitle(nombre, x=8, y=linea, font="Arial", size=18.0, text_color=$11FFFF00, halo_color=$000000, align=4, spc=0, font_width=0, font_angle=0.0, interlaced=false)
	return c
}


CombingInfo(v.SeparateFields().SelectOdd(), v.SeparateFields().SelectEven())
The resulting .txt is:

Code:
frame 0=2 fields
frame 1=3 fields
frame 2=2 fields
frame 3=3 fields
frame 4=2 fields
frame 5=2 fields
frame 6=3 fields
frame 7=2 fields
frame 8=3 fields
What it is 2:3:2:3 2 2:3:2:3 (22 fields)

But It Should be:

Code:
frame 0=2 fields
frame 1=3 fields
frame 2=2 fields
frame 3=3 fields
frame 5=2 fields
frame 6=3 fields
frame 7=2 fields
frame 8=3 fields
So, it's 2:3:2:3 2:3:2:3 (20 fields)
edumj is offline   Reply With Quote