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)
+ Reply to Thread
Results 1 to 9 of 9
-
-
As a very basic ouput generation, sometimes I use something like:
and it works. Hope it helpsCode: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")
-
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.
-
Yes, jagabo, good point. The "script" must be run once loaded in VirtualDub, or must contain RT procedures (RT_ForceProcess or similar)
-
Change the WriteFile line to:
Code:frame1.WriteFile ( "C:\avisynth\frame1_stats.txt", """ "Y_avg=" """, "AverageLuma", flush=true)
-
-
Worked for me with AviSynth+, version 3.7.5. I used VirtualDub2 to run the script with File -> Run Video Analysis Pass.
Code:# after opening a 10 frame YUV video WriteFile("stats.txt", """ "frame number = " """, "current_frame", """ ", Y_avg = " """, "AverageLuma", append=false, flush=true)Note that frame 0 is reported twice because opening the script in VirtualDub process the first frame and shows it. Then File -> Run... processes the entire video, including the first frame again.Code:frame number = 0, Y_avg = 95.732292 frame number = 0, Y_avg = 95.732292 frame number = 1, Y_avg = 95.732292 frame number = 2, Y_avg = 95.732292 frame number = 3, Y_avg = 95.732292 frame number = 4, Y_avg = 95.732292 frame number = 5, Y_avg = 95.732292 frame number = 6, Y_avg = 95.732292 frame number = 7, Y_avg = 95.732292 frame number = 8, Y_avg = 95.732292 frame number = 9, Y_avg = 95.732292
Also note that the video I was testing with was a still test pattern. So all frames had the same average luma.Last edited by jagabo; 19th Aug 2026 at 20:21.
-
Similar Threads
-
How to make an image file of an Audio CD? Without a CD.
By shampistols69 in forum MediaReplies: 15Last Post: 15th Feb 2025, 14:47 -
Playing a video file in ts format while it is being written to?
By BosseB in forum ProgrammingReplies: 9Last Post: 11th Nov 2024, 05:48 -
How to make a fake AC3 file to merge with my THD?
By beerninja in forum AudioReplies: 2Last Post: 23rd Oct 2024, 01:10 -
How to make this H265 file smaller?
By Filippo in forum Newbie / General discussionsReplies: 4Last Post: 5th Jan 2024, 16:54 -
How to make punctuation correctly in SRT file
By Mohamed61020 in forum SubtitleReplies: 7Last Post: 6th Sep 2023, 10:09


Quote
