I am splitting some video files and their respective AC3 files using Avisynth.
And I am trying to make FadeIn and FadeOut to work in the script.
But I don't think is working, because I don't see anything changing in AvsP when I test the script.
The syntax I am using is
FadeOut0(60)
To get a 2 seconds fade to black.
I also tried in the audio track, with soundout, and I am not getting any fade.
What I am doing wrong?
+ Reply to Thread
Results 1 to 30 of 33
-
-
Post your full script.
You're probably applying the fade to the wrong clip, perhaps a problem with the setting of the implicit 'last' variable. -
Here it is:
AVCSource("d:\temp\file.dga")
FadeOut0(60)
spline36resize(720,480)
trim(0, 113861) -
I suspect the trim is cutting off your fade.
Try
NB: best to use "Code" tags for scripts.Code:AVCSource("d:\temp\file.dga") trim(0, 113861) FadeOut0(60) spline36resize(720,480) -
Forgive my ignorance. How do you handle "Code" tags?
You are right. Moving the trim line made it work.
Thanks! -
When you reply to a message, above the text box where you type is a line of buttons:Originally Posted by carlmart
B i u, etc,
These apply various styles to the text by inserting BBcode tags in square brackets.
Or you can type them in by hand, copy and paste them, when you learn what they mean.
As for the AVS script, commands are executed sequentially, line by line.
Sometimes the result is the same no matter what order, but some, especially Trim, it is important.
Another example would be "cleaning" filters, like RemoveDirt. You should do that before any resize or sharpen.
If you have a problem, often useful to comment out lines (in AvsP, Control-Q is the shortcut) and then uncomment one by one to see what is happening, effectively stepping through the script. -
Is it possible to add black frames to the image and silent frames to the sound when you do a split? How can I do that with with avisynth?
I would also be good to add something like "End of Part 1" at the end, or "Part 2", etc at the beginning of each split. Can you do that too?
Sometimes the problem is how these things are called to find the filter, like I did with fadeout. In cases above I don't know how they might be called. -
sure you canOriginally Posted by carlmart
you can just add this a++b , where "a" is your first sectionCode:blankclip(length=60, width=720, height=480, fps=29.97, stereo=true, audio_rate=48000) subtitle("End of Part 1", x=100, y=100, size=20) b=last
but note I added audio, so in order for you to append your "a" section has to have matching characteristics, fps, audio (i.e. stereo, audio sampling rate 48000 Khz, channels, etc...), otherwise use killaudio() if you have no audio (in your script above with avcsource, you have no audio, you didn't use audiodub)
also you can move the subtitle position, size, color etc...
I'm sure you get the idea... -
Great!
I am using two different scripts: one for video, another one for audio.
The one for audio is:
I believe I should only add to that, right?Code:v=AVCSource("d:\temp\file.dga") a=Nicac3Source("d:\tmp\file.ac3") audiodub(v,a) trim(0, 106194) FadeOut0(60) soundout
blankclip(length=60)
b=last -
is your audio 6ch or 2ch?
And why are you using 2 scripts? If you are re-encoding the audio, you may as well include it in the 1 script, otherwise it won't match up when you add the blankclip , or you have to add blank audio separately to your audio only script -
It's 6ch. If it was 2ch I would simply process the audio in Soundforge.
Well, that was the way I learnt it. I am not too sure on how I should joint them.And why are you using 2 scripts?
I thought my suggestion above did that.If you are re-encoding the audio, you may as well include it in the 1 script, otherwise it won't match up when you add the blankclip, or you have to add blank audio separately to your audio only script -
ok your "blank" audio has to be made into 6ch , 48Khz to append as well. The mergechannels in the script below does this from the mono audio that blankclip producesOriginally Posted by carlmart
You remove the soundout() , or comment it out if you are encoding the video, and leave it in if encoding audioCode:v=AVCSource("d:\temp\file.dga") a=Nicac3Source("d:\tmp\file.ac3") audiodub(v,a) trim(0, 106194) FadeOut0(60) a1=last b1=blankclip(length=60, width=720, height=480, fps=23.976, audio_rate=48000) MergeChannels(b1,b1,b1,b1,b1,b1) subtitle("End of Part 1", x=100, y=100, size=20) b2=last a1++b2 soundout()
Note I didn't center the subtitle, so you should adjust x, y position, etc... -
[quote="poisondeathray"]
That's interesting. I didn't guess it, but it seems logical that would happen.Originally Posted by carlmart
Please allow me to learn a little of this syntax. Some things certainly seem natural to you, but they do not to me.
1) Why a1 and b1? Why you put "b1=" for the second block only?
2) What does it mean when you write "=last"?
3) How would this be on the part 2 of the split, I mean besides changing to FadeIn0(60)?
4) Why do you add "a1++b2"?
5) I am not too clear on what I should with soundout(), as I thought this was a script to handle video and audio at the same time.
6) It's fine about the subtitle.
Thanks. This should be taking me a step up on learning avisynth. -
No, I just know the basics, the experts are guys like gavino and dideeOriginally Posted by carlmart
They are just variables that represent something. I could have just have easily used "dog" or "cat" or "z"1) Why a1 and b1? Why you put "b1=" for the second block only?
I assign the variable to everything before (i.e. everything before that a=last line means all that stuff now is equal to "a". So when I call the letter "a", it means all that stuff)2) What does it mean when you write "=last"?
I'm not sure what this mean? can you clarify?3) How would this be on the part 2 of the split, I mean besides changing to FadeIn0(60)?
a1 is defined as everything before the a1=last4) Why do you add "a1++b2"?
b2 is defined as everything before the b1=last
I purposely broke it out this way so you can see what is happening here
the "++" is aligned splice, it just means join section a1 and b2 , where a1 was your video and audio stuff before, and now b2 is the blank clip section with the subtitle. So all it's doing is appending the 2 sections
I'm not sure what your question is? This is a script that handles both. Just comment it out (use #) when you are doing the video, or delete the line. When you are encoding audio, leave it in5) I am not too clear on what I should with soundout(), as I thought this was a script to handle video and audio at the same time.
I don't think so. You preview it and make adjustments in avsp. It's a good way to learn the syntax. I purposely made it not centered so you would have to "fix it"6) It's fine about the subtitle.
-
A simpler way to get blank audio (and video) matching another clip is just to use that clip as the 1st parameter to BlankClip. Thus the last 2 lines quoted above can be replaced byOriginally Posted by poisondeathray
BlankClip(a1, length=60)
and all properties except length will be taken from a1. -
Nice! Thanks. I learn something new everyday!Originally Posted by Gavino
-
What I mean is that that is the script for say part 1, with the FadeOut. For part 2's beginning, do I just just put FadeIn for the new script instead of FadeOut?Originally Posted by poisondeathray
OK. I wasn't sure what commenting out soundout would get me. You said it.5) I am not too clear on what I should with soundout(), as I thought this was a script to handle video and audio at the same time.
I'm not sure what your question is? This is a script that handles both. Just comment it out (use #) when you are doing the video, or delete the line. When you are encoding audio, leave it in
-
Actually, you don't have to comment out Soundout().Originally Posted by carlmart
If you're doing a video encode, the SoundOut window will pop up while you're doing it, but not do anything. If it bothers you, comment it out, but it won't make any difference to the encode. Even if you do a command line batch encode, that will proceed normally.
I mostly use SoundOut to collect info though, once I have that (number of channels, volume averages), I make appropriate adjustments (eg, downmix, Amplify) and delete Soundout from the script and use wavi and aften to encode AC3 via a batch file.
And I see here : http://avisynth.org/mediawiki/SoundOut#Commandline_Output
that you can script SoundOut to turn off the GUI, and produce an audio file automatically. -
OK, this time I am trying the whole thing, adding the blank clip at the end. The script I wrote was this for the test:
The audio file opens fine, but on video I get only the blank clip.Code:v=FFMpegSource2("d:\tmp\file.mkv") a=Nicac3Source("d:\tmp\file.ac3") audiodub(v,a) trim(4686, 5686) FadeOut0(30) a1=last BlankClip(a1, length=60) soundout()
What am I doing wrong? -
Because you are only returning blank clip in your script. Go back up and read the earlier posts, all the information is there
When you say a1=last it doesn't return anything, you have to say a1 to return it
e.g. b1=blankclip
a1++b1 etc... -
Ok, I think I got it. Now I wrote:
It worked perfectly for the end of part 1.Code:v=FFMpegSource2("d:\tmp\file.mkv") a=Nicac3Source("d:\tmp\file.ac3") audiodub(v,a) trim(4686, 5686) FadeOut0(30) a1=last BlankClip(a1, length=60) subtitle("End of Part 1", x=240, y=200, size=40) b2=last a1++b2 soundout()
Now I am having problems for the script adding the blankclip at the beginning of part 2.
I have tried several combinations, but I don't get it to work. -
Just reverse the order
or something like thatCode:BlankClip(a1, length=60) subtitle("Beginning of Part 2", x=240, y=200, size=40) c1=last v2=FFMpegSource("video2.mkv") a2=nicac3source("audio2.ac3") audiodub(v2,a2) FadeIn(30) d1=last c1++d1 -
The problem lies on how I understand "something like that"...
Of course I had tried reversing the order, but the syntax is still wrong. Two lines I was not adding on the script I wrote were for the resizing, and it's giving me errors now.
What I am writing is this:
If I don'put the resizing lines on the blankclip I get: "frame sizes don't match" for c1++d1.Code:BlankClip(length=60) subtitle("Beginning of Part 2", x=240, y=200, size=40) LanczosResize(544,480) AddBorders(88,0,88,0) Fadein0(30) c1=last v2=FFMpegSource("file.mkv") a2=nicac3source("file.ac3") audiodub(v2,a2) trim(4686, 5686) LanczosResize(544,480) AddBorders(88,0,88,0) FadeIn(30) d1=last c1++d1
If I put the lines there I get: "video formats don't match" for c1++d1.
What am I missing? -
You're missing the argument for blankclip(a1, length=60) , blankclip alone will return 640x480 sized clip. In this case you can use "d1" if it's not in the same script as the 1st half
Remember what gavino said, if you insert the clip (a1 or whatever), it takes the specifications of that clip.
Or you can do it the long way I showed earlierA simpler way to get blank audio (and video) matching another clip is just to use that clip as the 1st parameter to BlankClip.
Maybe you should re-read the thread to refresh yourself
-
If I put "BlankClip(a1, length=60)" I get "I don't know what 'a1' means".
So I tried your long way:
"blankclip(length=60, width=720, height=480, fps=23.976, audio_rate=48000)"
Still getting error. -
d1 , read above. ^
or resize it to match (you resized it 544,480 instead of 720x480...)
My advice is to try to learn what the script is doing, instead of blindly copy + pasting -
You probably have a frame rate or audio mismatch.
Try this:
Blankclip can clone the format of a clip -- here "last".Code:v2=FFMpegSource("file.mkv") a2=nicac3source("file.ac3") audiodub(v2,a2) Trim(4686, 5686) LanczosResize(544,480) AddBorders(88,0,88,0) FadeIn(30) d1=last BlankClip(last,60) subtitle("Beginning of Part 2", x=240, y=200, size=40) Fadein0(30) last ++d1
So you don't have to resize or specify anything else except its length.
And you don't need to name variables if you can use "last".
With a little more rearrangement you don't need d1 either:
And have a look at the parameters for "Subtitle" http://avisynth.org/mediawiki/SubtitleCode:v2=FFMpegSource("file.mkv") a2=nicac3source("file.ac3") audiodub(v2,a2) Trim(4686, 5686) LanczosResize(544,480) AddBorders(88,0,88,0) FadeIn(30) BlankClip(last, 60) ++ last Subtitle("Beginning of Part 2",x=240,y=200,size=40,first_frame=0,last_frame=60) Fadein0(30)
You might want to simply centre-align rather than count pixels. -
Believe it or not I am trying to learn how to write a script. When I come here is because I tried to make it work first, be sure of that.Originally Posted by poisondeathray
When I added your long line to see if it could work, I did put 720x480 there to see if I could resize that blankclip too. I didn't do it blindly. Maybe my reasoning was flawed, but I tried. -
Originally Posted by AlanHK
OK. Now it worked fine. A couple of questions:
How do you get the blankclip to be at the beginning? I certainly wrote the commands wrongly, but I did try something like what wrote down, putting Fadein0 and all that.
The use of these variables is not that clear to me yet, and I can't seem to grab the reasoning behind them. Where can I get more info about that?And you don't need to name variables if you can use "last".
Sounds clever.With a little more rearrangement you don't need d1 either:
Code:v2=FFMpegSource("file.mkv") a2=nicac3source("file.ac3") audiodub(v2,a2) Trim(4686, 5686) LanczosResize(544,480) AddBorders(88,0,88,0) FadeIn(30) BlankClip(last, 60) ++ last Subtitle("Beginning of Part 2",x=240,y=200,size=40,first_frame=0,last_frame=60) Fadein0(30)
OK. Will do that. Hopefully there's a way to change the fonts too. I wish I could do that with the subs embedded into MKV files, particularly for size.And have a look at the parameters for "Subtitle" http://avisynth.org/mediawiki/Subtitle
You might want to simply centre-align rather than count pixels.
Similar Threads
-
MP4Box & splitting -- won't do as told
By Virnec in forum LinuxReplies: 2Last Post: 23rd Feb 2012, 10:19 -
fading out last 50 frames - but no keyframe.
By davexnet in forum Video ConversionReplies: 3Last Post: 4th Feb 2009, 23:33 -
help with avs script (dv to mpeg2) Fading in/out
By ZiGGY909 in forum EditingReplies: 2Last Post: 14th Nov 2007, 15:12



Quote