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 12th March 2013, 12:03   #21  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,540
i and j are clips not frames. (EDIT: The frame being worked on is current_frame)
It should work similarly to the previous script, you are just swapping apples for oranges.

Both AverageLuma() and AudioMax() are just functions returning a float used in the conditional part of WriteFileIf().


EDIT: Instead of this:

Code:
#This is the line that actually writes the frame number of the FIRST frame that falls below the threshold
WriteFileIf(last, filename,  "(AverageLuma(i)<blankthreshold)&&AverageLuma(j)>blankthreshold", "current_frame+1", append = false)
Something like:

Code:
#This is the line that actually writes the frame number of the FIRST frame that falls below the threshold
WriteFileIf(last, filename,  "(AudioMax(i,0) < -100) && AudioMax(j,0) > -100", "current_frame+1", append = false)
__________________
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; 12th March 2013 at 12:13.
StainlessS is offline   Reply With Quote
Old 12th March 2013, 12:20   #22  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,423
However, I think johnmeyer's example is incorrect.
Code:
j=trim(i,1,0) #Previous frame
will make j correspond to the next frame, not the previous one. I believe it should be:
Code:
j = SelectEvery(i,-1)
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 12th March 2013, 12:29   #23  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,540
Have to admit to a little head scratching when I saw that and the current_frame+1 bit.
(guess I just thought 'must be right' and moved on).
Would I be right in thinking that the output should then be on current_frame rather than current_frame+1. ?

EDIT: on looking again, looks to me like the JM example outputs the frame number of the 1st frame after black frames, perhaps just labeled wrongly.

EDIT: Below looks correct to me (not checked)
Code:
j = SelectEvery(i,-1) # Previous frame
#This is the line that actually writes the frame number of the FIRST frame that falls below the threshold
WriteFileIf(last, filename,  "(AverageLuma(i)<blankthreshold)&&AverageLuma(j)>blankthreshold", "current_frame", append = false)
and so the audio thing,

Code:
j = SelectEvery(i,-1) # Previous frame
#This is the line that actually writes the frame number of the FIRST frame that falls below the threshold
WriteFileIf(last, filename,  "(AudioMax(i,0) < -100) && AudioMax(j,0) > -100", "current_frame", append = false)
ie if current frame (i) < -100 && previous frame(j) > -100, then output current_frame, the silent one.
__________________
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; 12th March 2013 at 13:20.
StainlessS is offline   Reply With Quote
Old 12th March 2013, 12:36   #24  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,423
Quote:
Originally Posted by StainlessS View Post
Have to admit to a little head scratching when I saw that and the current_frame+1 bit.
(guess I just thought 'must be right' and moved on).
Would I be right in thinking that the output should then be on current_frame rather than current_frame+1. ?
Yes, you're right.
(I was assuming he used current_frame+1 to get frames numbered from 1 instead of 0, but it may just be a mistake.)
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 12th March 2013, 18:04   #25  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,613
Quote:
Have to admit to a little head scratching when I saw that and the current_frame+1 bit.
(guess I just thought 'must be right' and moved on).
Like many of you, I have hundreds of these scripts and script fragments. I use this one all the time, and the comments I made were for my own benefit. I usually work on the script until it gets the job done for whatever is at hand, and then I move on. The comments are there to remind me what I was doing. In general, they are correct, but they reflect the workflow I created. In this case, the frame number file was imported back into Vegas where the first frame is frame number 1 and not frame number 0. That will explain why some of the numbers may be off by one.

As for the trim function, my comment was an error, and I modified my post to add to that comment to explain the error.
johnmeyer is offline   Reply With Quote
Reply

Tags
avisynth, black, detection, frames

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 23:20.


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