VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    I want to have the results from this measurement be written into a file but it does not work. The file is created but is empty:

    Code:
    frame1 = src.Crop(1100, 590, 100, 250)
    frame1.WriteFile ( "C:\avisynth\frame1_stats.txt", "Y_avg=", "AverageLuma", flush=true)
    Quote Quote  
  2. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    As a very basic ouput generation, sometimes I use something like:

    Code:
    video_org=AviSource("C:\Users\giuse\Videos\Acquisizioni\ufo_s1a_amtv.avi")
    
    # trimming
    	trim_start=345
    	trim_end=68946
    video_org_trim=video_org.trim(trim_start,trim_end)
    
    # cropping 
    	crop_left=8	# | rimozione esatta delle bande nere sinistra, sopra, destra e del disturbo sotto	
    	crop_top=8	# | 720-(8+24)x576-(8+8)=688x560
    	crop_right=24
    	crop_bottom=8
    video_org_trim_crop=video_org_trim.crop(crop_left,crop_top,-crop_right,-crop_bottom)
    
    # convert to YV12 (required for Y statistics)
    video_org_trim_crop_yv12=video_org_trim_crop.ConvertToYV12(interlaced=false)
    
    # analysis
    video_coloryuv=video_org_trim_crop_yv12.\
    WriteFile("ufo_s1a_amtv_step1a.txt", "current_frame", """ "  " """,\
    "AverageLuma()", """ "  " """, "YPlaneMin()", """ "  " """, "YPlaneMax()", """ "  " """,\
    "YPlaneMin(threshold=0.4)", """ "  " """, "YPlaneMax(threshold=0.4)", append=false).\
    ColorYUV(analyze=true)
    
    eval("video_coloryuv")
    and it works. Hope it helps
    Quote Quote  
  3. Did you preview the script (ie, run it through it's entirety)? WriteFile is a runtime filter it doesn't act on a frame until that frame has been loaded. Try loading the script into VirtualDub then selecting File -> Run Video Analysis Pass. When it's done, check your text file.
    Quote Quote  
  4. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Yes, jagabo, good point. The "script" must be run once loaded in VirtualDub, or must contain RT procedures (RT_ForceProcess or similar)
    Quote Quote  
  5. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    Originally Posted by jagabo View Post
    Did you preview the script (ie, run it through it's entirety)? WriteFile is a runtime filter it doesn't act on a frame until that frame has been loaded. Try loading the script into VirtualDub then selecting File -> Run Video Analysis Pass. When it's done, check your text file.
    I added the script to AvsPmod and pressed play.
    Quote Quote  
  6. Change the WriteFile line to:

    Code:
    frame1.WriteFile ( "C:\avisynth\frame1_stats.txt", """ "Y_avg=" """, "AverageLuma", flush=true)
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!