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 Search this Thread Display Modes
Old 25th January 2021, 12:02   #21  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
I turned poisondeathray's idea into a function, as while nobody likes a smart-arse
I guess for a black and white clip it can tell you how much red there is.
Once again if you don't provide a file name, the text file will be named after the script.

GreyScale()
CombTest=BlankClip(Last,Color=color_red)
TFM(Clip2=CombTest)
TDecimate()
FindRed()

Code:
# ===============================================================================

function FindRed(clip Vid, bool "Append", string "FileName", bool "All")  {

Append = default(Append, false)
FileName = default(FileName, "")
All = default(All, false)

N = ScriptFile()
LN = LCase(N)
NLen = StrLen(N)
ELen = FindStr(LN, ".avs") - 1
File_Name = LeftStr(N, NLen-(NLen-ELen))
FName = (FileName == "") ? File_Name : FileName
File = FName + "_Combing.txt"
global Count = 0

Vid = FrameEvaluate(Vid, """

  A = (AverageChromaV() > 128)
  Count = A ? Count + 1 : Count
  TheRed = A ? string(Count, "  -  Red %.0f") + string(AverageChromaV()-128, "  -  %.2f") : ""

""")

Vid = !All ? WriteFileIf(Vid, File, "A", "current_frame", "TheRed", Append=Append) : \
WriteFile(Vid, File, "current_frame", "TheRed", Append=Append)

return Vid  }

# ===============================================================================
Code:
18  -  Red 1  -  100.00
19  -  Red 2  -  112.00
20  -  Red 3  -  112.00
21  -  Red 4  -  112.00
22  -  Red 5  -  112.00
23  -  Red 6  -  112.00
24  -  Red 7  -  112.00
25  -  Red 8  -  112.00
26  -  Red 9  -  112.00
27  -  Red 10  -  112.00
28  -  Red 11  -  112.00
29  -  Red 12  -  112.00
30  -  Red 13  -  112.00
31  -  Red 14  -  112.00
32  -  Red 15  -  32.86
40  -  Red 16  -  29.08
51  -  Red 17  -  35.15
52  -  Red 18  -  112.00
53  -  Red 19  -  36.89
55  -  Red 20  -  38.69
56  -  Red 21  -  112.00
57  -  Red 22  -  37.12
59  -  Red 23  -  37.30
60  -  Red 24  -  112.00
61  -  Red 25  -  42.33
70  -  Red 26  -  28.36
72  -  Red 27  -  112.00
73  -  Red 28  -  30.60
75  -  Red 29  -  24.92
76  -  Red 30  -  112.00
77  -  Red 31  -  26.79
79  -  Red 32  -  28.62
80  -  Red 33  -  112.00
81  -  Red 34  -  34.56
92  -  Red 35  -  14.91
93  -  Red 36  -  16.27
162  -  Red 37  -  42.75
163  -  Red 38  -  112.00
164  -  Red 39  -  35.61

Last edited by hello_hello; 25th January 2021 at 13:36.
hello_hello is offline   Reply With Quote
Old 25th January 2021, 13:22   #22  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
Or maybe even better, this one adds the red to the video, gives you an idea how much red there is, and also checks for combing. It has an additional argument "Write". When Write=false you can view the red without writing the output file.

FindCombingRed()

Code:
# ===============================================================================

function FindCombingRed(clip Vid, bool "Append", string "FileName", bool "All", bool "Write")  {

Append = default(Append, false)
FileName = default(FileName, "")
All = default(All, false)
Write = default(Write, true)

N = ScriptFile()
LN = LCase(N)
NLen = StrLen(N)
ELen = FindStr(LN, ".avs") - 1
File_Name = LeftStr(N, NLen-(NLen-ELen))
FName = (FileName == "") ? File_Name : FileName
File = FName + "_Combing.txt"
global Count = 0
Vid = Vid.GreyScale()
global Vid1 = Vid.TFM(pp=1).TDecimate()
CombTest = BlankClip(Vid, Color=color_red)
Vid2 = Vid.TFM(Clip2=CombTest).TDecimate()

Out = FrameEvaluate(Vid2, """

  A = IsCombedTIVTC(Vid1)
  B = (AverageChromaV() > 128)
  Count = A ? Count + 1 : Count
  TheCombing = (A ? string(Count, "  -  Combing %.0f") : "") + \
  (B ? string(AverageChromaV()-128, "  -  %.2f") : "")

""")

Out = !Write ? Vid2 : \
!All ? WriteFileIf(Out, File, "A", "current_frame", "TheCombing", Append=Append) : \
WriteFile(Out, File, "current_frame", "TheCombing", Append=Append)

return Out  }

# ===============================================================================
Code:
17  -  Combing 1
18  -  Combing 2  -  100.00
19  -  Combing 3  -  112.00
20  -  Combing 4  -  112.00
21  -  Combing 5  -  112.00
22  -  Combing 6  -  112.00
23  -  Combing 7  -  112.00
24  -  Combing 8  -  112.00
25  -  Combing 9  -  112.00
26  -  Combing 10  -  112.00
27  -  Combing 11  -  112.00
28  -  Combing 12  -  112.00
29  -  Combing 13  -  112.00
30  -  Combing 14  -  112.00
31  -  Combing 15  -  112.00
32  -  Combing 16  -  32.86
40  -  Combing 17  -  29.08
51  -  Combing 18  -  35.15
52  -  Combing 19  -  112.00
53  -  Combing 20  -  36.89
55  -  Combing 21  -  38.69
56  -  Combing 22  -  112.00
57  -  Combing 23  -  37.12
59  -  Combing 24  -  37.30
60  -  Combing 25  -  112.00
70  -  Combing 26  -  28.36
72  -  Combing 27  -  112.00
73  -  Combing 28  -  30.60
75  -  Combing 29  -  24.92
76  -  Combing 30  -  112.00
77  -  Combing 31  -  26.79
79  -  Combing 32  -  28.62
80  -  Combing 33  -  112.00
92  -  Combing 34  -  14.91
161  -  Combing 35
162  -  Combing 36  -  42.75
163  -  Combing 37  -  112.00
164  -  Combing 38  -  35.61

Last edited by hello_hello; 25th January 2021 at 23:55.
hello_hello is offline   Reply With Quote
Old 25th January 2021, 14:33   #23  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,000
HH, with the script in #19, if you return A instead of B, I think you will find it to be a Bool [ie error message, not tried it].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 25th January 2021, 20:10   #24  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
Quote:
Originally Posted by StainlessS View Post
HH, with the script in #19, if you return A instead of B, I think you will find it to be a Bool [ie error message, not tried it].
I won't try it then.

Your script is pretty cool. I haven't tried to make a function out of it yet (I assume it'd just be a matter of wrapping it in a function and making the initial values for the counting global), but it comforts me to know the output file also contains those erroneous frames at the beginning. I'd really like to learn what's causing that.

Code:
    0] ................ [FFF : 0 0 0]
    0] ................ [FFF : 0 0 0]
    0] ................ [FFF : 0 0 0]
    1] ................ [FFF : 0 0 0]
    2] ................ [FFF : 0 0 0]
    3] ................ [FFF : 0 0 0]
    4] ................ [FFF : 0 0 0]
    5] ................ [FFF : 0 0 0]
    6] ................ [FFF : 0 0 0]
    7] ................ [FFF : 0 0 0]
    8] ................ [FFF : 0 0 0]
    9] ................ [FFF : 0 0 0]
   10] ................ [FFF : 0 0 0]
   11] ................ [FFF : 0 0 0]
   12] ................ [FFF : 0 0 0]
   13] ................ [FFF : 0 0 0]
   14] ................ [FFF : 0 0 0]
   15] ................ [FFF : 0 0 0]
   16] ................ [FFF : 0 0 0]
   17] ................ [FFF : 0 0 0]
   18] ................ [FFF : 0 0 0]
   19] ................ [FFF : 0 0 0]
   20] ................ [FFF : 0 0 0]
   21] Thresh Very High [TTT : 0 0 1]
   22] Thresh Norm      [TFF : 1 0 1]
   23] Thresh Norm      [TFF : 2 0 1]
   24] Thresh Norm      [TFF : 3 0 1]
   25] Thresh High      [TTF : 3 1 1]
hello_hello is offline   Reply With Quote
Old 25th January 2021, 20:26   #25  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,000
I dont know why you have 3 frame 0's, I get 2,
its down to eg VirtualDub2 accessing/displaying frame 0 on load, and then again on play.

EDIT: With Potplayer load of avs, I only show one frame 0, starts to play from 0 immediately.

[its not a script problem, only down to app that uses script]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 25th January 2021 at 20:29.
StainlessS is offline   Reply With Quote
Old 25th January 2021, 20:42   #26  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
Ahhh......
I've been using MeGUI to run the analysis pass. It must be something MeGUI is doing. Probably checking the script contains no errors before running it, but without closing it again first. I'd tried loading the script, adding it to the job queue and deleting the existing text file before running the analysis pass, but it must check again. I wonder if that should be a concern when using it to run an analysis pass for something like TFM?

Analysis pass with AvsPmod.

Code:
    0] ................ [FFF : 0 0 0]
    1] ................ [FFF : 0 0 0]
    2] ................ [FFF : 0 0 0]
    3] ................ [FFF : 0 0 0]
    4] ................ [FFF : 0 0 0]
    5] ................ [FFF : 0 0 0]
And the earlier script I posted where I set the initial counting to -2.
I reset it back to zero and ran the analysis pass with AvsPmod.

Code:
0  -  Thresh Low      1
33  -  Thresh Low      2
34  -  Thresh Low      3
35  -  Thresh Low      4
36  -  Thresh Low      5
37  -  Thresh Low      6
38  -  Thresh Low      7
39  -  Thresh Low      8
41  -  Thresh Low      9
42  -  Thresh Low     10
So it was MeGUI's fault.
I might go back and edit the posts where I'd set the initial counting to -2 and change it to zero again.

Last edited by hello_hello; 25th January 2021 at 20:59.
hello_hello is offline   Reply With Quote
Old 25th January 2021, 21:06   #27  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
And another Ahhhh....

I sometimes have problems with 2 pass encoding with TIVTC. Sometimes, but not always, it complains the video doesn't contain the same number of frames as the metrics files, and I discovered deleting the last frame in the metrics file fixes it. That bothers me though, because if it was caused by MeGUI, maybe I should've been deleting the first frame and I've thrown everything out by a frame. Sometimes TFM complains the CRC doesn't match and I have to physically change it. Neither of those things happen all the time though.

I've still got some metrics files handy I created with the help of MeGUI. I might run the first pass again with AvsPmod to see what the difference is.

Last edited by hello_hello; 25th January 2021 at 21:11.
hello_hello is offline   Reply With Quote
Old 25th January 2021, 21:24   #28  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,000
More,
Vd2 must load the file initially,
and then on play, rewinds to 0 [which its already on], and plays from there, thus two frame 0's.
Does that instead of reload and play, which would call RT_FileDelete() again [deleting first 0] on the play pass, which it dont.

MeGUI is a lot better than it used to be,
at one time it use to do about 5 loads on initial adding to list, then about 7 reloads on encode [or the other way about].
[when scanning for whatever it scans for, combing or whatever it does].

Above resulted in long time delays when script involved some serious pre-scanning. [before encode started]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 25th January 2021 at 21:30.
StainlessS is offline   Reply With Quote
Old 25th January 2021, 23:05   #29  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
VirtualDub2 & AvsPmod managed to confuse me for a while. I tried an analysis pass with this:

TFM(Output="VTS_01_1_TFM.txt")
TDecimate(Mode=4, Output="VTS_01_1_TDecimate.txt")

If I open the script with MeGUI, start it running and then abort it, partial metrics files are written. Same if I start playback in MPC-HC and then stop playback. So I was expecting the same behaviour. For VD2 nothing was written when the analysis pass finished. Eventually I realised I also had to close the script and then the metrics files appeared. Same with AvsPmod, which confused me even more because it created empty metrics files, but they weren't written until I closed the script in the program. Odd. It took me a while to realise what was happening after running several analysis passes with no metrics files to show for it.

When I used both programs and the FindCombing function, the output file was written without having to close the script.

On the happy side... TFM and TDecimate wrote identical metrics files with all three programs, so at least it appears MeGUI isn't causing any oddness there.

Last edited by hello_hello; 25th January 2021 at 23:14.
hello_hello is offline   Reply With Quote
Old 25th January 2021, 23:52   #30  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,000
Vdub2 and probably Vdub 1.10, used to return to frame 0 after video analysis pass, so
you might have had a frame 0 at end of file, [vdmod did not], I asked Shekh to not return to 0 in Vd2, so it dont now.
[also I sometimes like to see metrics at end of analysis, when return to 0 that messes that up, is why I use to use VDMod and AssumeFPS(250)
rather than Vd 1.10]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 28th January 2021, 01:34   #31  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 260
Using the FindCombingRed() in post #22 matches up very nicely with the red (indicating moire effect present). This is what I was looking to achieve.

I will try to build a macro, with a macro program I have, that takes the number of frames identified as red frames and reports the percentage of frames qualifying as red out of the total. This will help me decide whether or not the moire possibility is large enough to address. However, your code is a little beyond my abilities. Can you put something along the lines of WriteFileStart(xxxxx, "FrameCount") into the code, so that the total number of frames would be reported as either the first or last line?

In case you are a perfectionist, I did find four erroneous frame reports. I ran it through VDub2 (Run video analysis pass) and it missed identifying frames 71, 81 and 93 as red, but they are clearly showing as red in VDob2. Additionally, frames 17 and 161 are not red, but are showing on the list with blank values. I assume that a larger sampling, such as a 30-minute episode would have quite a few similar blank returns. These would all be false positives in a total count, but would probably be counted.

Last edited by Danette; 28th January 2021 at 03:35.
Danette is offline   Reply With Quote
Old 28th January 2021, 18:03   #32  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
Can you just use FindCombingRed(All=true)?
That'll write every frame number, combed or not, and the total frame count will be the last frame number plus one (because Avisynth starts counting from zero).

I can't see any red in frame 71 using both MeGUI and VD2, but the frames either side show red. I can see red for the other two frames you mentioned though.





There are a couple of frames in the output file in post #22 that are reported as combed but for which I don't see red and there's no red reported in the output file. Frame 17 is one. I'm not sure why that's happening. Maybe TFM decides there's no combing while it's field matching, but when IsCombedTIVTC looks after field matching it sees some. That's the only explanation I can think of. I guess you can ignore those frames.






Thinking about it, the function only writes combing and red to the output file for a frame where IsCombedTIVTC returns true. I assumed if it returned false there'd be no red, but maybe that's also the difference between looking for combing during field matching and looking for combing after field matching. I'd have thought the result would be the same either way, but apparently not.

If you want it so the frame is written either way, change the appropriate section of the function to this:

Code:
Out = FrameEvaluate(Vid2, """

  A = IsCombedTIVTC(Vid1)
  B = (AverageChromaV() > 128)
  Count = A ? Count + 1 : Count
  TheCombing = (A ? string(Count, "  -  Combing %.0f") : "  -  No Combing")  + \
  (B ? string(AverageChromaV()-128, "  -  %.2f") : "")

""")

Out = !Write ? Vid2 : \
!All ? WriteFileIf(Out, File, "A || B", "current_frame", "TheCombing", Append=Append) : \
WriteFile(Out, File, "current_frame", "TheCombing", Append=Append)
That'll write to the output file when either combing is detected or there's red. When IsCombedTIVTC returns true, but there's no red, there won't be a value for red. When there's red but IsCombedTIVTC returns false, it'll write "No Combing" but still write the value for red (not that it's detecting red as such, rather it's detecting "not 100% B/W").

Code:
17  -  Combing 1
18  -  Combing 2  -  100.00
19  -  Combing 3  -  112.00
20  -  Combing 4  -  112.00
21  -  Combing 5  -  112.00
22  -  Combing 6  -  112.00
23  -  Combing 7  -  112.00
24  -  Combing 8  -  112.00
25  -  Combing 9  -  112.00
26  -  Combing 10  -  112.00
27  -  Combing 11  -  112.00
28  -  Combing 12  -  112.00
29  -  Combing 13  -  112.00
30  -  Combing 14  -  112.00
31  -  Combing 15  -  112.00
32  -  Combing 16  -  32.86
40  -  Combing 17  -  29.08
51  -  Combing 18  -  35.15
52  -  Combing 19  -  112.00
53  -  Combing 20  -  36.89
55  -  Combing 21  -  38.69
56  -  Combing 22  -  112.00
57  -  Combing 23  -  37.12
59  -  Combing 24  -  37.30
60  -  Combing 25  -  112.00
61  -  No Combing  -  42.33
70  -  Combing 26  -  28.36
72  -  Combing 27  -  112.00
73  -  Combing 28  -  30.60
75  -  Combing 29  -  24.92
76  -  Combing 30  -  112.00
77  -  Combing 31  -  26.79
79  -  Combing 32  -  28.62
80  -  Combing 33  -  112.00
81  -  No Combing  -  34.56
92  -  Combing 34  -  14.91
93  -  No Combing  -  16.27
161  -  Combing 35
162  -  Combing 36  -  42.75
163  -  Combing 37  -  112.00
164  -  Combing 38  -  35.61

Last edited by hello_hello; 31st January 2021 at 01:03.
hello_hello is offline   Reply With Quote
Old 28th January 2021, 23:05   #33  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 260
Quote:
Originally Posted by hello_hello View Post
If you want it so the frame is written either way, change the appropriate section of the function to this
Yes, this code only misses once which, if a full episode is involved, may greatly reduce the false negatives. Thanks.

Quote:
Originally Posted by hello_hello View Post
Can you just use FindCombingRed(All=true)?
That'll write every frame number, combed or not, and the total frame count will be the last frame number minus one (because Avisynth starts counting from zero).
Unfortunately, that would not work for my purposes. Using the external macro program that I have, and using Ctrl+g in the txt file generated by your script, I can go to the last line and it will report the total lines. These lines are all red-combed (minus the first and last lines), so I can get a report on the number of total combed lines by using the Ctrl+g. Listing all lines, combed or not, makes it impossible to differentiate because the Ctrl+g would show all frames in the file and not just the red frames.

By adding the WriteFileStart(xxxxx, "FrameCount") type of thing as the last line, I can then, with the macro, grab that total frame count. Then, using both of those data points, I can automatically determine the percentage of red-combed frames in the file. This percentage will then tell me if it is worthwhile trying to address those likely moire-effect frames.
Danette is offline   Reply With Quote
Old 30th January 2021, 14:39   #34  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 260
Well, I’ve tried adding “FrameCount” to hello_hello’s script, above, but cannot get it to appear as the last line in the resulting text file (I have managed to make it appear after one of the blank return lines). If anyone can show how to accomplish this, I would appreciate it.
Danette is offline   Reply With Quote
Old 30th January 2021, 22:52   #35  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
I failed to think of a working condition that'd just write the last frame number to the output file, but I'll have another think about it and report back if I have any luck, otherwise maybe someone else will come up with something clever? Where's StainlessS?
hello_hello is offline   Reply With Quote
Old 30th January 2021, 22:57   #36  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 260
Thanks. That makes me feel better. I tried inserting it from every angle I could think of and, if an expert is struggling to find the combination, maybe I'm not so clueless after. Then again ...
Danette is offline   Reply With Quote
Old 31st January 2021, 00:15   #37  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
I think I cracked the code.
I'm far from an expert, by the way, especially when it comes to conditional filtering, but I don't mind playing around because I usually end up learning something.

The first part of the script is still the same. Once again, just change the appropriate section to this:

Code:
Out = FrameEvaluate(Vid2, """

  IsComb = IsCombedTIVTC(Vid1)
  IsRed = (AverageChromaV() > 128)
  IsEnd = (FrameCount() == (current_frame + 1))
  Count = IsComb ? Count + 1 : Count

  WriteThis = (IsComb || IsRed ? string(current_frame) + \
  (IsComb ? string(Count, "  -  Combing %.0f") : "  -  No Combing") + \
  (IsRed ? string(AverageChromaV()-128, "  -  %.2f") : "") : "") + \
  (IsEnd ? string(FrameCount(), "%.0f") : "")

""")

Out = !Write ? Vid2 : \
!All ? WriteFileIf(Out, File, "IsComb || IsRed || IsEnd", "WriteThis", Append=Append) : \
WriteFile(Out, File, "WriteThis", Append=Append)
Code:
73  -  Combing 28  -  30.60
75  -  Combing 29  -  24.92
76  -  Combing 30  -  112.00
77  -  Combing 31  -  26.79
79  -  Combing 32  -  28.62
80  -  Combing 33  -  112.00
81  -  No Combing  -  34.56
92  -  Combing 34  -  14.91
93  -  No Combing  -  16.27
161  -  Combing 35
162  -  Combing 36  -  42.75
163  -  Combing 37  -  112.00
164  -  Combing 38  -  35.61
208
If you want it labelled, change the "IsEnd" line to something like this

Code:
(IsEnd ? string(FrameCount(), "Frame Count  -  %.0f") : "")
or this
Code:
(IsEnd ? string(FrameCount(), "%.0f  -  Frame Count") : "")
Code:
93  -  No Combing  -  16.27
161  -  Combing 35
162  -  Combing 36  -  42.75
163  -  Combing 37  -  112.00
164  -  Combing 38  -  35.61
208  -  Frame Count
And because I can't wrap my brain around what will happen if the last frame has red or combing, if the frame count is written on the same line as the last frame (if it is it'll only be when it's combed), I think this version of that same line should ensure there's a line break before the frame count is written. Hopefully...

Code:
((IsComb || IsRed) && IsEnd ? chr(10) : "") + (IsEnd ? string(FrameCount(), "%.0f  -  Frame Count") : "")

Last edited by hello_hello; 31st January 2021 at 01:11.
hello_hello is offline   Reply With Quote
Old 31st January 2021, 01:15   #38  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 260
That did it! That's all I need. I'll work with the minor manipulations later, to give the line naming.

I guess it's ok to assume that the last line may be a duplicate if it is, in fact, ever combed. One approach I was considering was to add a known combed frame to the end of every script, e.g.; clip1++clip2 type of thing, where clip 2 is a known combed frame. Now, I have a much less cumbersome approach.

Thanks, again.
Danette is offline   Reply With Quote
Old 31st January 2021, 16:07   #39  |  Link
Danette
Registered User
 
Join Date: Apr 2013
Posts: 260
Quote:
Originally Posted by hello_hello View Post
And because I can't wrap my brain around what will happen if the last frame has red or combing, if the frame count is written on the same line as the last frame (if it is it'll only be when it's combed), I think this version of that same line should ensure there's a line break before the frame count is written. Hopefully...
Well, this turned out to be a problem. If the last frame is red/combed, the frame count does not appear.

If you're interested in bringing this effort closer to perfection, the link to a file having the last frame combed is here: https://www.mediafire.com/file/n2la3...ombed.avi/file
Danette is offline   Reply With Quote
Old 31st January 2021, 16:42   #40  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,459
It seems okay to me, but it does require ensuring the frame count is written after a line break if the final frame is combed. At least that one worked the way it did in my head.

Code:
Out = FrameEvaluate(Vid2, """

  IsComb = IsCombedTIVTC(Vid1)
  IsRed = (AverageChromaV() > 128)
  IsEnd = (FrameCount() == (current_frame + 1))
  Count = IsComb ? Count + 1 : Count

  WriteThis = (IsComb || IsRed ? string(current_frame) + \
  (IsComb ? string(Count, "  -  Combing %.0f") : "  -  No Combing")  + \
  (IsRed ? string(AverageChromaV()-128, "  -  %.2f") : "") : "") + \
  (IsEnd ? string(FrameCount(), "%.0f  -  Frame Count") : "")

""")

Out = !Write ? Vid2 : \
!All ? WriteFileIf(Out, File, "IsComb || IsRed || IsEnd", "WriteThis", Append=Append) : \
WriteFile(Out, File, "WriteThis", Append=Append)
Code:
73  -  Combing 27  -  112.00
74  -  Combing 28  -  30.47
76  -  Combing 29  -  112.00
77  -  Combing 30  -  26.82
79  -  Combing 31  -  28.58
80  -  Combing 32  -  112.0081  -  Frame Count
Code:
Out = FrameEvaluate(Vid2, """

  IsComb = IsCombedTIVTC(Vid1)
  IsRed = (AverageChromaV() > 128)
  IsEnd = (FrameCount() == (current_frame + 1))
  Count = IsComb ? Count + 1 : Count

  WriteThis = (IsComb || IsRed ? string(current_frame) + \
  (IsComb ? string(Count, "  -  Combing %.0f") : "  -  No Combing")  + \
  (IsRed ? string(AverageChromaV()-128, "  -  %.2f") : "") : "") + \
  ((IsComb || IsRed) && IsEnd ? chr(10) : "") + \
  (IsEnd ? string(FrameCount(), "%.0f  -  Frame Count") : "")

""")

Out = !Write ? Vid2 : \
!All ? WriteFileIf(Out, File, "IsComb || IsRed || IsEnd", "WriteThis", Append=Append) : \
WriteFile(Out, File, "WriteThis", Append=Append)
Code:
73  -  Combing 27  -  112.00
74  -  Combing 28  -  30.47
76  -  Combing 29  -  112.00
77  -  Combing 30  -  26.82
79  -  Combing 31  -  28.58
80  -  Combing 32  -  112.00
81  -  Frame Count
Don't forget the frame count will be the last frame number plus one, because Avisynth starts counting at zero.
I think I originally said it'd be the last frame number minus one, because I'm easily confused.

Last edited by hello_hello; 31st January 2021 at 19:03.
hello_hello is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 06:50.


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