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 17th April 2021, 13:23   #1  |  Link
color
Registered User
 
color's Avatar
 
Join Date: May 2016
Posts: 235
Fading in and out with image?

I dont know if dissolve or fadein/fadeout is what I should use and what is best. I wan't the fade to begin at 405 with 29 frames fading in (only the image not the avi-file) and fading out with 29 frames and end at frame 558. This is the script I have so far:


Code:
A=DirectShowSource("D:\0000.avi")
B=ImageSource("D:\present.png", start=0, end=A.framecount-1, fps=A.framerate, pixel_type="RGB32")
C=Overlay(A,B, mask=B.showalpha())

A.Trim(0,404) ++ C.Trim(405,558) ++ A.Trim(558,0)
__________________
Automatic Colorization

Last edited by color; 17th April 2021 at 13:35.
color is offline   Reply With Quote
Old 17th April 2021, 14:21   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Maybe you want to restate your requirement a little more clearly.
Fade, transitions from black to normal image, or the other way around. [in or out]
Dissolve overlaps [in your case 29 frames], so that your result length clip is 29 frame shorter due to the overlap. It starts out using
all of one image/clip, and at end of dissolve uses all of the other image/clip, so result contains a bit of both, hence the overlap requirement.
__________________
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 17th April 2021, 15:30   #3  |  Link
patul
Registered User
 
Join Date: Sep 2005
Posts: 130
As StainlessS mentioned, the requirement is not quite clear, and we can only guess from the script that you have.

However I gave it a try, excuse my newbieness though.

Code:
A	= FFmpegSource2("D:\App\youtube-dl\S2_E09_clip.mkv").KillAudio().TFM().TDecimate().ConvertToRGB32(matrix = "Rec601")
B	= ImageSource("D:\App\youtube-dl\flintstones.png", start=0, end=100, fps=A.framerate, pixel_type="RGB32")
fdin	= B.FadeIn(100)
fdout	= B.FadeOut(100)
Afin	= A.Trim(200,300)
Afout	= A.Trim(300,400)
C	= Overlay(Afin, fdin, mask=fdin.ShowAlpha())
D	= Overlay(Afout, fdout, mask=fdout.ShowAlpha())

# if you want the image is faded in and then faded out WITHOUT overlay to the video
#A.Trim(0,200) ++ fdin ++ fdout ++ A.Trim(200,687)

# if you want the image is faded in and then faded out WITH overlay to the video
A.Trim(0,200) ++ C ++ B ++ D ++ A.Trim(400,687)
I use 100 frames instead of 29 to display the effect for a longer time.

Last edited by patul; 17th April 2021 at 15:35.
patul is offline   Reply With Quote
Old 17th April 2021, 16:26   #4  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
It takes less than one second to do this in any NLE. This is the wrong tool for the job.
johnmeyer is offline   Reply With Quote
Old 17th April 2021, 18:50   #5  |  Link
Richard1485
Guest
 
Posts: n/a
Quote:
Originally Posted by color View Post
I wan't the fade to begin at 405 with 29 frames fading in (only the image not the avi-file) and fading out with 29 frames and end at frame 558.
Assuming that I've understood correctly, try the following:
Code:
A=AviSource("D:\0000.avi")
B=ImageSource("D:\present.png", start=0, end=152, fps=A.framerate, pixel_type="RGB32")

Dissolve(
\Dissolve(
\Trim(A, 0,	433),
\B,
\29),
\Trim(A, 529,	0),
\29)
Explanation
To begin a fade at 405, count forward the required number of frames, and adjust the call to Trim() accordingly, so that Dissolve() gives you the result that you want. The same principle applies to the fade out (although you count backwards instead).

I've replaced DirectShowSource() with AviSource(). Use KillAudio() if necessary.

Last edited by Richard1485; 17th April 2021 at 18:54.
  Reply With Quote
Old 19th April 2021, 17:26   #6  |  Link
color
Registered User
 
color's Avatar
 
Join Date: May 2016
Posts: 235
Oh sorry. I see it's quite vage. What i ment was that the image has an transparent (png) and i want it to fade in from "invisible". I did however solved it. I did a "trim" similar to patul.

Thank you. ��
__________________
Automatic Colorization
color is offline   Reply With Quote
Old 19th April 2021, 17:34   #7  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
Quote:
Originally Posted by johnmeyer View Post
It takes less than one second to do this in any NLE. This is the wrong tool for the job.
I think it's reasonable to assume that if someone asks a question in the Avisynth Usage forum, then they want to use Avisynth to do it.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 19th April 2021, 18:41   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
then they want to use Avisynth to do it.
Yip, I aint used an NLE since about W2K. [although I think I got one somewhere from W2K era].
__________________
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 19th April 2021, 21:55   #9  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
Originally Posted by wonkey_monkey View Post
I think it's reasonable to assume that if someone asks a question in the Avisynth Usage forum, then they want to use Avisynth to do it.
Yes, I fully understand that, but people often "assume a solution" before they have thought through all the alternatives. This is especially true of AVISynth which, for some people, has a certain mystique of being the "best" way to do something, or somehow achieving better results than other alternatives.

If all the OP wants to do are fades and crossfades, it can be done using any one of 99 different programs, including using AVISynth, but compared to the flexibility offered by an NLE, the results are going to take a long time to achieve, and the results will be less pleasing because of the lack of interactivity and GUI.

As just one example, I have twelve defaults in my NLE of how quickly a fade or crossfade happens. I can change the crossfade behavior in one second with a single click of the mouse, and I can change the duration of the fade just by sliding video clips back and forth on the timeline. I can also change the fade to a dissolve (not the same thing) or can apply some other effect (e.g., wipe) if I want.
johnmeyer is offline   Reply With Quote
Old 19th April 2021, 23:35   #10  |  Link
Richard1485
Guest
 
Posts: n/a
For my purposes, AviSynth accomplishes this sort of work perfectly well. In a matter of seconds, I can type exactly what I want to achieve without leaving the script that contains the rest of my processing/editing. This avoids involving another program, generating intermediate files, making additional renders, etc. For me, it's easier than using an NLE, but different strokes...
  Reply With Quote
Old 20th April 2021, 00:15   #11  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
Quote:
Originally Posted by johnmeyer View Post
Yes, I fully understand that, but people often "assume a solution" before they have thought through all the alternatives.
It's also an assumption to declare that someone is doing the wrong thing based on only their immediate question. We have no idea what the rest of color's requirements or plans are. If he was a first-time poster without a script in progress and asking how to use AviSynth to do a fade, then a suggestion that he might have better luck with an NLE would certainly be warranted. But to declare it as fact is presumptuous in any case.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 20th April 2021, 00:39   #12  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by johnmeyer View Post
Yes, I fully understand that, but people often "assume a solution" before they have thought through all the alternatives. This is especially true of AVISynth which, for some people, has a certain mystique of being the "best" way to do something, or somehow achieving better results than other alternatives.
In cases with overlay and fade operations, avisynth often produces better results quality wise, because those operations are performed in YUV, and most video is in YUV

Many/most NLE's operate in RGB, especially the transition and overlay operations - it's easy to demonstrate that this produces lower quality, more banding in the base video layer


Quote:

If all the OP wants to do are fades and crossfades, it can be done using any one of 99 different programs, including using AVISynth, but compared to the flexibility offered by an NLE, the results are going to take a long time to achieve, and the results will be less pleasing because of the lack of interactivity and GUI.
I agree, but OP has 1 fade in/out. It's trivial to do in avisynth

Quote:
As just one example, I have twelve defaults in my NLE of how quickly a fade or crossfade happens. I can change the crossfade behavior in one second with a single click of the mouse, and I can change the duration of the fade just by sliding video clips back and forth on the timeline. I can also change the fade to a dissolve (not the same thing) or can apply some other effect (e.g., wipe) if I want.
I agree, you can't compete with NLE simplicity of those types of operations, and if you had dozens of transitions, multiple layers, it would take many times longer in avisynth to do. Very tedious...

But OP asked for 1 fade in/out with a transparent overlay
poisondeathray is offline   Reply With Quote
Old 20th April 2021, 08:10   #13  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
I give up. Why even bother trying to help strangers? This has become pointless.
johnmeyer is offline   Reply With Quote
Old 20th April 2021, 15:16   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
For me, I mainly can't be bothered to try an NLE, its just something new to learn and easier to use what I know, old dog, old tricks.
Dont give up John, its just this damn Covid silly season getting you down.
__________________
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
Reply

Tags
avisynth, fading.

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 14:44.


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