VideoHelp Forum




+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 40
  1. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    Total noob here. Had the following script to edit SD clips in the past:
    **********
    Loadcplugin("c:\program files\avisynth 2.5\plugins\yadif.dll")
    Clip1=DirectShowSource("M:\UnconvertedVideo\Clip 017.m2t").Trim(160,320)
    Clip2=DirectShowSource("M:\UnconvertedVideo\Clip 015.m2t").Trim(50,350)+Trim
    Dissolve(clip1,clip2,10)
    yadif()
    **********
    Now trying to use same scipt on HD clips (*.m2t) files. VirtualDub doesn't load this script.
    My questions:
    1.Why doesn't VirtualDub load my script?
    2.Which filter do you recommend for voiceovers (to replace original bad audio) and what would be its usage?
    Quote Quote  
  2. 1) What kind of HD clips ? HDV? AVC? use mediainfo if you don't know

    Do you have haali media splitter and ffdshow installed?

    What error does vdub give?

    2) sorry don't know how you'd do this in avisynth. I would do in an audio editor or NLE
    Quote Quote  
  3. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    1.These are HDV clips.
    2.Have neither haali media splitter nor ffdshow installed. Only have VirtualDub and AviSynth with some filters.
    3.VirtualDub says: Script error:Invalid arguments fo function "Trim", (clip location, line number)

    If I load one individual clip at a time and trim it, no errors. Example:
    *********
    DirectShowSource("M:\UnconvertedVideo\Clip 017.m2t").Trim(160,320)
    *********

    So it's something pertaining to using the trim command on a batch of clips and trying to splice them together. But what?
    Quote Quote  
  4. get rid of the +trim at the end of clip2 , or add arguments to it (you have empty brackets)

    Clip2=DirectShowSource("M:\UnconvertedVideo\Clip 015.m2t").Trim(50,350)

    instead of

    Clip2=DirectShowSource("M:\UnconvertedVideo\Clip 015.m2t").Trim(50,350)+Trim
    Quote Quote  
  5. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by PapaDmitry View Post
    Which filter do you recommend for voiceovers (to replace original bad audio) and what would be its usage?
    AudioDub()
    Quote Quote  
  6. Note that audiodub won't do a voice over, it will only replace the entire audio track. It wasn't clear in your earlier post if you had already prepared the voiceover in another program.
    Quote Quote  
  7. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    this worked, but it's very time consuming.
    ************************************
    Clip1=DirectShowSource("E:\UnconvertedVideo\Hiking with Tim Jorgensen 06-08\Clip 015.m2t").Trim(50,350)
    Clip2=DirectShowSource("E:\UnconvertedVideo\Hiking with Tim Jorgensen 06-08\Clip 015.m2t").Trim(600,1600)
    Clip3=DirectShowSource("E:\UnconvertedVideo\Hiking with Tim Jorgensen 06-08\Clip 015.m2t").Trim(1780,2010)
    Dissolve(clip1,clip2,clip3,10)
    *****************************************
    Question Remains: How does one do multiple 'trim' in one command line on any one individual clip?
    Last edited by PapaDmitry; 8th Jun 2010 at 20:48.
    Quote Quote  
  8. "Just doesn't work" doesn't cut it. What's the error message?

    In your case, it's probably the gap between numbers in your second line.

    Clip2.Trim(178 0,2010)
    Quote Quote  
  9. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    it's the way it pasted. There's no gap in the script. Here's what worked:

    I did this (assigning multiple clip #'s to each part of the clip I want to trim). It worked, but very time consuming.
    ************************************************** ******************************
    Clip1=DirectShowSource("E:\UnconvertedVideo\Hiking with Tim Jorgensen 06-08\Clip 015.m2t").Trim(50,350)
    Clip2=DirectShowSource("E:\UnconvertedVideo\Hiking with Tim Jorgensen 06-08\Clip 015.m2t").Trim(600,1600)
    Clip3=DirectShowSource("E:\UnconvertedVideo\Hiking with Tim Jorgensen 06-08\Clip 015.m2t").Trim(1780,2010)
    Dissolve(clip1,clip2,clip3,10)
    ************************************************** *******************************
    Note that I have to treat each 'trim'of the same clip as a separate clip number. More work, but it works.

    What I would like to know is how to combine them all? How to make more neat?
    Quote Quote  
  10. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by PapaDmitry View Post
    it's the way it pasted. There's no gap in the script.
    Use "CODE" tags (the # button on the formatting bar) when you are posting code.

    Originally Posted by PapaDmitry View Post
    How to make more neat?

    First, put the AVS script in the same folder as your source files, then you don't need the complete paths.
    And all the clips are from the same source, you only need to load it once. The Trims and most other functions work implicitly on whatever is the current clip (called "last" if you need to use it by name).

    Code:
    DirectShowSource("Clip 015.m2t")
    Clip1=Trim(50,350)
    Clip2=Trim(600,1600)
    Clip3=Trim(1780,2010)
    Dissolve(Clip1,Clip2,Clip3,10)
    or, you can skip the clip variables and just do it all inline:

    Code:
    DirectShowSource("Clip 015.m2t")
    Dissolve(Trim(50,350),Trim(600,1600),Trim(1780,2010),10)

    Otherwise, I've never used it but there is a Gui for this kind of editing :avsFilmCutter

    The excellent script editor AvsP also has a Trim editor.
    (New version here: http://forum.doom9.org/showthread.php?t=153248 )
    See this guide, especially page 4-5.
    Last edited by AlanHK; 9th Jun 2010 at 02:56.
    Quote Quote  
  11. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    Thanks.

    How to integrate Audiodub filter code into my script? I want to replace audio on one of my trimmed clips.

    Had there been only one clip, I assume the script would be like this?
    Code:
    video=DirectShowSource("F:\Clip 017.m2t").Trim(160,320)
    audio=WAVSource("F:\track17.wav")
    Audiodub(video,audio)
    How do I make use of the Audiodub filter with multiple trimmed clips like in this code?
    Code:
    Loadcplugin("c:\program files\avisynth 2.5\plugins\yadif.dll")
    Clip1=DirectShowSource("F:\Clip 017.m2t").Trim(160,320)
    Clip2=DirectShowSource("F:\Clip 015.m2t").Trim(50,350)
    Dissolve(clip1,clip2,10)
    yadif()
    Last edited by PapaDmitry; 9th Jun 2010 at 16:11.
    Quote Quote  
  12. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by PapaDmitry View Post
    How to integrate Audiodub filter code into my script? I want to replace audio on one of my trimmed clips.
    Let's assume you want to replace the audio on clip1 only.
    Then you could do it like this:
    Code:
    Loadcplugin("c:\program files\avisynth 2.5\plugins\yadif.dll")
    audio=WAVSource("F:\track17.wav")
    Clip1=DirectShowSource("F:\Clip 017.m2t").Trim(160,320).AudioDub(audio)
    Clip2=DirectShowSource("F:\Clip 015.m2t").Trim(50,350)
    Dissolve(clip1,clip2,10)
    yadif()
    This assumes the new audio fits the trimmed part rather than the original length.
    If the new audio is the full length, put AudioDub(...) before the Trim(...) rather than after.
    Quote Quote  
  13. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    Thanks. The code works:
    Code:
    audio = MPASource("F:\clip 31.mp3", normalize=false)
    clip1 = DirectShowSource("F:\Clip 031.m2t").AudioDub(audio).DelayAudio(-3.0)
    
    audio = MPASource("F:\clip 57.mp3", normalize=false)
    clip2 = DirectShowSource("F:\Clip 057.m2t").AudioDub(audio).DelayAudio(-1.47)
    
    Dissolve(clip1,clip2,3)
    Another question: which filter is used to do a blank black screen transition with some text on the screen to identify the upcoming clip? What would be its usage on the two clips in the code I'd just posted?
    Quote Quote  
  14. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by PapaDmitry View Post
    which filter is used to do a blank black screen transition with some text on the screen to identify the upcoming clip? What would be its usage on the two clips in the code I'd just posted?
    You can use BlankClip() and Subtitle() to do this, eg
    Code:
    clip1 = ...
    clip2 = ...
    trans = BlankClip(clip1, length=25).Subtitle("Clip2 coming up...")
    clip1+trans+clip2  # or use Dissolve(clip1, trans, clip2, 3)
    Quote Quote  
  15. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    okay, I'm making some progress, but a new issue came up. Using the code below I must've joined some ten or so audio and video clips and began noticing that some audio clips get cut-off midway through playback.

    Code:
    audio = MPASource("F:\clip 31.mp3", normalize=false)
    clip1 = DirectShowSource("F:\Clip 031.m2t").AudioDub(audio).DelayAudio(-3.0)
    Question: do the audio and video clips have to be same length (in seconds I mean)? What happens when my audio clip is longer than my video clip? Is there code to correct the difference in clip length if that is even necessary?
    Quote Quote  
  16. Question: do the audio and video clips have to be same length (in seconds I mean)? What happens when my audio clip is longer than my video clip? Is there code to correct the difference in clip length if that is even necessary?
    some suggestions:

    Don't use directshowsource(). It's not necessary frame accurate and inconsistent as it depends on your system installed codecs and filters

    For HDV (MPGE2) sources, I would use DGIndex and MPEG2Source(), which indexes your file and is frame accurate & more consistent

    The A/V length has to be the same, other wise the "overhang" will displace joined clips and you will get desync. You can use Trim() on a audiodub() clip to cut ends to make them flush

    I would use aligned splice (++) instead of unaligned splice(+) e.g. clip1++clip2 , instead of clip1+clip2
    Quote Quote  
  17. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    I would use DGIndex and MPEG2Source()
    Would you give a script example? I've never used anything other than DirectiShowSource() to open *m2t files.

    You can use Trim() on a audiodub() clip to cut ends to make them flush
    Would this make the video and audio clips flush?
    Code:
    AudioDub(audio).DelayAudio(-3.0).Trim()
    Quote Quote  
  18. Originally Posted by PapaDmitry View Post
    I would use DGIndex and MPEG2Source()
    Would you give a script example? I've never used anything other than DirectiShowSource() to open *m2t files.
    There are instructions included in the DGIndex zip file. To summarize, index your file with DGIndex, and use MPEG2Source("video.d2v"). That would replace DirectShowSource("video.m2t")

    It will demux the audio and write the delay value in the name. That value is what you would use for the DelayAudio()

    You can use Trim() on a audiodub() clip to cut ends to make them flush
    Would this make the video and audio clips flush?
    Code:
    AudioDub(audio).DelayAudio(-3.0).Trim()
    No , you have to specify the frame numbers for Trim

    e.g. Trim(0,1000) would cut a clip from frames 0-1000 . If you had "overhanging" audio or video, it would be cut off.
    Last edited by poisondeathray; 21st Jun 2010 at 16:36.
    Quote Quote  
  19. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Trim(0,1000) would cut a clip from frames 0-1000 . If you had "overhanging" audio or video, it would be cut off.
    Depends what you mean by that.
    Anything (video or audio) beyond frame 1000 will clearly be cut off.
    If the audio ends before frame 1000, it will be padded with silence up to frame 1000, unless you also specify pad_audio=false, in which cast the overhang is left in.
    Quote Quote  
  20. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by poisondeathray View Post

    You can use Trim() on a audiodub() clip to cut ends to make them flush
    Would this make the video and audio clips flush?
    Code:
    AudioDub(audio).DelayAudio(-3.0).Trim()
    No , you have to specify the frame numbers for Trim

    e.g. Trim(0,1000) would cut a clip from frames 0-1000 . If you had "overhanging" audio or video, it would be cut off.
    I find a useful trick is to use
    Code:
    Trim(0,0)
    The second 0 is defined as the end of the clip (i.e., the last video frame), so that makes the audio the same length.
    For some reason when I load some AVI files with AviSource the audio appears to be seconds, minutes, even hours, longer than the video, this makes it an exact match. It seems to pad out any shortfall with silence, but I haven't really confirmed that.
    Last edited by AlanHK; 21st Jun 2010 at 21:40.
    Quote Quote  
  21. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by AlanHK View Post
    It seems to pad out any shortfall with silence, but I haven't really confirmed that.
    As I said, it does (unless you set pad_audio=false - default is true).
    Quote Quote  
  22. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    Let's suppose I have two clips joined with a blank transition inbetween like so:
    Code:
    Clip1 = DirectShowSource("F:\Clip 1.m2t")
    Clip2 = DirectShowSource("F:\Clip 2.m2t")
     
    Trans = Blankclip(clip1, length=100).Subtitle("Whatever", size=58, align=5)
    clip1+trans+clip2
    Question 1: How do I use BlankClip with some text to introduce the very first clip?
    Question 2: What is the usage of Subtitle for both clips in the script above at specific frame locations and if subtitles are more than one line long?
    Last edited by PapaDmitry; 24th Jun 2010 at 17:34.
    Quote Quote  
  23. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by PapaDmitry View Post
    Let's suppose I have two clips joined with a blank transition inbetween like so:
    Question 1: How do I use BlankClip with some text to introduce the very first clip?
    Code:
    DirectShowSource("F:\Clip 1.m2t")
    Blankclip(last, length=100).Subtitle("intro text", size=58, align=5)++last
    last ++Blankclip(last, length=100).Subtitle("Whatever001", size=58, align=5)
    last ++DirectShowSource("F:\Clip 2.m2t")

    Originally Posted by PapaDmitry View Post
    Question 2: What is the usage of Subtitle for both clips in the script above at specific frame locations and if subtitles are more than one line long?
    http://avisynth.org/mediawiki/Subtitle
    Multi-line text using "\n" is added in v2.57 and it is used if the lsp (line spacing) parameter is set. It sets the additional line space between two lines in 0.125 pixel units.
    Code:
    Subtitle("Text line 1\nText line 2", lsp=10, first_frame =100, last_frame=200)
    Last edited by AlanHK; 24th Jun 2010 at 21:11. Reason: corrected error
    Quote Quote  
  24. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by AlanHK View Post
    last ++Blankclip(clip1, length=100).Subtitle("Whatever001", size=58, align=5)
    Since you have no longer defined clip1, this should be
    last ++Blankclip(last, length=100).Subtitle("Whatever001", size=58, align=5)

    Also note that when using \n, you can set lsp=0 to get 'normal' line spacing, ie it must be set to something to support \n, but that something can be zero.
    Quote Quote  
  25. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by Gavino View Post
    Since you have no longer defined clip1, this should be
    last ++Blankclip(last, length=100).Subtitle("Whatever001", size=58, align=5)

    Also note that when using \n, you can set lsp=0 to get 'normal' line spacing, ie it must be set to something to support \n, but that something can be zero.
    Thanks, corrected.

    As for lsp, that was just an arbitrary figure. But zero leading isn't "normal", that's the absolute minimum, very tight, normal text has leading about 20% of the pointsize. Depends on the font. If it's being used as a title on a blank frame, no need to squeeze it.
    Last edited by AlanHK; 24th Jun 2010 at 21:16.
    Quote Quote  
  26. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Good point.
    I was just clarifying that there is a difference between setting lsp=0 (which allows \n) and not setting it at all (which doesn't).
    Quote Quote  
  27. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by Gavino View Post
    Good point.
    I was just clarifying that there is a difference between setting lsp=0 (which allows \n) and not setting it at all (which doesn't).
    Yeah, previous versions didn't have multiple lines, so lsp also serves as a flag instead of having a sensible default.

    Code:
    Subtitle("Text line 1\nText line 2")
    actually shows the \n.

    I think that was overcautious myself, to use multiple lines you HAVE to set lsp now, to keep compatiblity with possible old scripts that used a literal "\n"; though I doubt any existed in reality.
    Quote Quote  
  28. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    Check the screenshot. I'd like to display each line with a couple of seconds delay on the bottom to match to when my gf is actually saying them (versus clumped together at the same time). align=2 only displays one line at a time on the bottom. How is that done?

    <img src="http://a03-b03.mypicturetown.com:80/P2PwebCmdController/cache/AO%3D5aqeMx2*NS.jpikl3I%...item.jpg?rot=1" title="" alt="" width="320"height="183">
    Image Attached Thumbnails Click image for larger version

Name:	Untitled.jpg
Views:	325
Size:	73.7 KB
ID:	2461  

    Last edited by PapaDmitry; 27th Jun 2010 at 23:12.
    Quote Quote  
  29. Why not just make a real subtitle? An SRT or SSA subtitle file? Much easier, in my opinion.
    Quote Quote  
  30. Member
    Join Date
    Sep 2009
    Location
    United States
    Search Comp PM
    Because I don't now how to do that. Do you mind telling me how?
    Last edited by PapaDmitry; 27th Jun 2010 at 22:56.
    Quote Quote  



Similar Threads

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