VideoHelp Forum




+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 33
  1. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    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?
    Quote Quote  
  2. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    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.
    Quote Quote  
  3. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    Here it is:

    AVCSource("d:\temp\file.dga")
    FadeOut0(60)
    spline36resize(720,480)
    trim(0, 113861)
    Quote Quote  
  4. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    I suspect the trim is cutting off your fade.

    Try

    Code:
    AVCSource("d:\temp\file.dga")
    trim(0, 113861)
    FadeOut0(60)
    spline36resize(720,480)
    NB: best to use "Code" tags for scripts.
    Quote Quote  
  5. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    Forgive my ignorance. How do you handle "Code" tags?

    You are right. Moving the trim line made it work.

    Thanks!
    Quote Quote  
  6. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Use the bbcode code tag, like
    Code:
    code here
    Quote Quote  
  7. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by carlmart
    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:
    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.
    Quote Quote  
  8. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    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.
    Quote Quote  
  9. Originally Posted by carlmart
    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 can

    Code:
    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
    you can just add this a++b , where "a" is your first section

    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...
    Quote Quote  
  10. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    Great!

    I am using two different scripts: one for video, another one for audio.

    The one for audio is:

    Code:
    v=AVCSource("d:\temp\file.dga") 
    a=Nicac3Source("d:\tmp\file.ac3")
    
    audiodub(v,a)
    trim(0,  106194)
    
    FadeOut0(60)
    
    soundout
    I believe I should only add to that, right?

    blankclip(length=60)
    b=last
    Quote Quote  
  11. 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
    Quote Quote  
  12. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    It's 6ch. If it was 2ch I would simply process the audio in Soundforge.

    And why are you using 2 scripts?
    Well, that was the way I learnt it. I am not too sure on how I should joint them.

    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
    I thought my suggestion above did that.
    Quote Quote  
  13. Originally Posted by carlmart
    It's 6ch. If it was 2ch I would simply process the audio in Soundforge.
    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 produces

    Code:
    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()
    You remove the soundout() , or comment it out if you are encoding the video, and leave it in if encoding audio

    Note I didn't center the subtitle, so you should adjust x, y position, etc...
    Quote Quote  
  14. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    [quote="poisondeathray"]
    Originally Posted by carlmart
    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 produces
    That's interesting. I didn't guess it, but it seems logical that would happen.

    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.
    Quote Quote  
  15. 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.
    No, I just know the basics, the experts are guys like gavino and didee

    1) Why a1 and b1? Why you put "b1=" for the second block only?
    They are just variables that represent something. I could have just have easily used "dog" or "cat" or "z"

    2) What does it mean when you write "=last"?
    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)

    3) How would this be on the part 2 of the split, I mean besides changing to FadeIn0(60)?
    I'm not sure what this mean? can you clarify?

    4) Why do you add "a1++b2"?
    a1 is defined as everything before the a1=last
    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

    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

    6) It's fine about the subtitle.
    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"
    Quote Quote  
  16. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by poisondeathray
    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 produces
    Code:
    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)
    ...
    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 by
    BlankClip(a1, length=60)
    and all properties except length will be taken from a1.
    Quote Quote  
  17. Originally Posted by Gavino
    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 by
    BlankClip(a1, length=60)
    and all properties except length will be taken from a1.
    Nice! Thanks. I learn something new everyday!
    Quote Quote  
  18. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    Originally Posted by poisondeathray
    3) How would this be on the part 2 of the split, I mean besides changing to FadeIn0(60)?

    I'm not sure what this mean? can you clarify?
    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?

    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
    OK. I wasn't sure what commenting out soundout would get me. You said it.
    Quote Quote  
  19. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by carlmart
    Originally Posted by poisondeathray
    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
    OK. I wasn't sure what commenting out soundout would get me. You said it.
    Actually, you don't have to comment out Soundout().

    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.
    Quote Quote  
  20. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    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:

    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()
    The audio file opens fine, but on video I get only the blank clip.

    What am I doing wrong?
    Quote Quote  
  21. 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...
    Quote Quote  
  22. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    Ok, I think I got it. Now I wrote:

    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()
    It worked perfectly for the end of part 1.

    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.
    Quote Quote  
  23. Just reverse the order

    Code:
    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
    or something like that
    Quote Quote  
  24. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    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:

    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 don'put the resizing lines on the blankclip I get: "frame sizes don't match" for c1++d1.

    If I put the lines there I get: "video formats don't match" for c1++d1.

    What am I missing?
    Quote Quote  
  25. 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.
    A simpler way to get blank audio (and video) matching another clip is just to use that clip as the 1st parameter to BlankClip.
    Or you can do it the long way I showed earlier

    Maybe you should re-read the thread to refresh yourself
    Quote Quote  
  26. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    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.
    Quote Quote  
  27. 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
    Quote Quote  
  28. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    You probably have a frame rate or audio mismatch.

    Try this:
    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
    Blankclip can clone the format of a clip -- here "last".
    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:
    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)
    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.
    Quote Quote  
  29. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    Originally Posted by poisondeathray
    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
    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.

    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.
    Quote Quote  
  30. Member
    Join Date
    May 2004
    Location
    Brazil
    Search Comp PM
    Originally Posted by AlanHK
    You probably have a frame rate or audio mismatch.

    Try this:
    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
    Blankclip can clone the format of a clip -- here "last".
    So you don't have to resize or specify anything else except its length.

    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.

    And you don't need to name variables if you can use "last".
    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?

    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)
    Sounds clever.

    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.
    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.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!